#2243 closed defect (fixed)
[patch] admin tries to set M2M inside a reverse foreign key
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | critical | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
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 "/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py" in get_response 74. response = callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py" in _checklogin 54. return view_func(request, *args, **kwargs) File "/usr/local/lib/python2.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 40. response = view_func(request, *args, **kwargs) File "/usr/local/lib/python2.4/site-packages/django/contrib/admin/views/main.py" in add_stage 257. new_object = manipulator.save(new_data) File "/usr/local/lib/python2.4/site-packages/django/db/models/manipulators.py" in save 218. was_changed = getattr(new_rel_obj, 'set_%s' % f.name)(rel_new_data[f.attname]) AttributeError at /sd/admin/vuln_crud/vulnerability/add/ 'Requirement' object has no attribute 'set_res'
from django.db import models class Resource(models.Model): name = models.CharField(maxlength=200) class Admin: pass class Plan(models.Model): name = models.CharField(maxlength=200) class Admin: pass class Requirement(models.Model): plan=models.ForeignKey(Plan,edit_inline=models.TABULAR) res = models.ManyToManyField(Resource) name = models.CharField(maxlength=200,core=True)
Attachments (2)
Change History (8)
comment:1 by , 18 years ago
priority: | normal → high |
---|
by , 18 years ago
Attachment: | django_2243.patch added |
---|
Fixes 2243; modifies raw_id_admin fields to behave more like common ones; shoos some minor bug
by , 18 years ago
Attachment: | django_2243b.patch added |
---|
Updated version of patch, now everything works correctly
comment:2 by , 18 years ago
Summary: | admin tries to set M2M inside a reverse foreign key → [patch] admin tries to set M2M inside a reverse foreign key |
---|
provided a patch
comment:3 by , 18 years ago
I applied this patch, and it seems to be working well. It definetly solved the M2M problem in the admin.
comment:4 by , 18 years ago
I also applied this patch and it fixed the problem I was having with edit_inline and M2M. Thanks!
comment:5 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:6 by , 18 years ago
Note:
See TracTickets
for help on using tickets.
I should say this happens when I attempt to add a new plan through the admin interface.