Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6124055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:05:19+00:00 2026-05-23T16:05:19+00:00

I have a Django application which allows different kinds of users: firms, administrators, external

  • 0

I have a Django application which allows different kinds of users: firms, administrators, external people etc. Of course all of this is easy to manage with the default authentication system and groups.

My problem is that users belonging to different groups will have different related information – for instance firms will need to provide some commercial information that does not make sense for private users. Hence I need to attach different kind of profiles, depending on the group. (In my application groups are mutually exclusive.)

Unfortunately, Django only allows a single model to be attached as a profile, and that model is declared in settings.AUTH_PROFILE_MODULE. Internally, that is retrieved by the User.get_profile() method, which basically just reads this value and performs some checks, for instance that the model actually exists.

I was thinking of subclassing User and overriding the get_profile() method, so that it returns a different model depending on the group.

Is there a simpler/cleaner way to manage different kind of profiles?

What I am proposing seems a little hack, considering that user profiles were introduced exactly to avoid having to subclass User.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:05:20+00:00Added an answer on May 23, 2026 at 4:05 pm

    Create a model with OneToOneField to User and related_name.

    E. g.:

    class Firm(models.Model):
        user = models.OneToOneField(User, related_name='firm')
        # other fields
    
    class External(models.Model):
        user = models.OneToOneField(User, related_name='external')
        # other fields
    

    Then you can check the existance of this attributes in user (if hasattr(request.user, 'firm')) and return proper instance. I’d put it in custom middleware, which would set request.user_profile for example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to deplay a django application/project, which i have created within Aptana.
I have a Django application which sometimes needs to send some data through TCP
I want to have RSS feeds in my Django application, which should be viewable
I have a Django application in which I need to implement a simple trending/ranking
I have a a django application which is being served from apache/mod_wsgi under www.mysite.com/mysite
I have a django application which uses a library.py file : library.py a=5 View
I have a Django application which includes a custom model field (and accompanying form
I have a django application which has one main table/model which references various 'lookup'
I have a Django application, myApp. In it, there's a tests.py file which defines
I've deployed a django-application, which basically works fine. The only problem I have is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.