Fixed behaviour of admin interface (and AddManipulator) when

min/max_num_in_admin is specified without num_in_admin. A consequence of
changes in [4500].


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4542 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-02-19 04:18:46 +00:00
parent fb509ee8d3
commit babc0793e3
1 changed files with 4 additions and 4 deletions

View File

@ -104,12 +104,12 @@ class RelatedObject(object):
attr = getattr(manipulator.original_object, self.get_accessor_name()) attr = getattr(manipulator.original_object, self.get_accessor_name())
count = attr.count() count = attr.count()
count += self.field.rel.num_extra_on_change count += self.field.rel.num_extra_on_change
else:
count = self.field.rel.num_in_admin
if self.field.rel.min_num_in_admin: if self.field.rel.min_num_in_admin:
count = max(count, self.field.rel.min_num_in_admin) count = max(count, self.field.rel.min_num_in_admin)
if self.field.rel.max_num_in_admin: if self.field.rel.max_num_in_admin:
count = min(count, self.field.rel.max_num_in_admin) count = min(count, self.field.rel.max_num_in_admin)
else:
count = self.field.rel.num_in_admin
else: else:
count = 1 count = 1