Thursday, September 22, 2016

Re: Foreign key set template

model.foreignkey_set returns a manager while model.foreignkey_set.all returns a QuerySet.

https://docs.djangoproject.com/en/stable/topics/db/queries/#following-relationships-backward

On Thursday, September 22, 2016 at 7:09:27 AM UTC-4, jorr...@gmail.com wrote:
I have a question about using model.foreignkey_set in Django templates. I was trying to use model.foreignkey_set to determine if there were any foreign keys for this model, but it appears that model.foreignkey_set returns something different than model.foreignkey_set.all - why is that? Shouldn't both return None if there are no foreign keys?

Just curious :)

--
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/edd80794-cae1-45fb-9ea9-da3cdf124192%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment