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 169015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:33:20+00:00 2026-05-11T12:33:20+00:00

In my application I have students, professors and staff. Staff members do not need

  • 0

In my application I have students, professors and staff. Staff members do not need a profile but professors and students each need a different profile. I’d rather not implement it all myself (middleware and whatnot), so is there anyway to just have get_profile() return a different profile depending on a user’s role?

  • 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. 2026-05-11T12:33:21+00:00Added an answer on May 11, 2026 at 12:33 pm

    With Django 1.1, which is currently in beta, I would implement a proxy model.

    class MyUser(User):    class Meta:     proxy = True    def get_profile(self):     if self.role == 'professor':       return ProfessorProfile._default_manager.get(user_id__exakt=self.id)     elif self.role == 'student':       return StudentProfile._default_manager.get(user_id__exakt=self.id)     else:       # staff       return None 

    get_profile needs the caching code from the original and so on. But essentially you could do something like that.

    With Django 1.0.x you could implement derived classes based on User, but this might break code in other places. For stuff like that I love proxy classes, which just add python functionality without changing the database models.

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

Sidebar

Related Questions

I trying to write an application that has a collection of students using different
I'm working on an application which has different types of users i.e. students, tutors,
I have created a project called class , and an application called students when
In my asp.net application I have two pages like new students and edit students.
I have an asp.net web forms application. In this application, students upload assignments and
In my WPF4 desktop application all windows have the same structure — header &
I have a web application that assigns time duration to students in a day.
I have the following (hypothetical) scenario: Application to report on students in classes in
I have a sample ASP.NET application that I will use in classroom setting. Each
Hi there I am desktop application developer but now i have to work on

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.