I'd suggest reading the code for the class you're trying to extend: https://github.com/stephenmcd/mezzanine/blob/64f4f404b6a901d50815face4018e72a6554fef7/mezzanine/accounts/forms.py#L72-L87
The form already knows how to deal with the Profile model, there's no need to define that and it's probably what's breaking. On Tue, Jan 12, 2016 at 12:56 AM, Joel Gwynn <[email protected]> wrote: > OK, thanks for the clarification. But I'm still trying to extend the form > for the user signup, and I'm still getting that error. Is this the right > way to extend the ProfileForm? > > On Sunday, January 10, 2016 at 5:45:25 PM UTC-5, Stephen McDonald wrote: >> >> Your code snippet omits where you've imported ProfileForm from, so we'll >> just assume it's from mezzanine.accounts.forms - in which case you're using >> it incorrectly, as it's the sign-up form for the front-end website, not the >> form for managing users in the admin. >> >> >> On Mon, Jan 11, 2016 at 2:44 AM, Joel Gwynn <[email protected]> wrote: >> >>> I must be missing something obvious here. I'm just trying to extend the >>> profile form like so: >>> >>> >>> # models.py >>> class Profile(models.Model): >>> user = models.OneToOneField(User, on_delete=models.CASCADE) >>> >>> organizations = models.ManyToManyField(Organization, default=None, >>> blank=True) >>> groups = models.ManyToManyField(Group, default=None, blank=True) >>> >>> >>> # admin.py >>> class ProfileAdmin(admin.ModelAdmin): >>> model = Profile >>> form = WebProfileForm >>> >>> admin.site.register(Profile, ProfileAdmin) >>> >>> >>> # forms.py >>> >>> class WebProfileForm(ProfileForm): >>> >>> class Meta(ProfileForm.Meta): >>> model = Profile >>> exclude = [] >>> >>> >>> but I'm getting this error: >>> >>> django.core.exceptions.FieldError: Unknown field(s) (username, >>> first_name, last_name, email) specified for Profile >>> >>> TIA, >>> Joel >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Mezzanine Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Stephen McDonald >> http://jupo.org >> > -- > You received this message because you are subscribed to the Google Groups > "Mezzanine Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Stephen McDonald http://jupo.org -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
