Fetch referred model data using custom manager using proxy model

Hi All,
I tried to create custom manager to fetch data which is not present in the reference model from referenced model using proxy model. In this case, right join is to be used in order to get the data from reference model.
Note: I want to update one database only by providing meta proxy.

class User(models.Model):
       userid = models.PositiveIntegerField("userid", primary_key=True)

class College(models.Model):
      user = models.OneToOneField(

class DeptUserManager(models.Manager):
       def get_queryset(self, *args, **kwargs):
             return super().get_queryset(*args, **kwargs).**select_related("user")**

class DeptUser(College):
        objects = DeptUserManager()
         class Meta:

The bolded instruction (select_related) fetches the data which are common using “INNER JOIN”, how ever i require the data which are not available in the DeptUser model.
The possible solutions what i thought:

  1. anti-RIGHT JOIN
  2. in INNER JOIN instead of equal(=) operator, not equal (<>) is to be provided.
    Is there any way to provide above condition in custom manager using django orm? or is there any approach to solve this issue?

I’m sorry, I can’t figure out what you’re trying to ask here.

A proxy model only allows for alteration of behavior, not of the fields. This means that an instance of DeptUser is a College, but with (in your case) a different default manager.

The College class has one-to-one relationship with class User. I want to access the data of User instance from DeptUser (from child instance to parent instance) using Proxy of College class.

I am able to access it which are common (from DeptUser to User) by using select_related in DeptUserManager class. But, i want to access the data from User which are not available in the DeptUser ie anti-Right Join, in DeptUserManager

I’m still not following you. You can always query on User. If necessary, you can query for Users not-related to by a College.

I do want to clarify something - select-related is not how you gain access to related data. It’s a optimization / performance function for avoiding an n+1 condition. You never need to use it to access related data.

I am extremely sorry about this. and Thank you for clarification
I try to explain with example:
User table has the data: {1, 2, 3, 4, 5, 6, 7, 8}
College table has the data: {2, 3, 4}
I want to query User data to DeptUser which are not related to College table using Proxy inheritance with it’s custom manager(DeptUserManager).
expected data in DeptUser = {1, 5, 6, 7, 8}. Here, i require a help, to write a query in custom manager

I hope this example is helpful to explain the problem.

It makes no sense to try and do that. You’re not querying for DeptUser, you’re trying to retrieve Users.
DeptUser is a College, not a User. There’s nothing special about using a proxy - for all practical purposes it’s synonymous to College.