I'm trying to create queryset of objects by adding for example a True/
False string for each objects
Example:
Normally a queryset of book in views could be
books = Book.objects.all()
I want to add in the books queryset, and for each book object a True/
False information in order to construct a new querySet like this
[<Book: book1>, param=True],[<Book: book1>, param=False]......
Maybe I could need to label the string(with param keyword like the
example above) in order to use it in templates as
{% for book in books %}
{% if param =True %}
DO THIS
{% else %}
DO THAT
{% endif %}
{% endfor %}
Do you know an easy way to do such thing?
Really thanks in advance
Grégory Sémah
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment