Saving profile with registration in Django-Registration

前端 未结 3 802
名媛妹妹
名媛妹妹 2020-12-23 23:36

In Django-Registration it says you can save a custom profile when you save a user.
But I have no idea what the documentation is asking me to do. Here is what they say

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-24 00:01

    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.

提交回复
热议问题