mbi / django-simple-captcha

Django Simple Captcha is an extremely simple, yet highly customizable Django application to add captcha images to any Django form.
http://django-simple-captcha.readthedocs.io/en/latest/
MIT License
1.38k stars 322 forks source link

Migration doesn't work #152

Closed jurecuhalev closed 5 years ago

jurecuhalev commented 6 years ago

Full error below, but essentially:

django.db.utils.IntegrityError: null value in column "name" violates not-null constraint
DETAIL:  Failing row contains (79, null, captcha, captchastore).

Using Django==1.11.14 and python 2.7.13 with Postrgesql

(ocwc-members) ➜  members git:(master) ./manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, captcha, conferences, contenttypes, crm, elections, sessions, sites
Running migrations:
  Applying captcha.0001_initial... OK
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 227, in handle
    self.verbosity, self.interactive, connection.alias, apps=post_migrate_apps, plan=plan,
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/core/management/sql.py", line 53, in emit_post_migrate_signal
    **kwargs
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 193, in send
    for receiver in self._live_receivers(sender)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 63, in create_permissions
    ctype = ContentType.objects.db_manager(using).get_for_model(klass)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 60, in get_for_model
    model=opts.model_name,
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/query.py", line 466, in get_or_create
    return self._create_object_from_params(lookup, params)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/query.py", line 506, in _create_object_from_params
    six.reraise(*exc_info)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/query.py", line 498, in _create_object_from_params
    obj = self.create(**params)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/query.py", line 394, in create
    obj.save(force_insert=True, using=self.db)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/base.py", line 808, in save
    force_update=force_update, update_fields=update_fields)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/base.py", line 838, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/base.py", line 924, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/base.py", line 963, in _do_insert
    using=using, raw=raw)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/query.py", line 1076, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1112, in execute_sql
    cursor.execute(sql, params)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/Users/gandalf/.virtualenvs/ocwc-members/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: null value in column "name" violates not-null constraint
DETAIL:  Failing row contains (79, null, captcha, captchastore).
mbi commented 5 years ago

This has nothing to do with Django Simple Captcha (it's trying to migrate the Content Types app). See https://stackoverflow.com/questions/31323618/django-1-8-migrations-contenttype-integrity-error