Thursday, November 1, 2018

Re: There's way to change "model_list" result variable name from ListView?

On Wednesday, 31 October 2018 12:51:15 UTC, Fellipe Henrique wrote:
Hi,

Normal ListView result a list with "model"_list  as name... there's any way to change these name?



You can set `context_object_name` to whatever name you want. 

This is documented here: https://docs.djangoproject.com/en/2.1/topics/class-based-views/generic-display/#making-friendly-template-contexts
-- 
DR.
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/abf4b557-63f6-430f-8a35-05a1497c6ab0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment