Search code examples
djangoneo4jneomodel

Getting - Can't install traversal 'has' exists on NodeSet, error when matching Node


I'm using Django with Neomodel and django_neomodel to connect to AuraDB and fetch data. In my views I'm doing:

    def homePage(request):
        name = request.user.last_name + ', ' + request.user.first_name
        my_person_node = Person.nodes.get(person_name=name)
        ...

My Person model:

class Person(DjangoNode):
    id = UniqueIdProperty(primary_key=True)
    person_id = StringProperty(unique_index=True)
    person_name = StringProperty(unique_index=False) 
    service_position = StringProperty(unique_index=False)
    has = Relationship('Research_Topic', 'has', model=Person_has_Research_Topic)
    is_teaching = RelationshipTo('Course', 'is_teaching')
    
    class Meta:
        app_label = 'profiles'

    def __str__(self):
        return self.person_name

and 'has' relation model:

    class Person_has_Research_Topic(StructuredRel):
        type = StringProperty()

This throws an error: ValueError: Can't install traversal 'has' exists on NodeSet


Solution

  • Maybe you should change the class attribute 'has'. I met this problem when using 'source' as attribute name and solved it by changing a new name.