That was indeed the way to go, thanks Steve for pointing me into the right direction. I discovered that the AccountForm class already has got an attribute _signup which does what you suggest.
I subclassed the AccountForm. If I am not mistaken I had to hide the profile form fields during signup (not take them out all together during signup) in order to avoid a validation error. The only small drawback left is that I haven't figured our how to make the optional fields "first_name" and "last_name" optional in the AccountForm. Chris Am Dienstag, 26. Januar 2016 23:53:18 UTC+1 schrieb Stephen McDonald: > > I'd suggest using a custom form class, and checking for a bound user > object in its __init__ method, which if present indicates it's the update > form, and not signup, and you can then modify the attributes of each field > programmatically. This would probably turn out to be less code that > defining a form class for each. > > On Wed, Jan 27, 2016 at 7:04 AM, <[email protected] <javascript:> > > wrote: > >> I want to allow new users to register to a mezzanine based site with >> minimal information (i.e. email and password) and allow them to update >> their profile information once they are registered. Therefore I would like >> to display a form with only the two required fields during signup and the >> "full" ProfileForm during profile_update. >> >> Looking at the code in mezzanine.accounts I understand that "signup" view >> as well as the "profile_update" view use the same form (i.e. >> ACCOUNTS_PROFILE_FORM_CLASS). I know I could overcome this by writing my >> custom signup view but is there any other way to solve this so I can keep >> using the build-in code? >> >> If not: Would it make sense to allow the definition of different form >> classes for signup and profile_update? Many modern websites try to >> encourage registration by asking only for minimal information during >> registration but allow users to add addtional profile information later. >> >> Regards Chris >> >> -- >> 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] <javascript:>. >> 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.
