Opened 7 years ago

Closed 7 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: master
Severity: Keywords: ManyToManyField, admin
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


This URL returns traceback:


Request Method: GET
Request URL:
Django Version: 1.0-alpha-SVN-8199
Python Version: 2.5.2
Installed Applications:
Installed Middleware:

File "/opt/local/lib/python2.5/site-packages/django/core/handlers/" in get_response
  87.                 response = callback(request, *callback_args, **callback_kwargs)
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/" in root
  156.                 return self.model_page(request, *url.split('/', 2))
File "/opt/local/lib/python2.5/site-packages/django/views/decorators/" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/" in model_page
  173.         return admin_obj(request, rest_of_url)
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/" in __call__
  259.             return self.add_view(request)
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/" in add_view
  504.             for FormSet in self.get_formsets(request):
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/" in get_formsets
  340.             yield inline.get_formset(request, obj)
File "/opt/local/lib/python2.5/site-packages/django/contrib/admin/" in get_formset
  743.             extra=self.extra, max_num=self.max_num)
File "/opt/local/lib/python2.5/site-packages/django/forms/" 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/" 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 ''> has more than 1 ForeignKey to <class ''>

Please, see the testcase to reproduce this bug.

Change History (1)

comment:1 Changed 7 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

closing as a dupe of #8097

Note: See TracTickets for help on using tickets.
Back to Top