Opened 18 years ago

Closed 17 years ago

#3662 closed (duplicate)

OneToOne edit_inline - can not add new object in Django admin

Reported by: alex@… 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)

AttributeError at _admin_Article_article_add_.html (78.2 KB ) - added by alex@… 18 years ago.
Complete Error .html
patch.txt (852 bytes ) - added by alex@… 18 years ago.
proposed patch

Download all attachments as: .zip

Change History (9)

by alex@…, 18 years ago

Complete Error .html

by alex@…, 18 years ago

Attachment: patch.txt added

proposed patch

comment:1 by Simon G. <dev@…>, 18 years ago

Keywords: edit_inline added
Resolution: invalid
Status: newclosed

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 anonymous, 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 anonymous, 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 Simon G. <dev@…>, 18 years ago

Resolution: invalid
Status: closedreopened
Triage Stage: UnreviewedReady for checkin

Reopened, see discussion here

comment:5 by Malcolm Tredinnick, 18 years ago

Has patch: unset
Triage Stage: Ready for checkinAccepted

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 Thomas Güttler <hv@…>, 17 years ago

Has patch: set
Triage Stage: AcceptedReady 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.

comment:7 by James Bennett, 17 years ago

Resolution: duplicate
Status: reopenedclosed

Duplicate of #24.

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