FS#23228 - {archweb} DoesNotExist: ContentType matching query does not exist.

Attached to Project: Arch Linux
Opened by Dieter Plaetinck (Dieter_be) - Thursday, 10 March 2011, 21:13 GMT
Last edited by Dan McGee (toofishes) - Monday, 31 December 2012, 15:50 GMT
Task Type Bug Report
Category Web Sites
Status Closed
Assigned To Dan McGee (toofishes)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

archweb, latest from git, master branch. (1dc867587da6b66ca575eb26f4f65cb9d67ffdb3)
I try to set it up, following all instructions in the README for `# Testing Installation`

It seems to work, until this step:

(archweb-env)22:09:00 dieter@ws archweb master ? ./manage.py loaddata main/fixtures/groups.json
Installing json fixture 'main/fixtures/groups' from absolute path.
Problem installing fixture 'main/fixtures/groups.json': Traceback (most recent call last):
File "/home/dieter/workspaces/eclipse/archweb-env/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 169, in handle
for obj in objects:
File "/home/dieter/workspaces/eclipse/archweb-env/lib/python2.7/site-packages/django/core/serializers/json.py", line 35, in Deserializer
for obj in PythonDeserializer(simplejson.load(stream), **options):
File "/home/dieter/workspaces/eclipse/archweb-env/lib/python2.7/site-packages/django/core/serializers/python.py", line 105, in Deserializer
m2m_data[field.name] = [m2m_convert(pk) for pk in field_value]
File "/home/dieter/workspaces/eclipse/archweb-env/lib/python2.7/site-packages/django/core/serializers/python.py", line 100, in m2m_convert
return field.rel.to._default_manager.db_manager(db).get_by_natural_key(*value).pk
File "/home/dieter/workspaces/eclipse/archweb-env/lib/python2.7/site-packages/django/contrib/auth/models.py", line 50, in get_by_natural_key
content_type=ContentType.objects.get_by_natural_key(app_label, model)
File "/home/dieter/workspaces/eclipse/archweb-env/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 15, in get_by_natural_key
ct = self.get(app_label=app_label, model=model)
File "/home/dieter/workspaces/eclipse/archweb-env/lib/python2.7/site-packages/django/db/models/manager.py", line 132, in get
return self.get_query_set().get(*args, **kwargs)
File "/home/dieter/workspaces/eclipse/archweb-env/lib/python2.7/site-packages/django/db/models/query.py", line 347, in get
% self.model._meta.object_name)
DoesNotExist: ContentType matching query does not exist.


This task depends upon

Closed by  Dan McGee (toofishes)
Monday, 31 December 2012, 15:50 GMT
Reason for closing:  Works for me
Comment by Dieter Plaetinck (Dieter_be) - Thursday, 10 March 2011, 21:22 GMT
22:22:00 dieter@ws archweb master ? pacman -Qs virtualenv
local/python-virtualenv 1.5.1-2
Virtual Python Environment builder
22:22:03 dieter@ws archweb master ? pacman -Qs python2
local/python2 2.7.1-7
A high-level scripting language
local/python2-distribute 0.6.14-2
A collection of extensions to the Python 2 distutils
local/python2-numpy 1.5.1-2
Scientific tools for Python
local/python2-qt 4.8.3-1
A set of Python 2 bindings for the Qt toolkit
local/python2-sip 4.12.1-1
A tool that makes it easy to create Python 2 bindings for C and C++ libraries
Comment by Dan McGee (toofishes) - Thursday, 10 March 2011, 22:37 GMT
If you're using virtualenv, it doesn't matter what python packages you installed, the virtualenv itself matters. `pip freeze`, even though that has no relevance here for future reference.

There is some oddness with the permissions and content type migrations due to a refactoring a while back, it appears. I took a quick look but there isn't a super quick fix- the particular permission and content type it is blowing up on is the news stuff, so if you just delete the two arrays in that json file dealing with news (add_news and change_news), you should be able to work around the problem for now.
Comment by Olivier (litemotiv) - Tuesday, 19 July 2011, 11:08 GMT
I ran into the same error here, but removing the offending lines doesn't seem to fix it. Any other changes i need to make?
Comment by Dan McGee (toofishes) - Tuesday, 19 July 2011, 15:25 GMT
For now, try the following workaround:
./manage.py reset contenttypes (answer yes)
./manage.py loaddata contenttypes.json
Comment by Olivier (litemotiv) - Tuesday, 19 July 2011, 17:37 GMT
That fixed the contenttypes error, but produces a new one for permissions:

(archweb-env)[~/source/archweb]% ./manage.py loaddata */fixtures/*.json
Problem installing fixture 'main/fixtures/groups.json': Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 169, in handle
for obj in objects:
File "/usr/lib/python2.7/site-packages/django/core/serializers/json.py", line 35, in Deserializer
for obj in PythonDeserializer(simplejson.load(stream), **options):
File "/usr/lib/python2.7/site-packages/django/core/serializers/python.py", line 105, in Deserializer
m2m_data[field.name] = [m2m_convert(pk) for pk in field_value]
File "/usr/lib/python2.7/site-packages/django/core/serializers/python.py", line 100, in m2m_convert
return field.rel.to._default_manager.db_manager(db).get_by_natural_key(*value).pk
File "/usr/lib/python2.7/site-packages/django/contrib/auth/models.py", line 61, in get_by_natural_key
content_type=ContentType.objects.get_by_natural_key(app_label, model)
File "/usr/lib/python2.7/site-packages/django/db/models/manager.py", line 132, in get
return self.get_query_set().get(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 349, in get
% self.model._meta.object_name)
DoesNotExist: Permission matching query does not exist
Comment by Dan McGee (toofishes) - Tuesday, 19 July 2011, 17:43 GMT
Damn you Django. Remove the two arrays from the groups.json file containing the "add_signoff" permission for now, e.g.

- [
- "add_signoff",
- "main",
- "signoff"
- ],

Comment by Olivier (litemotiv) - Tuesday, 19 July 2011, 18:03 GMT
I'm sorry to say it, but the error persists. ;-)

Loading...