- def get_account_forms(self):
- user_form = forms.models.modelform_factory(User, fields=self.user_fields)
-
- if self.account_profile is None:
- profile_form = None
- else:
- profile_form = forms.models.modelform_factory(self.account_profile, fields=self.account_profile_fields or [field.name for field in self.account_profile._meta.fields if field.editable and field.name != 'user'])
-
- for field_name, field in user_form.base_fields.items():
- if field_name in self.required_user_fields:
- field.required = True
- return user_form, profile_form
-
- def get_account_form_instances(self, user, data=None):
- form_instances = []
- user_form, profile_form = self.get_account_forms()
- if data is None:
- form_instances.append(user_form(instance=user))
- if profile_form:
- form_instances.append(profile_form(instance=self.account_profile._default_manager.get_or_create(user=user)[0]))
- else:
- form_instances.append(user_form(data, instance=user))
- if profile_form:
- form_instances.append(profile_form(data, instance=self.account_profile._default_manager.get_or_create(user=user)[0]))
-
- return form_instances
-
- def account_view(self, request, node=None, extra_context=None, token_generator=email_token_generator, *args, **kwargs):
+ def account_view(self, request, extra_context=None, token_generator=email_token_generator, *args, **kwargs):