0

I've been banging my head against a wall here for some time it seems and so I'd like to put the questions out to you guys.

I'm building an application that has multiple user account types, let's say 3 types. My models.py looks something like:

class UserProfile(User):  #this User is the auth.User model

    USER_TYPE_CHOICES = (
                    ('artist','Artist'),
                    ('venue','Venue'),
                    ('spl','Sound/Power/Lights'),
                    ('promoter','Promoter'))
    account_type = models.CharField(max_length=25, null=False, choices=USER_TYPE_CHOICES)

class A(UserProfile):
    #stuff

class B(UserProfile):
    #stuff

class C(UserProfile):
    #stuff

I added UserProfile to the AUTH_PROFILE_MODULE setting. And I've modified the forms and views in mezzanine's accounts application to work with the models that I've mentioned above. The way I thought it should be working is that I'd have an initial page where the auth.User fields will be provided (username, first name, etc) and the choice made in the account_type field will take the user to the next form for the relevant user type.

The problem is, I'm getting the "ImproperlyConfigured at /accounts/signup/" error. I found out that AUTH_PROFILE_MODULE was deprecated in Django 1.6. In that case, why is Mezzanine asking me to configure it correctly with a foreignkey to auth.User?

I've tried multiple approaches before this, but got nowhere. Is there a right way to get this done? I am new to django development as well as web development.

Siddharth Kumar
  • 134
  • 1
  • 7
  • "A mantra for working with Mezzanine: Mezzanine Is Just Django - Ken Bolton, long-time Mezzanine contributor." Have you referred to the django docs concerning this. https://docs.djangoproject.com/en/dev/topics/auth/customizing/#extending-the-existing-user-model – Zach Oct 28 '14 at 20:53
  • You can also look at an existing project that creates custom user models too: https://github.com/fusionbox/django-authtools – Zach Oct 28 '14 at 20:58
  • Yes, I looked at that, and up until now I was hesitant about writing my own code as opposed to modifying something that already existed, but I'm going to do that now and see where it takes me. Thanks. – Siddharth Kumar Nov 02 '14 at 09:45
  • @Zach Now I'm facing another problem. I'm using authtools for solving my problem, but Mezzanine doesn't support the use of auth_user_models and when I install authtools it gives me an exception when I try to login to the admin panel using the admin I created while installing authtools because the admin user model doesn't have a username field anymore and mezzanine seems to want a username field. Following is the error: FieldError at /admin/ Cannot resolve keyword 'username' into field. Choices are: blogposts, comment_comments, ...(all the fields) – Siddharth Kumar Nov 05 '14 at 11:07
  • This sounds like something I ran into too with the program (can't remember how I fixed it). I would try working with a clean database just to test it out. You may need to create a migration if you are working with existing posts, etc. When I have some extra time, I can try it out with mezzanine. – Zach Nov 05 '14 at 17:02
  • Delete or comment out this in settings.py `AUTHENTICATION_BACKENDS = ("mezzanine.core.auth_backends.MezzanineBackend",)` – Zach Nov 06 '14 at 23:16

0 Answers0