Opened 9 years ago

Closed 9 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: master
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: UI/UX:


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:
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

The problem:

When I add new product in /admin it fails with error:

File "/usr/lib/python2.4/site-packages/django/db/models/", 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@… 9 years ago.
Complete Error .html
patch.txt (852 bytes) - added by alex@… 9 years ago.
proposed patch

Download all attachments as: .zip

Change History (9)

Changed 9 years ago by alex@…

Complete Error .html

Changed 9 years ago by alex@…

proposed patch

comment:1 Changed 9 years ago by Simon G. <dev@…>

  • Keywords edit_inline added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Thanks for the patch, alex. We know that edit_inline has lots of problems (e.g., 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 Changed 9 years ago by anonymous

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 Changed 9 years ago by anonymous

I keep getting customer complaints about my software.
Installing my patch everywhere helps but its difficult to maintain this.

comment:4 Changed 9 years ago by Simon G. <dev@…>

  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Triage Stage changed from Unreviewed to Ready for checkin

Reopened, see discussion here

comment:5 Changed 9 years ago by mtredinnick

  • Has patch unset
  • Triage Stage changed from Ready for checkin to 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 Changed 9 years ago by Thomas Güttler <hv@…>

  • Has patch set
  • Triage Stage changed from Accepted to 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.

comment:7 Changed 9 years ago by ubernostrum

  • Resolution set to duplicate
  • Status changed from reopened to closed

Duplicate of #24.

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