Hi all, congrats on the 1.11 release!
Prior to Django 1.11's form template rendering, I had a form template that rendered choices like so:
```
{% for choice in form.field_with_choices %} # forms.ChoiceField()
{% if choice.choice_value is Value %}
```
Not the prettiest, but it's worked for now. When upgrading from 1.10 to 1.11, our tests around these templates broke. I couldn't find anything in the 1.11 release/upgrade notes about this, so I did a bit of digging.
The reason seems to be that the new form rendering uses the django.forms.boundfield.BoundWidget class, which doesn't have a choice_value attribute/method. It does have choice_label() and other related methods, just not choice_value(). Previous widget rendering exposed choice.choice_value to the template, not choice._choice_value, so this seems to be a regression.
Was the removal of choice.choice_value() on purpose? If so, would you be open to a PR for the release notes indicating that it was removed in favor of using `choice.data.value`?
Best,
Rodney
-- Prior to Django 1.11's form template rendering, I had a form template that rendered choices like so:
```
{% for choice in form.field_with_choices %} # forms.ChoiceField()
{% if choice.choice_value is Value %}
```
Not the prettiest, but it's worked for now. When upgrading from 1.10 to 1.11, our tests around these templates broke. I couldn't find anything in the 1.11 release/upgrade notes about this, so I did a bit of digging.
The reason seems to be that the new form rendering uses the django.forms.boundfield.BoundWidget class, which doesn't have a choice_value attribute/method. It does have choice_label() and other related methods, just not choice_value(). Previous widget rendering exposed choice.choice_value to the template, not choice._choice_value, so this seems to be a regression.
Was the removal of choice.choice_value() on purpose? If so, would you be open to a PR for the release notes indicating that it was removed in favor of using `choice.data.value`?
Best,
Rodney
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a7b941e4-879a-4a75-8079-f853f5d8a1c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment