Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot save static_placeholder #2992

Closed
johnraz opened this issue Mar 31, 2014 · 1 comment · Fixed by #2993
Closed

Cannot save static_placeholder #2992

johnraz opened this issue Mar 31, 2014 · 1 comment · Fixed by #2993
Labels
Milestone

Comments

@johnraz
Copy link
Contributor

johnraz commented Mar 31, 2014

On latest develop, django 1.6.2, one language installed, i18n disabled.

Through the admin, when I try to create a static placeholder I get the following:

Environment:


Request Method: POST
Request URL: http://educationsante.dev:8000/admin/cms/staticplaceholder/add/

Django Version: 1.6
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',
 'djangocms_admin_style',
 'django.contrib.admin',
 'south',
 'django_extensions',
 'djangocms_text_ckeditor',
 'cms',
 'mptt',
 'menus',
 'sekizai',
 'filer',
 'cmsplugin_filer_file',
 'reversion',
 'easy_thumbnails',
 'debug_toolbar')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.common.CommonMiddleware',
 'cms.middleware.page.CurrentPageMiddleware',
 'cms.middleware.user.CurrentUserMiddleware',
 'cms.middleware.toolbar.ToolbarMiddleware',
 'cms.middleware.language.LanguageCookieMiddleware',
 'debug_toolbar.middleware.DebugToolbarMiddleware')


Traceback:
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
  430.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  99.                     response = view_func(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  52.         response = view_func(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  198.             return view(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
  29.             return bound_func(*args, **kwargs)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  99.                     response = view_func(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
  25.                 return func(self, *args2, **kwargs2)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/transaction.py" in inner
  339.                 return func(*args, **kwargs)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in add_view
  1129.                 self.save_model(request, new_object, form, False)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in save_model
  858.         obj.save()
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/models/base.py" in save
  545.                        force_update=force_update, update_fields=update_fields)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/models/base.py" in save_base
  573.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/models/base.py" in _save_table
  654.             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/models/base.py" in _do_insert
  687.                                using=using, raw=raw)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/models/manager.py" in _insert
  232.         return insert_query(self.model, objs, fields, **kwargs)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/models/query.py" in insert_query
  1511.     return query.get_compiler(using=using).execute_sql(return_id)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  898.             cursor.execute(sql, params)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  69.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  99.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/vagrant/.virtualenvs/education_sante/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)

Exception Type: IntegrityError at /admin/cms/staticplaceholder/add/
Exception Value: null value in column "site_id" violates not-null constraint

I'm not yet very used to the way static_placeholder works, but looking at the code it seems that only the template tag is creating it with a site assigned.

Should I override the Model save method to always put the current site_id ? Use a signal ? Whats the recommended way ?

@digi604 digi604 added this to the 3.0 milestone Apr 1, 2014
@digi604 digi604 added the blocker label Apr 1, 2014
digi604 added a commit to digi604/django-cms that referenced this issue Apr 1, 2014
@projectdump
Copy link

same here with django 1.5.5

it says:

IntegrityError at /en/admin/cms/staticplaceholder/add/
null value in column "site_id" violates not-null constraint

digi604 added a commit that referenced this issue Apr 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants