Friday, February 24, 2012

Re: help needed with multiple profile images with UserProfile

Hi Tom,

Thanks for your reply. So for clarity i thought i was getting the
userprofile to pass into the bound form so that the userprofile_id in
the UserProfilePic would get populated/saved. as if i leave the
instance as None
then i get an error saying that userprofile_id cannot be empty? also,
is a 1 to may relationship here correct for what i want to achieve?


On Feb 24, 6:47 am, Tom Evans <tevans...@googlemail.com> wrote:
> On Fri, Feb 24, 2012 at 2:20 PM, richard <pullenjenn...@gmail.com> wrote:
> > Hi, Am i doing this in the correct way?
> > […]
>
> > any help would be greatly appreciated.
>
> > […]
>
> > from .models import UserProfilePic
> > class UserProfilePicForm(ModelForm):
> >    class Meta:
> >        model = UserProfilePic
> >        fields = ('profilepic',)
>
> > […]
>
> >    form = UserProfilePicForm(instance=u.get_profile())
>
> u.get_profile() returns a UserProfile. Your form definition says that
> this form is for a UserProfilePic model.
>
> Cheers
>
> Tom

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment