Ticket #1839: m2o_recursive.diff

File m2o_recursive.diff, 837 bytes (added by mir@…, 19 years ago)

... or as a patch to existing m2o_recursive test, if you prefer

  • tests/modeltests/m2o_recursive/models.py

    a b class Category(models.Model):  
    1919    def __repr__(self):
    2020        return self.name
    2121
     22class Another(models.Model):
     23    name = models.CharField(maxlength=20, core=True)
     24    another = models.ForeignKey('self', null=True, related_name='child_set')
     25
     26    def __repr__(self):
     27        return self.name
     28
    2229API_TESTS = """
    2330# Create a few Category objects.
    2431>>> r = Category(id=None, name='Root category', parent=None)
    None  
    3744[]
    3845>>> c.parent
    3946Root category
     47
     48>>> Category.AddManipulator().save(dict(id='3', name='Another root category', parent=None))
     49Another root category
     50
     51>>> anotherone = Another.AddManipulator().save(dict(id='3', name='Another root category', another=None))
     52Another root category
    4053"""
Back to Top