Monday, May 31, 2010

Re: django-registration custom fields

I am using django-profiles with django-registration as per tutorial from

http://praveensunsetpoint.wordpress.com/2009/04/21/django-registration-and-django-profile

But after the submitting the form I am getting this error

AttributeError at /accounts/register/

'RegistrationForm' object has no attribute 'save'

Please help me

#################################################################################

def register(request, success_url=None,form_class=RegistrationFormUniqueEmail, profile_callback=None,
    template_name='registration/registration_form.html',
    extra_context=None):
    pform_class = utils.get_profile_form()
 
 
    if request.method == 'POST':
        profileform = pform_class(data=request.POST, files=request.FILES)
        form = form_class(data=request.POST, files=request.FILES)
 
        if form.is_valid():
            new_user = form.save()
            profile_obj = profileform.save(commit=False)
            profile_obj.user = new_user
            profile_obj.save()
 
            return HttpResponseRedirect('/accounts/register/complete/')
 
    else:
        form = form_class()
        profileform = pform_class()
 
    if extra_context is None:
        extra_context = {}
        context = RequestContext(request)
 
        for key, value in extra_context.items():
            context[key] = callable(value) and value() or value
 
    return render_to_response(template_name,{'form': form,'profileform':profileform,}, context_instance=context)
 
####################################################################################

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment