Opened 12 years ago
Closed 11 years ago
#19425 closed Bug (fixed)
Inline Admin does not allow extra to be a property
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.admin | Version: | 1.4 |
Severity: | Normal | Keywords: | inline dynamic extras |
Cc: | crodjer@…, areski@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
this line
if not isinstance( cls.extra, int ):
in
django.contrib.admin.validation
causes this to fail
class MyInline( admin.StackedInline ): @property def extra( self ): if condition: return 3 else: self.max_num = 0 return 0
and should be updated to this accordingly
if not isinstance( cls.extra, int ) and not isinstance( cls.extra, property ):
Attachments (1)
Change History (17)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Quickly compiled a patch for it, taking charettes' suggestion in consideration: https://github.com/django/django/pull/576
comment:3 by , 12 years ago
The pull request is looking quite good.
This would also need documentation and a 1.6 release note but before going forward with this I think we should wait for this feature to be accepted by a core developer.
comment:4 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:5 by , 12 years ago
Needs documentation: | set |
---|
comment:7 by , 12 years ago
Replying to anonymous:
Added documentation in the corresponding pull request.
This comment was by me.
comment:10 by , 12 years ago
I've checked the PR and seems good to me. Documentations is clear enough and complete.
Also I checked all tests are passing, so I think this is ready for checking.
comment:11 by , 12 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
I also checked the PR and it seems good to me as well.
comment:12 by , 12 years ago
Great patch, I tested it during the sprint djangocon eu and it worked for me.
when I rebase it I add a small conflict at the import django.core.exceptions. https://github.com/areski/django/commit/f97139866517d9fe2731f76e27d80bf7ea3aa93d#L0R16
by , 12 years ago
Attachment: | patch_ticket_19425_b.txt added |
---|
comment:14 by , 12 years ago
Cc: | added |
---|
Updated the pull request with the suggestions in discussion.
Re-referencing: https://github.com/django/django/pull/576
comment:15 by , 12 years ago
Cc: | added |
---|
comment:16 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Actually I think we should add a
get_extra
method instead.