8👍
You can pass the callback function in your urls.py file.
from mysite.profile.models import UserProfile
url( r'^accounts/register/$', 'registration.views.register',
{ 'profile_callback': UserProfile.objects.create }, name = 'registration_register' ),
Substitute your own function for UserProfile.objects.create as needed.
6👍
This is covered in this blogpost and expanded on in my answer to another question on the same issue
django-registration sends a signal at various events happening – registration and activation. At either of those points you can create a hook to that signal which will be given the user and request objects – from there you can create a profile for that user.
The signal from django-registration
#registration.signals.py
user_registered = Signal(providing_args=["user", "request"])
Code to create profile
#signals.py (in your project)
user_registered.connect(create_profile)
def create_profile(sender, instance, request, **kwargs):
from myapp.models import Profile
#If you want to set any values (perhaps passed via request)
#you can do that here
Profile(user = instance).save()
- Get Celery to Use Django Test DB
- How to store django objects as session variables ( object is not JSON serializable)?
- In MVC (eg. Django) what's the best place to put your heavy logic?
- Psycopg2 OperationalError: cursor does not exist
1👍
For anyone who met this problem, I think this blog post is a good tutorial: http://johnparsons.net/index.php/2013/06/28/creating-profiles-with-django-registration/.
- Whats the correct format for django dateTime?
- Django conditional annotation
- Celery autodiscover_tasks not working for all Django 1.7 apps
- How can I set a minimum password length when using the built-in Django auth module?
- How to add a permission to a user/group during a django migration?
Source:stackexchange.com