pytask/profile/regbackend.py
author Nishanth Amuluru <nishanth@fossee.in>
Wed, 12 Jan 2011 00:22:27 +0530
changeset 149 32dd15eaf9d0
parent 77 c63a9519dc37
permissions -rw-r--r--
fixed a bug where guest users were not able to view the page correctly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     1
from pytask.profile.models import Profile
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     2
from pytask.profile.forms import CreateProfileForm
77
c63a9519dc37 fixed 2 bugs
Nishanth Amuluru <nishanth@fossee.in>
parents: 75
diff changeset
     3
from pytask.utils import make_key
75
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     4
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     5
from registration.signals import user_registered
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     6
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     7
def user_created(sender, user, request, **kwargs):
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     8
77
c63a9519dc37 fixed 2 bugs
Nishanth Amuluru <nishanth@fossee.in>
parents: 75
diff changeset
     9
    data = request.POST.copy()
c63a9519dc37 fixed 2 bugs
Nishanth Amuluru <nishanth@fossee.in>
parents: 75
diff changeset
    10
    data.update({"user": user.id, "uniq_key": make_key(Profile)})
75
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    11
    form = CreateProfileForm(data)
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    12
    form.save()
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    13
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    14
user_registered.connect(user_created)
d64b83bdf5a8 Created a custom backend
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    15