pytask/profile/regbackend.py
author Nishanth Amuluru <nishanth@fossee.in>
Tue, 11 Jan 2011 12:30:10 +0530
changeset 140 8fcde6f8f750
parent 77 c63a9519dc37
permissions -rw-r--r--
added view_user functionality
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