neo4j-contrib / django-neomodel

Neomodel plugin for Django
MIT License
290 stars 55 forks source link

'DjangoField' object has no attribute 'empty_values' #102

Open 73VW opened 2 months ago

73VW commented 2 months ago

Expected Behavior (Mandatory)

List of objects displaying correctly in admin.

Actual Behavior (Mandatory)

AttributeError: 'DjangoField' object has no attribute 'empty_values'

How to Reproduce the Problem

Not sure right now. Will keep this updated.

Simple Example

Datasets and Statements

Screenshots (where it's possibile)

image

image

Specifications (Mandatory)

Currently used versions

$ poetry show django-neomodel
 name         : django-neomodel        
 version      : 0.2.0                  
 description  : Use Neo4j with Django!

dependencies
 - django >=4.2.8
 - neomodel >=5.3.0,<5.4.0

Versions

73VW commented 2 months ago

I've been able to fix the error locally by adding the following in the __init__.py

from django.core import validators

...

@total_ordering
class DjangoField(object):
    """
    Fake Django model field object which wraps a neomodel Property
    """

    is_relation = False
    concrete = True
    editable = True
    creation_counter = 0
    unique = False
    primary_key = False
    auto_created = False
    empty_values = list(validators.EMPTY_VALUES) # <- HERE

It seems that it has not changed in Django base field here since 2013. Adding this should not break backwards compatibility.

I am going to open a PR with this change so that we cas discuss it further.