Re: Was Form choice.choice_value silently removed in 1.11?

2017-04-07 Thread Rodney Folz
Ah, you're right. I must have missed that. Thanks very much!

On Tuesday, April 4, 2017 at 7:45:43 PM UTC-7, Tim Graham wrote:
>
> It looks like that's covered here:
>
>
> https://docs.djangoproject.com/en/1.11/releases/1.11/#changes-due-to-the-introduction-of-template-based-widget-rendering
>
> choice_value is an attribute of ChoiceInput which was undocumented and 
> removed.
>
> On Tuesday, April 4, 2017 at 7:33:18 PM UTC-4, Rodney Folz wrote:
>>
>> 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
>>
>>

-- 
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+unsubscr...@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/12162cb7-c4b0-43b7-ad05-13757b93984f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Was Form choice.choice_value silently removed in 1.11?

2017-04-04 Thread Rodney Folz
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

-- 
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+unsubscr...@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.