I am trying to abstract one of my applications.
for f in self._meta.fields:
print f
if f.get_internal_type() == "ForeignKey":
for o in f.related.parent_model.objects.all():
I am using the above code to isolate any fields in self._meta.fields that are foreign keys. I need to get data from these foreignkey relations to other models.
Is this possible please?
Thank you
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/VTI0bZCwTZwJ.
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