Skip to content

Instantly share code, notes, and snippets.

@LowerDeez
Created January 19, 2018 15:26
Show Gist options
  • Save LowerDeez/8a813840b351745d72e1c4b0c05fb036 to your computer and use it in GitHub Desktop.
Save LowerDeez/8a813840b351745d72e1c4b0c05fb036 to your computer and use it in GitHub Desktop.
Django. Render ModelChoice field as quanryset in pug with adding custom data-attrs for option tag
select.ordering__select(data-msg=trans('Заполните поле'), required)
+for('item in form.fields.field_name.queryset')
option(value=exp('item.pk'), data-price=exp('item.price'))
+exp item.title
.errors
+exp form.delivery_way.errors.as_text()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment