1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #13241. order_with_respect_to now works with ForeignKeys who refer to their model lazily (i.e. with a string). Thanks to Gabriel Grant for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14045 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor
2010-10-08 23:54:43 +00:00
parent 5c5f1cfe70
commit ccc43508e3
4 changed files with 42 additions and 4 deletions

View File

@@ -17,3 +17,13 @@ class Answer(models.Model):
def __unicode__(self):
return unicode(self.text)
class Post(models.Model):
title = models.CharField(max_length=200)
parent = models.ForeignKey("self", related_name="children", null=True)
class Meta:
order_with_respect_to = "parent"
def __unicode__(self):
return self.title