Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#13556 closed (worksforme)

admin.exclude thinks that a m2m field that is missing from a modelform.

Reported by: Chris Beaven Owned by: nobody
Component: contrib.admin Version: 1.1
Severity: Keywords: 1.1.2 regression
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This is a rather serious 1.1.2 regression. 1.1.1 worked (and still works) fine.

Trying to start the server raises:

File "[projroot]/src/[proj]/apps/accounts/admin.py" in <module>
  84. admin.site.register(models.UserProfile, UserProfile)
File "[projroot]/src/django/django/contrib/admin/sites.py" in register
  90.             validate(admin_class, model)
File "[projroot]/src/django/django/contrib/admin/validation.py" in validate
  25.     validate_base(cls, model)
File "[projroot]/src/django/django/contrib/admin/validation.py" in validate_base
  227.             check_formfield(cls, model, opts, 'exclude', field)
File "[projroot]/src/django/django/contrib/admin/validation.py" in check_formfield
  310.                 "is missing from the form." % (cls.__name__, label, field))
  
Exception Type: ImproperlyConfigured at /
Exception Value: 'UserProfile.exclude' refers to field 'tracked_tickers' that is missing from the form.

tracked_tickers is a basic m2m field on the UserProfile model.

Change History (3)

comment:1 by Karen Tracey, 14 years ago

Resolution: worksforme
Status: newclosed

I can't recreate this -- listing a ManyToManyField in exclude for a ModelAdmin works fine in my testing. So there has to be more to it than what's been posted but there is not enough detail here for me to have any clue what it might be.

comment:2 by Gabriel Hurley, 14 years ago

It may or may not be the case here, but I saw that type of error when I first started testing 1.2 and had models configured where I'd set editable = False on the field in the model definition and later tried to exclude that field elsewhere. In my case it was Django no longer swallowing an error that should have been raised before.

comment:3 by Chris Beaven, 14 years ago

Works for me now too.

Seems that it was some stale *.pyc files left over from switching branches in-place causing problems. Deleting all the pyc files solved the problem (an existing test in admin_validation was failing too, so no new test was required).

Sorry for the noise, nothing to see here, carry on folks... :D

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