Saturday, September 29, 2012

EntryAdmin.form does not inherit from BaseModelForm.

Hello,

I'm having a strange issue where I get the following exception on my production server, but have no issues on my dev machine:

Django Version:1.3.1
Exception Type:ImproperlyConfigured
Exception Value:
EntryAdmin.form does not inherit from BaseModelForm.
Exception Location:/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py in validate_base, line 292
Python Executable:/usr/local/bin/python
Python Version:2.7.3

I have narrowed the problem down to this area of the code:

class EntryAdminForm(forms.ModelForm):
class Meta:
model = Entry

latitude = CoordinateField()
longitude = CoordinateField()

class EntryAdmin(admin.ModelAdmin):
form = EntryAdminForm      ## COMMENT OUT THIS LINE MAKES THE PRODUCTION SERVER WORK ##
list_display = ('title', 'location', 'pub_date', 'type', 'blogger')
list_filter = ('blogger', 'pub_date', 'type')

I have hit a wall with this one and could use some inspiration. 
As mentioned above commenting out form = EntryAdminForm in EntryAdmin makes everything work fine

Below is more details on the error:
Environment:


Request Method: GET
Request URL: http://URL/admin/sail_blog/entry/120/

Django Version: 1.3.1
Python Version: 2.7.3
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'sail_blog',
 'blog_redirect']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/home/cjfox/webapps/django_1_3_1/starship/django/core/handlers/base.py" in get_response
  101.                             request.path_info)
File "/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in resolve
  250.             for pattern in self.url_patterns:
File "/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in _get_url_patterns
  279.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in _get_urlconf_module
  274.             self._urlconf_module = import_module(self.urlconf_name)
File "/home/cjfox/webapps/django_1_3_1/starship/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/home/cjfox/webapps/django_1_3_1/starship/urls.py" in <module>
  5. admin.autodiscover()
File "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/__init__.py" in autodiscover
  26.             import_module('%s.admin' % app)
File "/home/cjfox/webapps/django_1_3_1/starship/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/home/cjfox/webapps/django_1_3_1/starship/sail_blog/admin.py" in <module>
  45. admin.site.register(Entry, EntryAdmin)
File "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/sites.py" in register
  97.             validate(admin_class, model)
File "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py" in validate
  24.     validate_base(cls, model)
File "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py" in validate_base
  292.                 "BaseModelForm." % cls.__name__)

Exception Type: ImproperlyConfigured at /admin/sail_blog/entry/120/
Exception Value: EntryAdmin.form does not inherit from BaseModelForm.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/GYzuwIcFQZsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment