i upgraded to 0.8 and start doing things your way and it seems to work fine. i just have one question, is this code OK or yours is better? if yes why is that?
def create_user_profile(sender, instance, created, **kwargs): if created: UserProfile.objects.create(user=instance) post_save.connect(create_user_profile, sender=User) On Saturday, April 21, 2012 10:51:18 PM UTC+1, Ejah wrote: > > No problem. You would need to upgrade to 0.8 to make this work. > Enjoy! > > On Apr 21, 11:46 pm, psychok7 <nun...@gmail.com> wrote: > > yes 0.7 , well ill give it a try then :) if i run into problems i will > > bother you a little bit further > > > > > > > > > > > > > > > > On Saturday, April 21, 2012 10:33:32 PM UTC+1, Ejah wrote: > > > > > Hi, > > > What version of django-registration are you using? I assume 0.7 > > > The usage of profile_callback has been removed in 0.8, a very recent > > > release actually, looking at the codebase history. > > > The finer documentation on the usage of 0.8 is made available at: > > >http://docs.b-list.org/django-registration/0.8/ > > > > > What you are looking for was originally provided for in django- > > > profiles, which integrated nicely with django-registration. > > > > > However, the way to go now is to create a new app, add your user > > > profile class there, and connect to the > > > registration.signals.user_registered signal. > > > > > Small example: > > > > > models.py (in myapp) > > > from django.db import models > > > from registration.signals import user_registered > > > from django.dispatch import receiver > > > > > class MySuperDuperUserProfile(models.Model): > > > user = models.ForeignKey(User) > > > whatever = models.CharField(max_length=100) > > > wherever = models.CharField(max_length=50) > > > > > @receiver(user_registered) > > > def create_superduper_user_profile(sender, **kwargs): > > > new_user = kwargs.pop('user', None) > > > data_dict_from_registration_form = kwargs.pop('request', > > > None).POST > > > sdup = MySuperDuperUserProfile() > > > sdup.user = new_user > > > sdup.whatever = data_dict_from_registration_form['whatever'] > > > sdup.wherever = data_dict_from_registration_form['wherever'] > > > sdup.save() > > > > > That's all folks. No messing around with existing code. You can create > > > a custom registration form in which you add your profile fields, that > > > you pass to the registration view via de url, and get the form fields > > > from the request that also gets sent to the > > > create_superduper_user_function. Please note I did not run this sample > > > code, so some bugs certainly will be there. > > > HTH > > > Cheers > > > > > On Apr 21, 4:42 pm, psychok7 <nun...@gmail.com> wrote: > > > > Ejah i did that because in registration source code there are some > > > values > > > > in Profile_callback set to NONE.. should i leave it like that?? the > > > > comments say i should change it and equal it to my user profile. is > that > > > it > > > > or i am doing it the wrong way? > > > > > > On Saturday, April 21, 2012 3:29:40 PM UTC+1, Ejah wrote: > > > > > > > If I am not mistaken you are editting the Registration source > files. > > > > > There is no need to do that. > > > > > Simply add a new App. Create your user profile class in its > models.py > > > > > file, name it whatever you like. Add registration and your App to > the > > > > > installed_apps in your settings file. Edit the settings file and > make > > > > > your model class the userprofile USER_PROFILE=yourclassname > > > > > Add the urls from django-registration to your projects urls.py. > > > > > Register your model in the admin, syncdb and your profile will > show > > > > > up. > > > > > You can read the docs on djangoproject.com on how to do that, its > > > > > easy. > > > > > The docs on registration are short but accurate, and the source is > > > > > well documented. > > > > > Hth > > > > > > > On 21 apr, 15:50, Brandy <brandy.norri...@yahoo.com> wrote: > > > > > > Have you created an admin.py file? It should look something like > > > this: > > > > > > > > from poll.models import Poll > > > > > > from django.contrib import admin > > > > > > > > admin.site.register(Poll) > > > > > > > > On Saturday, April 21, 2012 12:28:05 AM UTC-5, psychok7 wrote: > > > > > > > hi there, i am quite new to django and i am having a little > > > trouble > > > > > > > extending my User with Userprofile. i have read lots of > > > documentation > > > > > about > > > > > > > it and i have implemented as an extension of > > > > > > > > https://bitbucket.org/ubernostrum/django-registrationaversionbut > > > i > > > > > am > > > > > > > not sure it works the way its supposed to. basically when i > create > > > a > > > > > new > > > > > > > user (in admin view), only the basic built in fields show up, > but > > > my > > > > > new > > > > > > > fields don't.. on the other hand my database seems to be ok > with > > > one > > > > > table > > > > > > > for user and another for user profile with the ids matching. > can > > > you > > > > > guys > > > > > > > help me and let me know wht am i doing wrong and whats the > correct > > > > > way? > > > > > > > PLEASE don't refer me back to the documentation because i have > > > read it > > > > > all > > > > > > > > > here is my code: > > > > > > >http://paste.ubuntu.com/939226/ > > > > > > >http://paste.ubuntu.com/939227/ > > > > > > >http://paste.ubuntu.com/939229/ > > > > > > > > > i also added AUTH_PROFILE_MODULE = 'registration.UserProfile' > in > > > > > > > settings.py -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/98xtHrZ3TqIJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.