On Fri, Mar 16, 2012 at 6:00 AM, HarryBoy <ryanjpc...@gmail.com> wrote:
> I have the following:
>
>               <div class="StackRow_Edit_Right">
>                    <input type="radio" id="StackRow1Input"
> name="EnableLogUpload" value="true"  {% if EnableLogUpload == '1' %}
> checked="checked" {% endif %} />Enabled<br />
>                    <input type="radio" id="StackRow1Input"
> name="EnableLogUpload" value="false" {% if EnableLogUpload == '0' %}
> checked="checked" {% endif %}  />Disabled
>                </div>
>
> Then the following if statement:
> <div id="EnableLogUpload" class="StackRow_Middle">{% if
> EnableLogUpload == '1' %} Enabled  {% else %} Disabled {% endif %} </
> div>
>
> The above code works as expected (If EnableLogUpload equals to true
> then 'Enabled' is displayed else 'Disabled' is displayed.
>
> But I want to change the 'value' of the radio buttons to "Enabled" and
> "Disabled" instead of "true" and "false" like so:
>   <div class="StackRow_Edit_Right">
>                    <input type="radio" id="StackRow1Input"
{# print it here to see what it is #}{{EnableLogUpload}}
> name="EnableLogUpload" value="Enabled"  {% if EnableLogUpload == '1'
> %} checked="checked" {% endif %} />Enabled<br />
>                    <input type="radio" id="StackRow1Input"
> name="EnableLogUpload" value="Disabled" {% if EnableLogUpload == '0'
> %} checked="checked" {% endif %}  />Disabled
>                </div>
>
> But I can't get the  django if statement to work:
> e.g.
> <div id="EnableLogUpload" class="StackRow_Middle">{% if
> EnableLogUpload == "Enabled"  %} Enabled  {% else %} Disabled {% endif
> %} </div>
>
> This always prints out 'Disabled' even when the EnableLogUpload is
> "Enabled".
>
> Am I doing something incorrect??
>
Try printing the value before you do the test to see if it is what you
think it is

>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Joel Goldstick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to