django-relationships icon indicating copy to clipboard operation
django-relationships copied to clipboard

Django-relationships: RelationshipStatus matching query doesnt exist

Open shubhammulay opened this issue 10 years ago • 2 comments

I am using django-relationships for the system of followers and following in my django app. I followed the documentation and added the app 'relationships' in my INSTALLED_APPS. And after it by running 'python manage.py shell' ,I did the following according to the documentation

>>> john = User.objects.get(username='john')
>>> rel = john.relationships.add(jane)

But the problem is :

Traceback (most recent call last):
File "<console>", line 1, in <module>
File "build/bdist.macosx-10.7-intel/egg/relationships/models.py", line 96, in add
  status = RelationshipStatus.objects.following()
File "build/bdist.macosx-10.7-intel/egg/relationships/models.py", line 13, in following
  return self.get(from_slug='following')
File "/Library/Python/2.7/site-packages/django/db/models/manager.py", line 132, in get
  return self.get_query_set().get(*args, **kwargs)
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 349, in get
  % self.model._meta.object_name)
DoesNotExist: RelationshipStatus matching query does not exist.

I also copied the folder of django-relationships in my main project folder but it didnt work. Do I have to manually create relationshipstatuses ? How to do it ? Or what is other solution for it ? Thanks!

shubhammulay avatar Nov 30 '14 14:11 shubhammulay

Add the app in the INSTALLED_APPS not the sourcecode. Have you created your tables? Before running shell you need to create the tables related to the app. Try executing: python manage.py makemigrations python manage.py migrate

carpincho avatar Dec 05 '14 09:12 carpincho

I have added the app in "INSTALLED_APPS".I also tried you second step.But it aint working.It says "RelationshipStatus matching query does not exist." Tables have been created.The problem is that they are empty!

shubhammulay avatar Dec 06 '14 13:12 shubhammulay