Note that there are some explanatory texts on larger screens.

plurals
  1. PO`objects.get(...)` does not work as expected
    primarykey
    data
    text
    <p>I'm trying to get an object from my <strong>neo4j</strong> database using <strong>neo4django</strong></p> <pre><code>&gt;&gt;&gt; # There is a single Person object in the database, so I get a value &gt;&gt;&gt; slug=Person.objects.get().name_slug &gt;&gt;&gt; print(slug) doe-john &gt;&gt;&gt; # ok, it's there &gt;&gt;&gt; p=Person.objects.get(name_slug=slug) Traceback (most recent call last): File "&lt;console&gt;", line 1, in &lt;module&gt; 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. &gt;&gt;&gt; p=Person.objects.get(name_slug__exact=slug) Traceback (most recent call last): File "&lt;console&gt;", line 1, in &lt;module&gt; 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. </code></pre> <p>The error message is not sensible. I just received the queried string from the very field, so there <strong>must</strong> be a match. Any ideas? Or did I stumble upon a bug?</p> <p>This is really strange, as it works with the other properties, but not with <code>name_slug</code>:</p> <pre><code>&gt;&gt;&gt; Person.objects.get(surname='Doe') &lt;Person: Person object&gt; &gt;&gt;&gt; Person.objects.get(given_name='John') &lt;Person: Person object&gt; &gt;&gt;&gt; Person.objects.get(name_slug='john-doe') Traceback (most recent call last): File "&lt;console&gt;", line 1, in &lt;module&gt; 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. &gt;&gt;&gt; print( p.surname, p.given_name, p.name_slug ) (u'Doe', u'John', u'john-doe') </code></pre> <p>My model is defined as such:</p> <pre><code>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) </code></pre> <p>So the only difference is that it's not <code>required</code>, but that should make no difference, in my understanding of the documentation.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload