Opened 17 years ago
Closed 17 years ago
#4491 closed (fixed)
[newforms-admin] addAnother link does not work
Reported by: | Owned by: | jkocherhans | |
---|---|---|---|
Component: | contrib.admin | Version: | newforms-admin |
Severity: | Keywords: | newforms admin addAnother | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Admin cannot recognize models registered with current site in django.contrib.admin.widgets.RelatedFieldWidgetWrapper
The attached patch propagates the site object to the options object so that it will have access to it. It is then passed to RelatedFieldWidgetWrapper
so that it can check if a model has admin enabled and decide whether or not to include addAnother()
link.
Attachments (3)
Change History (8)
by , 17 years ago
Attachment: | newforms-admin-5427-site_to_admin_opts.diff added |
---|
comment:1 by , 17 years ago
Version: | other branch → newforms-admin |
---|
by , 17 years ago
Attachment: | newforms-admin-5519-site_to_admin_opts.diff added |
---|
new version for current version
comment:2 by , 17 years ago
I added a new version of the patch. The problem is that with current state of things, it won't work - it will break on edit_inline functionality - we would have to either force people to pass site object to the InlineModelAdmin manually (yuck), postpone the creation of InlineModelAdmin until inside the ModelAdmin or abandon this approach completely.
by , 17 years ago
Attachment: | site-aware-modeladmin.diff added |
---|
This breaks the way StackedInline and TabularInline work, but makes them more like ModelAdmin. Still thinking about this...
comment:3 by , 17 years ago
Owner: | changed from | to
---|---|
Patch needs improvement: | set |
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
Thanks for the ideas Honza Král. It makes perfect sense for both of those classes to know about which AdminSite
object they are attached to. I think the newest patch I posted is pretty close, but don't like having to create a class for every single inline. Turning StackedInline
and TabulatInline
into factory functions would work, but then you have to do some trickery to hang custom methods on those classes and it just feels wrong. I'll think about this some more and maybe get some input at the sprint next week.
comment:4 by , 17 years ago
we are depending heavily upon the newforms-admin branch, so I hope to be present at the sprint. I will be happy to help.
comment:5 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
propagate site to admin_class