Opened 12 years ago
Closed 12 years ago
#21846 closed Bug (fixed)
Admin's NestedObjects doesn't support related_name with %(app_label)s or %(class)s.
| Reported by: | loic84 | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Traceback (most recent call last):
File "/Users/loic/Dev/django/tests/admin_util/tests.py", line 90, in test_relation_on_abstract
n.collect([Contributor.objects.first()])
File "/Users/loic/Dev/django/django/contrib/admin/utils.py", line 176, in collect
return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs)
File "/Users/loic/Dev/django/django/db/models/deletion.py", line 199, in collect
field.rel.on_delete(self, field, sub_objs, self.using)
File "/Users/loic/Dev/django/django/db/models/deletion.py", line 17, in CASCADE
source_attr=field.name, nullable=field.null)
File "/Users/loic/Dev/django/django/contrib/admin/utils.py", line 176, in collect
return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs)
File "/Users/loic/Dev/django/django/db/models/deletion.py", line 187, in collect
reverse_dependency=True)
File "/Users/loic/Dev/django/django/contrib/admin/utils.py", line 171, in collect
self.add_edge(getattr(obj, related_name), obj)
AttributeError: 'Contributor' object has no attribute 'contributor_%(app_label)s_%(class)s'
Change History (3)
comment:1 by , 12 years ago
| Has patch: | set |
|---|
comment:2 by , 12 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
I can confirm this solves the problem I was having.
comment:3 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Fixed in c3fdeb28fff35573bf86ef04b234c7f5817b0dea.
Note:
See TracTickets
for help on using tickets.
PR https://github.com/django/django/pull/2193