views:

1033

answers:

1

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:

"To enable creation of a custom user profile along with the User (e.g., the model specified in the AUTH_PROFILE_MODULE setting), define a function which knows how to create and save an instance of that model with appropriate default values, and pass it as the keyword argument profile_callback. This function should accept one keyword argument: user The User to relate the profile to."

Can someone give me an example of the function that needs to be created and how to pass it as a argument?

+5  A: 

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.

Harold
Well, i need to do the same...but i can undestand how ill show the profile form in the sample place of the register form and save the data... i dont know im lost...thanks
Asinox