33👍
Use it like a Manager
. If you want all the objects then call the all()
method.
- [Django]-Why does my Django admin site not have styles / CSS loading?
- [Django]-Chaining multiple filter() in Django, is this a bug?
- [Django]-Creating a JSON response using Django and Python
16👍
you have to use .all() with related name or childModel_set model name .
in views.py use :
for item in object.relatedname.all():
do something ......
in html templates use:
{% for item in object.relatedname.all %}
do something ......
{% endfor %}
👤K.A
- [Django]-Django change default runserver port
- [Django]-Unique fields that allow nulls in Django
- [Django]-Django Forms: if not valid, show form with error message
2👍
If you are expiriencing this error in Django template try:
{% for block in group.block_set.all %}
{{ block }}
{% endfor %}
- [Django]-Django dump data for a single model?
- [Django]-Django error: got multiple values for keyword argument
- [Django]-How can I upgrade specific packages using pip and a requirements file?
Source:stackexchange.com