I found the soultion:

news._meta.fields[x].get_internal_type()

this returns 'ForeignKey' if the field is a FK.



On 17 Mai, 12:06, mwebs <[EMAIL PROTECTED]> wrote:
> Thank you,
>
> thats exactly what I was looking for.
> But how can I test if a field is a ForeignKey?
>
> On 17 Mai, 11:01, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
>
> > On Sat, 2008-05-17 at 00:59 -0700, mwebs wrote:
> > > Hi,
>
> > > is there any possibility to get the field from a model instance that
> > > speciefies a foreignkey-relationship.
>
> > > something like this:
>
> > > news.__foreignKey__   # returns 'category'
>
> > Just inspect news._meta.fields, you'll find what you need there.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to