Opened 18 years ago
Closed 17 years ago
#3662 closed (duplicate)
OneToOne edit_inline - can not add new object in Django admin
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Contrib apps | Version: | dev |
Severity: | Keywords: | OneToOne, edit_inline | |
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
Consider following code snipped (I tried to make it very simple just to explain this bug):
from django.db import models from django.contrib.sites.models import Site # Create your models here. class Article(models.Model): title = models.CharField(maxlength=50) description = models.TextField() class Admin: pass class CustomArticle(models.Model): fti_contents_list = models.TextField(null=True, blank=True) layout = models.CharField(maxlength=1,core=True) sites = models.ManyToManyField(Site,core=True) article = models.OneToOneField(Article,edit_inline=True)
Here I use OneToOne field to extend standard Article application with custom data I need to use with particular
customer.
The problem:
When I add new product in /admin it fails with error:
File "/usr/lib/python2.4/site-packages/django/db/models/related.py", line 71,
in get_list
if self.field.rel.min_num_in_admin:
AttributeError: 'OneToOneRel' object has no attribute 'min_num_in_admin'
The solution: see attached patch
Attachments (2)
Change History (9)
by , 18 years ago
Attachment: | AttributeError at _admin_Article_article_add_.html added |
---|
comment:1 by , 18 years ago
Keywords: | edit_inline added |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Thanks for the patch, alex. We know that edit_inline has lots of problems (e.g. http://code.djangoproject.com/wiki/FeatureGrouping#edit_inlineIssues), but the new admin changes that will be coming after the 0.96 release should clear this up.
Because of this, I'm marking this as invalid for now, but I've placed it on the FeatureGrouping page, and we'll double check that it's no longer an issue once these changes have gone through.
comment:2 by , 18 years ago
Thanks Simon! I also listed another my bug on almost same combination but on Edit (3188) in this Wike page. Personally I think issues must stay open until they are either fixed or deprecated (as newadmin comes) but lets discuss this out of bug tracking system. I will post my suggestion on django-developers list.
comment:3 by , 18 years ago
I keep getting customer complaints about my software.
Installing my patch everywhere helps but its difficult to maintain this.
comment:4 by , 18 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Triage Stage: | Unreviewed → Ready for checkin |
Reopened, see discussion here
comment:5 by , 18 years ago
Has patch: | unset |
---|---|
Triage Stage: | Ready for checkin → Accepted |
This isn't ready for checkin. We aren't applying any patches to existing admin because it will soon be replaced. So we need to wait for the support work to go into newforms-admin and then write a patch against that.
comment:6 by , 17 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
This patch is necessary and works. Please commit. As long as newforms-admin is not stable,
support for (old) admin must be continued.
Complete Error .html