Opened 17 years ago
Closed 17 years ago
#8096 closed (duplicate)
Many-to-many self-referential intermediates in admin: <Friendship> has more than 1 ForeignKey to <Person>
| Reported by: | Boo | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev |
| Severity: | Keywords: | ManyToManyField, admin | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
This URL http://127.0.0.1:8000/admin/foo/person/add/ returns traceback:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/foo/person/add/
Django Version: 1.0-alpha-SVN-8199
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'testcase.foo']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware')
Traceback:
File "/opt/local/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
87. response = callback(request, *callback_args, **callback_kwargs)
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/sites.py" in root
156. return self.model_page(request, *url.split('/', 2))
File "/opt/local/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/sites.py" in model_page
173. return admin_obj(request, rest_of_url)
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/options.py" in __call__
259. return self.add_view(request)
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/options.py" in add_view
504. for FormSet in self.get_formsets(request):
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/options.py" in get_formsets
340. yield inline.get_formset(request, obj)
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/options.py" in get_formset
743. extra=self.extra, max_num=self.max_num)
File "/opt/local/lib/python2.5/site-packages/django/forms/models.py" in inlineformset_factory
479. fk = _get_foreign_key(parent_model, model, fk_name=fk_name)
File "/opt/local/lib/python2.5/site-packages/django/forms/models.py" in _get_foreign_key
464. raise Exception("%s has more than 1 ForeignKey to %s" % (model, parent_model))
Exception Type: Exception at /admin/foo/person/add/
Exception Value: <class 'testcase.foo.models.Friendship'> has more than 1 ForeignKey to <class 'testcase.foo.models.Person'>
Please, see the testcase to reproduce this bug.
Note:
See TracTickets
for help on using tickets.
closing as a dupe of #8097