1. Gustavo Picon
  2. django-treebeard
Issue #10 invalid

Object won't save in contrib.admin (Django Version: 1.2 alpha 1)

Mikhail Lukyanchenko
created an issue

models.py: {{{

!python

from django.db import models from treebeard import mp_tree

class Page(mp_tree.MP_Node): title = models.CharField(max_length=200) }}}

admin.py: {{{

!python

from django.contrib import admin from pages import models from treebeard.admin import TreeAdmin

admin.site.register(models.Page, TreeAdmin) }}}

Whenever I try to create new object via contrib.admin, I get following exception:

{{{ Environment:

Request Method: POST Request URL: http://localhost:8000/admin/pages/page/add/ Django Version: 1.2 alpha 1 Python Version: 2.5.4 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'treebeard', 'pages'] Installed Middleware: ('django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.transaction.TransactionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware', 'django.middleware.http.ConditionalGetMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware')

Traceback: File ".../lib/python2.5/site-packages/django/core/handlers/base.py" in get_response 99. response = callback(request, callback_args, callback_kwargs) File ".../lib/python2.5/site-packages/django/contrib/admin/options.py" in wrapper 237. return self.admin_site.admin_view(view)(*args, kwargs) File ".../lib/python2.5/site-packages/django/utils/decorators.py" in call 36. return self.decorator(self.func)(args, kwargs) File ".../lib/python2.5/site-packages/django/utils/decorators.py" in _wrapped_view 86. response = view_func(request, *args, kwargs) File ".../lib/python2.5/site-packages/django/utils/decorators.py" in call 36. return self.decorator(self.func)(args, kwargs) File ".../lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 70. response = view_func(request, *args, kwargs) File ".../lib/python2.5/site-packages/django/contrib/admin/sites.py" in inner 187. return view(request, args, kwargs) File ".../lib/python2.5/site-packages/django/utils/decorators.py" in _wrapped_view 86. response = view_func(request, *args, kwargs) File ".../lib/python2.5/site-packages/django/db/transaction.py" in _commit_on_success 295. res = func(args, *kw) File ".../lib/python2.5/site-packages/django/contrib/admin/options.py" in add_view 760. if form.is_valid(): File ".../lib/python2.5/site-packages/django/forms/forms.py" in is_valid 120. return self.is_bound and not bool(self.errors) File ".../lib/python2.5/site-packages/django/forms/forms.py" in _get_errors 111. self.full_clean() File ".../lib/python2.5/site-packages/django/forms/forms.py" in full_clean 286. self.cleaned_data = self.clean() File ".../lib/python2.5/site-packages/django/forms/models.py" in clean 270. raise UnresolvableValidationError(e.message_dict)

Exception Type: UnresolvableValidationError at /admin/pages/page/add/ Exception Value: {'path': [u'This field cannot be blank.'], 'depth': [u'This field cannot be null.']}

}}}

Comments (2)

  1. Mikhail Korobov

    There are bugs in django 1.2 alpha1's introduced model validation. A part of them was fixed in django trunk. Can you please check if the problem exists with latest django SVN checkout?

  2. Log in to comment