Hi Andrew,

My custom model looks like this:

from django.contrib.auth.models import User

class MyUser(User):
   class Meta:
        proxy = True

    def my_custom_method(self):
        return "Something"

This is a proxy class and it's only scope is to extend the User model with 
a method. And how I understand from here: 
https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#custom-users-and-proxy-models
 
 I must inherit directly from the User model that is currently in use in my 
project.
I understood Daniel Roseman's suggestions and I wanted to follow it, but it 
thrown me the exception: TypeError: MyUser cannot proxy the swapped model 
'myapp.MyUser'.



On Monday, September 15, 2014 6:51:11 PM UTC+3, Andrew Pinkham wrote:

> Hi Izabella, 
> Could you provide your custom user model declaration? 
>
> According the the documentation, you should be inheriting from 
> `AbstractBaseUser`. 
>
>
> https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#substituting-a-custom-user-model
>  
>
>
> https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#django.contrib.auth.models.AbstractBaseUser
>  
>
> JJ Zolper and Russel Keith Magee recently posted about a custom email user 
> on the Django Developer mailing list. You may find the code useful: 
>
>
> https://github.com/freakboy3742/django/commit/f54da396a0be09550d69625e1215119dfb4898e4#diff-49fc6cea24d46bdb27339c1aab392e32R379
>  
>
> Note that the code inherits not only from `AbstractBaseUser`, but also 
> from a `PermissionsMixin`, which may or may not be desirable for you. 
>
> Hope that helps, 
> Andrew 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5349e6e1-0e12-4eaf-9635-5a494666b4be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to