mirror of
https://github.com/django/django.git
synced 2025-10-02 23:04:53 +00:00
Allow for matches against unsaved objects in querysets (which will therefore
match nothing). This allows for some more straightforward code in the admin interface. Fixed #7488 (all the debugging there was done by Brian Rosner, who narrowed it down to the item in this patch). git-svn-id: http://code.djangoproject.com/svn/django/trunk@8061 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3912403550
commit
a7b556ca04
2 changed files with 40 additions and 9 deletions
|
@ -43,12 +43,17 @@ class ParkingLot(Place):
|
|||
def __unicode__(self):
|
||||
return u"%s the parking lot" % self.name
|
||||
|
||||
class Supplier(models.Model):
|
||||
restaurant = models.ForeignKey(Restaurant)
|
||||
|
||||
class Parent(models.Model):
|
||||
created = models.DateTimeField(default=datetime.datetime.now)
|
||||
|
||||
class Child(Parent):
|
||||
name = models.CharField(max_length=10)
|
||||
|
||||
|
||||
|
||||
__test__ = {'API_TESTS':"""
|
||||
# Regression for #7350, #7202
|
||||
# Check that when you create a Parent object with a specific reference to an
|
||||
|
@ -172,4 +177,9 @@ True
|
|||
>>> r.id == r.place_ptr_id
|
||||
True
|
||||
|
||||
# Regression test for #7488. This looks a little crazy, but it's the equivalent
|
||||
# of what the admin interface has to do for the edit-inline case.
|
||||
>>> Supplier.objects.filter(restaurant=Restaurant(name='xx', address='yy'))
|
||||
[]
|
||||
|
||||
"""}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue