Opened 8 years ago

Closed 8 years ago

#6365 closed (fixed)

parent needs blank=True on "Relating an object to itself, many-to-one"

Reported by: dgrant Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: UI/UX:


On this many-to-one self relation example parent needs to have blank=True or else forms won't validate in admin when trying to create a root-level category.

from django.db import models

class Category(models.Model):
    name = models.CharField(max_length=20)
    parent = models.ForeignKey('self', null=True, blank=True, related_name='child_set')

    def __unicode__(self):

Change History (1)

comment:1 Changed 8 years ago by gwilson

  • Resolution set to fixed
  • Status changed from new to closed

(In [7015]) Fixed #6365 -- Added blank=True to parent attribute of m2o_recursive model example, thanks dgrant.

Note: See TracTickets for help on using tickets.
Back to Top