Hi, I try override a ModelForms init to claim the variable instance. After that I call super.__init__(). It's almost working, but there is no form shown in the browser. Any ideas what might be wrong?
class ProfileForm(ModelForm): first_name = forms.CharField(required=False, max_length=30) last_name = forms.CharField(required=False, max_length=30) class Meta: model = UserProfile exclude = ('user',) # User will be filled in by the view. def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=None, label_suffix=':', empty_permitted=False, instance=None): f = open('debug.txt', 'w') f.write("%s \n\n-----\n\n" % instance.user.first_name) # Bob f.write("%s \n\n-----\n\n" % instance.user.last_name) # Marley super(ProfileForm, self).__init__(data, files, auto_id, prefix, initial, error_class, label_suffix, empty_permitted, instance) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---