Filtering Django Admin by Null/Is Not Null

后端 未结 7 1429
太阳男子
太阳男子 2020-12-16 15:03

I have a simple Django model like:

class Person(models.Model):
    referrer = models.ForeignKey(\'self\', null=True)
    ...

In this model\

7条回答
  •  太阳男子
    2020-12-16 15:40

    There has been a ticket bouncing around for this for 4 years (https://code.djangoproject.com/ticket/5833). It missed the 1.3 milestone, but has reached new feature status and presumably has found it's way into trunk. If you don't mind running off of trunk, you can use it now. The patch is supposedly 1.3 compatible, though, so you can probably get by with just patching your currently installation.

提交回复
热议问题