views:

28

answers:

1

Hello! I have two models in my Django 1.1.1 application:

class UserRequest(models.Model):
   # blah blah

class JournalistRequest(UserRequest):
    # blah blah

So, JournalistRequest is a special type of UserRequest, and all JournalistRequests are still common UserRequests with special fields.

JournalistRequest.objects.all() returns all JournalistRequests. UserRequest.objects.all() returns all UserRequests, both Journalists and not. How to select all UserRequests which are not JournalistRequests?

+2  A: 

Assuming you are using multi-table inheritance, the following should work:

UserRequest.objects.filter(journalistrequest=None)
Daniel Roseman
thank you very much!
valya