I'm trying to get an object from my neo4j database using neo4django
>>> # There is a single Person object in the database, so I get a value
>>> slug=Person.objects.get().name_slug
>>> print(slug)
doe-john
>>> # ok, it's there
>>> p=Person.objects.get(name_slug=slug)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/[...]/src/neo4django/neo4django/db/models/manager.py", line 37, in get
return self.get_query_set().get(*args, **kwargs)
File "/[...]/lib/python2.7/site-packages/django/db/models/query.py", line 366, in get
% self.model._meta.object_name)
DoesNotExist: Person matching query does not exist.
>>> p=Person.objects.get(name_slug__exact=slug)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/[...]/src/neo4django/neo4django/db/models/manager.py", line 37, in get
return self.get_query_set().get(*args, **kwargs)
File "/[...]/lib/python2.7/site-packages/django/db/models/query.py", line 366, in get
% self.model._meta.object_name)
DoesNotExist: Person matching query does not exist.
The error message is not sensible. I just received the queried string from the very field, so there must be a match. Any ideas? Or did I stumble upon a bug?
This is really strange, as it works with the other properties, but not with name_slug
:
>>> Person.objects.get(surname='Doe')
<Person: Person object>
>>> Person.objects.get(given_name='John')
<Person: Person object>
>>> Person.objects.get(name_slug='john-doe')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/[...]/src/neo4django/neo4django/db/models/manager.py", line 37, in get
return self.get_query_set().get(*args, **kwargs)
File "/[...]/lib/python2.7/site-packages/django/db/models/query.py", line 366, in get
% self.model._meta.object_name)
DoesNotExist: Person matching query does not exist.
>>> print( p.surname, p.given_name, p.name_slug )
(u'Doe', u'John', u'john-doe')
My model is defined as such:
class Person(models.NodeModel):
surname = models.StringProperty(required=True, indexed=True)
given_name = models.StringProperty(required=True, indexed=True)
name_slug = models.StringProperty(indexed=True)
So the only difference is that it's not required
, but that should make no difference, in my understanding of the documentation.