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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:56:49+00:00 2026-06-03T09:56:49+00:00

I have a django auth user proxy model that has some extra permissions attached

  • 0

I have a django auth user proxy model that has some extra permissions attached to it like so:

class User(User):
    class Meta:
        proxy = True
        permissions = (
            ("write_messages","May add new messages to front page"),
            ("view_maps","Can view the maps section"),
        )

Elsewhere in the model I have an object that has User as a foreign key:

class Project(models.Model):
    creation_date   = models.DateTimeField(auto_now_add=True)
    modify_date     = models.DateTimeField(auto_now=True)
    owner           = models.ForeignKey(User)

In one of my views I attempt to create a new project using the current user as the owner

@login_required
def new_project(request):
    project = Project.objects.create(owner=request.user)

This, however, returns the error:

Cannot assign "<User: mwetter>": "Project.owner" must be a "User" instance.

I’m assuming that the foreign key owner in the project object is referring to the base class for Django User instead of my proxy class. Is there a way to refer to my proxy user as a foreign key instead?

  • 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-06-03T09:56:51+00:00Added an answer on June 3, 2026 at 9:56 am

    Why are you calling your proxy class User, which is guaranteed to lead to confusion between that and django.contrib.auth.models.User? Why not UserProxy, or MyUser? Then it could be distinguished whenever you use it.

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

Sidebar

Related Questions

Say I have a model that looks like: class Action(models.Model): user = models.ForeignKey('auth.User') action
I have a meta class for the Django User model that I use to
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
I have following setup. from django.db import models from django.contrib.auth.models import User class Event(models.Model):
I have created a model which has foreign key to the django.contrib.auth.models User model.
I have a form like so: from django import forms from django.contrib.auth.models import User
I have a django server that serves the basic site with user, auth etc
I'm newcomer in django, and here is question: I have model class: def Client(models.User)
I have a django application, using the basic userprofile extension of django.contrib.auth.user model. I
I have an issue with the django.contrib.auth User model where the email max_length 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.