Re: [ver. 1.5] Specifying custom User model (extends AbstractUser) doesn't work
I've replaced the use of ForeignKey as mentioned above for models.ForeignKey(settings.AUTH_USER_MODEL). But I still get the following syncdb errors. *** CommandError: One or more models did not validate: admin.logentry: 'user' has a relation with model books.user, which has either not been installed or is abstract. auth.user: Model has been swapped out for 'books.user' which has not been installed or is abstract. registration.registrationprofile: 'user' has a relation with model books.user, which has either not been installed or is abstract. *** Any advice appreciated. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f50f34ba-69e7-4670-92ea-31b7910a34e7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ver. 1.5] Specifying custom User model (extends AbstractUser) doesn't work
And this is why I learnt the names of many of those major in the Django community! Now if I post after them, it's mostly to say. Yes I agree. Like I'm doing now :-) On Wednesday, 24 October 2012 05:02:02 UTC+1, Surya Mukherjee wrote: > > Django's standard User class isn't sufficient for my needs so I am making > my own User class. As per the User Authentication doc page, I am > subclassing AbstractUser (not AbstractBaseUser) to add some new stuff. > > > from django.contrib.auth.models import AbstractUser > > class MyUser(AbstractUser): > test = 'Hello world' > > > Pretty simple so far. In settings.py: > > # Specifies SDBUser as the custom User class for Django to use > AUTH_USER_MODEL = 'app.MyUser' > > > But when i try to syncdb, everything breaks: > > [root@Surya project]# manage syncdb > CommandError: One or more models did not validate: > app.userprofile: 'user' defines a relation with the model 'auth.User', > which has been swapped out. Update the relation to point at > settings.AUTH_USER_MODEL. > auth.user: Model has been swapped out for 'app.SDBUser' which has not been > installed or is abstract. > django_openid_auth.useropenid: 'user' defines a relation with the model > 'auth.User', which has been swapped out. Update the relation to point at > settings.AUTH_USER_MODEL. > > django_openid_auth is a third party OpenID library, but the first two are > pure Django and they're still breaking. Wat do? > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ver. 1.5] Specifying custom User model (extends AbstractUser) doesn't work
On Wed, Oct 24, 2012 at 5:51 PM, Stephen Anto wrote: > Hi, > > You can extend Default Django User model without breaking its > architecture. Just visit http://www.f2finterview.com/web/Django/21/ It > will explain you in detail. If you're going to give advice, it's probably a good idea to check that your advice is current. The approach that the original poster has suggested is in no way "breaking the architecture" of Django - it's one of the new features in Django 1.5. As a side effect of the changes introduced in 1.5, the API you've suggested (AUTH_PROFILE_MODULE) has been deprecated. It will raise warnings if used in Django 1.5 and 1.6, and be removed completely in Django 1.7. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.
Re: [ver. 1.5] Specifying custom User model (extends AbstractUser) doesn't work
Hi, You can extend Default Django User model without breaking its architecture. Just visit http://www.f2finterview.com/web/Django/21/ It will explain you in detail. On Wed, Oct 24, 2012 at 9:32 AM, Surya Mukherjee wrote: > Django's standard User class isn't sufficient for my needs so I am making > my own User class. As per the User Authentication doc page, I am > subclassing AbstractUser (not AbstractBaseUser) to add some new stuff. > > > from django.contrib.auth.models import AbstractUser > > class MyUser(AbstractUser): > test = 'Hello world' > > > Pretty simple so far. In settings.py: > > # Specifies SDBUser as the custom User class for Django to use > AUTH_USER_MODEL = 'app.MyUser' > > > But when i try to syncdb, everything breaks: > > [root@Surya project]# manage syncdb > CommandError: One or more models did not validate: > app.userprofile: 'user' defines a relation with the model 'auth.User', > which has been swapped out. Update the relation to point at > settings.AUTH_USER_MODEL. > auth.user: Model has been swapped out for 'app.SDBUser' which has not been > installed or is abstract. > django_openid_auth.useropenid: 'user' defines a relation with the model > 'auth.User', which has been swapped out. Update the relation to point at > settings.AUTH_USER_MODEL. > > django_openid_auth is a third party OpenID library, but the first two are > pure Django and they're still breaking. Wat do? > > -- > 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/-/fLbSAxq1RysJ. > 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. > -- Thanks & Regards Stephen S Website: www.f2finterview.com Blog: blog.f2finterview.com Tutorial: tutorial.f2finterview.com Group:www.charvigroups.com -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.
Re: [ver. 1.5] Specifying custom User model (extends AbstractUser) doesn't work
On Wed, Oct 24, 2012 at 12:02 PM, Surya Mukherjee wrote: > Django's standard User class isn't sufficient for my needs so I am making > my own User class. As per the User Authentication doc page, I am > subclassing AbstractUser (not AbstractBaseUser) to add some new stuff. > > > from django.contrib.auth.models import AbstractUser > > class MyUser(AbstractUser): > test = 'Hello world' > > > Pretty simple so far. In settings.py: > > # Specifies SDBUser as the custom User class for Django to use > AUTH_USER_MODEL = 'app.MyUser' > > > But when i try to syncdb, everything breaks: > > [root@Surya project]# manage syncdb > CommandError: One or more models did not validate: > app.userprofile: 'user' defines a relation with the model 'auth.User', > which has been swapped out. Update the relation to point at > settings.AUTH_USER_MODEL. > auth.user: Model has been swapped out for 'app.SDBUser' which has not been > installed or is abstract. > django_openid_auth.useropenid: 'user' defines a relation with the model > 'auth.User', which has been swapped out. Update the relation to point at > settings.AUTH_USER_MODEL. > These error messages are telling you the exact problem. The first and third errors indicate that you have two models causing problems -- a UserProfile in an app called "app", and an UserOpenID model in "django_openid_auth". These models both contain a ForeignKey to User, defined as: user = models.ForeignKey(User) This needs to be updated to point at user = models.ForeignKey(settings.AUTH_USER_MODEL) As the error message says -- you need to update the relation to point at settings.AUTH_USER_MODEL. The second error ("Model has been swapped out…") is a side effect of the fact that you're directly referencing the User model. Once you change the ForieignKey references, this third error will go away. > django_openid_auth is a third party OpenID library, but the first two are > pure Django and they're still breaking. Wat do? > We've done everything we can to ensure a smooth transition to the new User model, but it can't be completely transparent. App writers will need to update their apps to be 1.5 compatible. Essentially, a Django 1.4 app won't be 100% compatible with Django 1.5 if it contains a hard-coded foreign key reference to User. This is discussed both in the release notes [1], and in the documentation of the swappable User feature [2]. [1] https://docs.djangoproject.com/en/dev/releases/1.5/#configurable-user-model [2] https://docs.djangoproject.com/en/dev/topics/auth/#auth-custom-user Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. 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.
[ver. 1.5] Specifying custom User model (extends AbstractUser) doesn't work
Django's standard User class isn't sufficient for my needs so I am making my own User class. As per the User Authentication doc page, I am subclassing AbstractUser (not AbstractBaseUser) to add some new stuff. from django.contrib.auth.models import AbstractUser class MyUser(AbstractUser): test = 'Hello world' Pretty simple so far. In settings.py: # Specifies SDBUser as the custom User class for Django to use AUTH_USER_MODEL = 'app.MyUser' But when i try to syncdb, everything breaks: [root@Surya project]# manage syncdb CommandError: One or more models did not validate: app.userprofile: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL. auth.user: Model has been swapped out for 'app.SDBUser' which has not been installed or is abstract. django_openid_auth.useropenid: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL. django_openid_auth is a third party OpenID library, but the first two are pure Django and they're still breaking. Wat do? -- 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/-/fLbSAxq1RysJ. 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.