यह link प्रक्रिया अच्छी तरह से बताते हैं और Django पंजीकरण के साथ काम करता 1.0
यहाँ
ऊपर कोड के अलावा कुछ अतिरिक्त संकेत दिए गए हैं।
पहला नाम models.py
def user_registered_callback(sender, user, request, **kwargs):
profile = ExUserProfile(user = user)
profile.is_human = bool(request.POST["is_human"])
user.first_name = request.POST["firstname"]
user.save()
profile.save()
user_registered.connect(user_registered_callback)
में और forms.py फ़ाइल
class ExRegistrationForm(RegistrationForm):
is_human = forms.BooleanField(label = "Are you human?:")
firstname = forms.CharField(max_length=30)
lastname = forms.CharField(max_length=30)
अंत में बदल फार्म पर परिवर्तन उचित खाका बनाने को देखने के लिए अद्यतन करने के लिए। प्रोफ़ाइल एक फाइल अपने अनुप्रयोग में admin.py बुलाया बनाने और निम्न कोड
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from prof.models import ExUserProfile
admin.site.unregister(User)
class UserProfileInline(admin.StackedInline):
model = ExUserProfile
class UserProfileAdmin(UserAdmin):
inlines = [ UserProfileInline, ]
admin.site.register(User, UserProfileAdmin)
क्या आप इसे देखते थे? http://stackoverflow.com/questions/1072270/saving-profile-with-registration-in-django-registration – rafek
@rafek मैं नए कस्टम उपयोगकर्ता मॉडल (Django 1.5 में नया) के साथ प्रयास करें – user2054574