Beispiel #1
0
def directorRegister(request):
    context = RequestContext(request)
    url = 'director_register'
    registered = False

    if request.method == 'POST':

        user_form = UserForm(data=request.POST)
        profile_form = DirectorProfileForm(data=request.POST)

        if user_form.is_valid() and profile_form.is_valid():

            user = user_form.save()

            user.set_password(user.password)
            user.save()

            profile = profile_form.save(commit=False)
            profile.user = user

            profile.save()

            registered = True

        else:
            print user_form.errors, profile_form.errors

    else:
        user_form = UserForm()
        profile_form = DirectorProfileForm()

    return render_to_response(
        'extras/register.html',
{'user_form': user_form, 'url': url, 'profile_form': profile_form, 'registered': registered},
          context)
Beispiel #2
0
def actorRegister(request):
    context = RequestContext(request)
    url = 'actor_register'
    registered = False

    if request.method == 'POST':

        user_form = UserForm(data=request.POST)
        profile_form = ActorProfileForm(data=request.POST)


        if user_form.is_valid() and profile_form.is_valid():

            user = user_form.save()

            user.set_password(user.password)
            user.save()

            profile = profile_form.save(commit=False)
            profile.user = user

        # Ideally picture upload for questionnaire form

            if 'picture' in request.FILES:
                profile.picture = request.FILES['picture']

            profile.save()

            registered = True

        else:
            print user_form.errors, profile_form.errors

    else:
        user_form = UserForm()
        profile_form = ActorProfileForm()

    return render_to_response(
        'extras/register.html',
{'user_form': user_form, 'url': url, 'profile_form': profile_form, 'registered': registered}, context)