Is there a way of accessing fields of a model?

I have

class Position(models.Model):
    ....

class Person(models.Model):
    position = models.ForeignKey(Position)

Now, I'd like to get to this position member. Is there another way
besides the following *oh my*:

Person._meta.get_field('position')

I'm trying to create a form from part of the instance but it is so
different from what form_from_instance can give me that I'd rather
create a new form. So, then I'm having

class ContractInformation(forms.Form):
    position =
Person._meta.get_field('position').formfield(empty_label='(Unknown)')

I would hope for something without magic, such as

class ContractInformation(forms.Form):
    position = Person.position.formfield(empty_label='(Unknown)')

but that gives me the error "position must be accessed via instance".
Thank you,
Jiri


--~--~---------~--~----~------------~-------~--~----~
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