Template/Form looks like this:
English:<input type="checkbox" name="language" value="English" /><br/>
Spanish:<input type="checkbox" name="language" value="Spanish" /><br/>
Portuguese: <input type="checkbox" name="language" value="Portuguese" /
>
Database model defines column:
languages = db.StringListProperty() #stores multiple
languages
I stored data into Google/BigTable like this:
session.languages = self.request.get_all('language')
That part works fine.
Now - I have the data stored, and I want to display it back on the
same form (the form is spread across 5 pages, and the user can move
backward and forward between the 5 pages). I have stored the data in
a "Session" table and using Session objects to tie it together.
The list of languages might contain for example: English, Spanish,
French.
The form needs to set the checkboxes as "checked" if the appropriate
language is in my list, something like this:
<img src="http://3wcloud.com/images/flags/english.jpg">
<input type="checkbox" name="language" value="English" />
{% ifequal Session.languages 'English' %}
checked
{% endifequal %}
>English<br />
In the above, the keyword "ifequal" will do the job.
Is there some keyword like "iflistcontains"? Do I have to do a
forloop and test myself?
I also tried this with no success:
{% if session.languages['English'] %}
checked
{% endif %}
which gives this error:
raise TemplateSyntaxError, "Could not parse the remainder: %s" %
token[upto:]
TemplateSyntaxError: Could not parse the remainder: ['English']
I guess this doesn't make sense because I have a list, not a
dictionary, of which "English" could just be one potential value.
Please - what will work for this scenario?
Thanks,
Neal Walters
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---