mozilla / django-badger

django-badger is a reusable Django app for creating and awarding badges. See also badges.mozilla.org
https://github.com/mozilla/django-badger
BSD 3-Clause "New" or "Revised" License
117 stars 61 forks source link

Error when trying to add new badge #128

Closed alexlittle closed 11 years ago

alexlittle commented 11 years ago

I just installed django-badger and I tried to create a new badge (in the django admin page). When I submit the form to add the new badge, I get the error message: DatabaseError at /admin/badger/badge/add/ (1146, "Table 'python.badger_badge_prerequisites' doesn't exist")

In my database I see 4 badger_* tables (award, badge, deferredaward and progress) and the only reference in the code I can find to the prerequisites table is in the migrations/0001_initial.py script.

Have I done something wrong in the installation? (I'm quite new to python/django), Any help much appreciated, Alex

For info the full traceback is:

Environment:

Request Method: POST Request URL: https://localhost/python/admin/badger/badge/add/

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', 'django.contrib.admindocs', 'maps', 'polls', 'maths', 'badger'] 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 "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response

  1. response = callback(request, _callback_args, *_callback_kwargs) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/options.py" in wrapper
  2. return self.admin_site.admin_view(view)(_args, *_kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view
  3. response = view_func(request, _args, *_kwargs) File "/usr/lib/python2.7/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func
  4. response = view_func(request, _args, *_kwargs) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/sites.py" in inner
  5. return view(request, _args, *_kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapper
  6. return bound_func(_args, *_kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view
  7. response = view_func(request, _args, *_kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in bound_func
  8. return func(self, _args2, *_kwargs2) File "/usr/lib/python2.7/dist-packages/django/db/transaction.py" in inner
  9. res = func(_args, *_kwargs) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/options.py" in add_view
  10. form.save_m2m() File "/usr/lib/python2.7/dist-packages/django/forms/models.py" in save_m2m
  11. f.save_form_data(instance, cleaned_data[f.name]) File "/usr/lib/python2.7/dist-packages/django/db/models/fields/related.py" in save_form_data
  12. setattr(instance, self.attname, data) File "/usr/lib/python2.7/dist-packages/django/db/models/fields/related.py" in set
  13. manager.clear() File "/usr/lib/python2.7/dist-packages/django/db/models/fields/related.py" in clear
  14. self._clear_items(self.source_field_name) File "/usr/lib/python2.7/dist-packages/django/db/models/fields/related.py" in _clear_items
  15. source_field_name: self._pk_val File "/usr/lib/python2.7/dist-packages/django/db/models/query.py" in delete
  16. collector.collect(del_query) File "/usr/lib/python2.7/dist-packages/django/db/models/deletion.py" in collect
  17. reverse_dependency=reverse_dependency) File "/usr/lib/python2.7/dist-packages/django/db/models/deletion.py" in add
  18. if not objs: File "/usr/lib/python2.7/dist-packages/django/db/models/query.py" in nonzero
  19. iter(self).next() File "/usr/lib/python2.7/dist-packages/django/db/models/query.py" in _result_iter
  20. self._fill_cache() File "/usr/lib/python2.7/dist-packages/django/db/models/query.py" in _fill_cache
  21. self._result_cache.append(self._iter.next()) File "/usr/lib/python2.7/dist-packages/django/db/models/query.py" in iterator
  22. for row in compiler.results_iter(): File "/usr/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in results_iter
  23. for rows in self.execute_sql(MULTI): File "/usr/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in execute_sql
  24. cursor.execute(sql, params) File "/usr/lib/python2.7/dist-packages/django/db/backends/util.py" in execute
  25. return self.cursor.execute(sql, params) File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py" in execute
  26. return self.cursor.execute(query, args) File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py" in execute
  27. self.errorhandler(self, exc, value) File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py" in defaulterrorhandler
  28. raise errorclass, errorvalue

Exception Type: DatabaseError at /admin/badger/badge/add/ Exception Value: (1146, "Table 'python.badger_badge_prerequisites' doesn't exist")

lmorchard commented 11 years ago

Hmm, I haven't been able to reproduce this. Maybe try re-installing the app? Might have missed the migrate step, or something could have been fixed since this issue was filed. Feel free to reopen or refile if it happens again