Hi,

ModelForm should automatically create a dropdown list for your foreign key.
If there is nor such drop-down created probably you are doing something
wrong.

-- 
eng. Ilian Iliev
Web Software Developer

Mobile: +359 88 66 08 400
Website: http://ilian.i-n-i.org


On Tue, Sep 20, 2011 at 1:26 PM, Jonas Geiregat <jo...@geiregat.org> wrote:

> Hello,
>
> I have a UserProfile model:
>
> class UserProfile(FacebookProfileModel):
>    user = models.ForeignKey(User, unique=True)
>    lastfm_user = models.CharField(max_length=20, blank=True)
>
> This should be turned into a real HTML form , I which to use the ModelForm
> class for this.
>
> class UserProfileForm(ModelForm):
>    class Meta:
>                model = UserProfile
>                # I can select lastfm_user or any other properties I have
> defined in the UserProfile model
>                # But what if I wanted to only show the user__username field
> in the form ?
>
>                # This doesn't work
>                fields = ('user__username',)
>
> I've searched the docs , read the page about creating froms from models but
> didn't found any clues.
> Is this even possible at all ?
>
> Now I'm implementing the form by hand , which is a lot of work , being able
> to use the ModelForm would speed up this process.
>
> Regards,
>
>
> Jonas Geiregat
> jo...@geiregat.org
>
>
>
>
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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