I'm creating a profile form that includes first_name and last_name fields that write to the User model and additional fields that write to my user profile model derived from Alex S's post here: http://groups.google.com/group/django-users/msg/00e49ca16c63762c
class UserProfileForm(forms.Form): first_name = forms.CharField(max_length=128, required=False) last_name = forms.CharField(max_length=128, required=False) # userprofile form address1 = forms.CharField(widget=forms.TextInput(attrs={ 'size': '40' }), required=False) address2 = forms.CharField(widget=forms.TextInput(attrs={ 'size': '40' }), required=False) address3 = forms.CharField(widget=forms.TextInput(attrs={ 'size': '40' }), required=False) towncity = forms.CharField(widget=forms.TextInput(attrs={ 'size': '40' }), required=False) adminregion = forms.CharField(widget=forms.TextInput(attrs={ 'size': '40' }), required=False) country = forms.CharField(max_length=128, required=False) postcode = forms.CharField(max_length=10, required=False) telno = forms.CharField(max_length=20, required=False) email = forms.EmailField(required=False) I have implemented a save() method but haven't tested it yet. The urlpattern for this is: (r'^profiles/edit/$', 'profiles.views.edit_profile', { "form_class": UserProfileForm }, "profile_edit_profile") I can draw an instance of the form using django-profile's profile_edit_profile view but this is not currently populating the form with existing profile data. Following the django-profile docs, I have created an __init__ function for the form as follows: def __init__(self, instance, *args, **kwargs): super(UserProfileForm, self).__init__(instance, *args, **kwargs) self.instance = instance This returns a form because it creates an 'instance' keyword but doesn't populate it with data from profile_obj as called in views.py. Do I need to call profile_obj in my init function and how, or is it something else, or am I looking in the wrong direction. Document pointers are welcome as I can't find anything specific. Thanks Simon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---