dimanche 22 mars 2015

"ContentType matching Query does not exist" - only on SQLite, not MySQL

I'm experiencing a strange bug with the way Django Test framework operates.


When using SQLite Database Backend, all of the tests crash with the following error:



File "[]/core/tests/test_admin.py", line 91, in setUpSomething
content_type = ContentType.objects.get(app_label='core', model='SomeModel')
File "[]/lib/python2.7/site-packages/django/db/models/manager.py", line 151, in get
return self.get_queryset().get(*args, **kwargs)
File "[]/lib/python2.7/site-packages/django/db/models/query.py", line 310, in get
self.model._meta.object_name)
DoesNotExist: ContentType matching query does not exist.


However, the same code executes well under MySQL backend.


Clearly Django should make these functions agnostic of the backend used?


Aucun commentaire:

Enregistrer un commentaire