funkybob / django-sniplates

Template snippet libraries for Django
MIT License
57 stars 18 forks source link

Feature/pluggable-explosives: value vs. raw_value in templates #36

Closed sergei-maertens closed 8 years ago

sergei-maertens commented 9 years ago

So, first bit of testing this feature branch, and I ran into the following issue:

A lot of the provided templates will have to change value to raw_value, including your test templates I think. Right now, the raw_value None will be output in TextInput as <input type="text" value="None">. Or, the value property should maybe catch the values None, 'False,True`.

My personal preference would be to just use raw_value in the template, but that can lead to inconsistencies. For scalar values it makes sense, for fields with choices not so much, since the choices property returns values that have been force_text'ed, you have to do the comparisons against the force_text'ed raw_value, which is value in the template. So then you will be using raw_value and value in the template, for seemingly the same check - i.e.: is this choice the current/selected value?

funkybob commented 9 years ago

Can you please log each issue separately?

sergei-maertens commented 9 years ago

I'm not really sure how, I'm actually describing a single issue here. I do mention another one, but that PR already got merged so that's fine.

I'll edit the first line to make it clear that it's a single issue.

sergei-maertens commented 8 years ago

Tests + fixes in https://github.com/funkybob/django-sniplates/pull/38