Hi, I have a ModelForm of my UserProfile model with two additional fields. I need to override save(), to save the additional fields to the django.contrib.auth.model.User model. I tried to do that with a subclass of my UserProfile model class to have the code separated. But I get a NameError: name 'ProfileFormExtended' is not defined.
from django.contrib.auth.models import User from django.db import models from django.forms.models import ModelForm from django import forms from myproject.myapp.models import UserProfile class ProfileForm(ModelForm): first_name = forms.CharField(max_length=30) last_name = forms.CharField(max_length=30) class Meta: model = ProfileFormExtended exclude = ('user', 'avatar',) # User will be filled in by the view. class ProfileFormExtended(UserProfile): def save(self, force_insert=False, force_update=False): if self.name == "Yoko Ono's blog": else: super(ProfileFormExtended, self).save(force_insert, force_update) # Call the "real" save() method. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---