David,

Django already comes with a built-in contenttypes application which does 
exactly what you trying to accomplish, i think.

You should read the documentation:
https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/



On Friday, July 27, 2012 8:47:37 AM UTC-4, David wrote:
>
> Hi
>
> 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/-/3LeoMbfXKkMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to