Ticket #3662: patch.txt

File patch.txt, 852 bytes (added by alex@…, 8 years ago)

proposed patch

Line 
1--- django/db/models/related.py (revision 4668)
2+++ django/db/models/related.py (working copy)
3@@ -68,10 +68,13 @@
4                 # object
5                 return [attr]
6         else:
7-            if self.field.rel.min_num_in_admin:
8-                return [None] * max(self.field.rel.num_in_admin, self.field.rel.min_num_in_admin)
9+            if self.field.rel.multiple:
10+                if self.field.rel.min_num_in_admin:
11+                    return [None] * max(self.field.rel.num_in_admin, self.field.rel.min_num_in_admin)
12+                else:
13+                    return [None] * self.field.rel.num_in_admin
14             else:
15-                return [None] * self.field.rel.num_in_admin
16+                return [None] * 1
17 
18     def get_db_prep_lookup(self, lookup_type, value):
19         # Defer to the actual field definition for db prep
Back to Top