openwisp / django-rest-framework-gis

Geographic add-ons for Django REST Framework. Maintained by the OpenWISP Project.
http://openwisp.org
MIT License
1.09k stars 201 forks source link

ValueError: list.remove(x): x not in list - Incompatibility with newest django-rest-framework 3.10.2 #194

Closed ChrFr closed 5 years ago

ChrFr commented 5 years ago

ValueError: list.remove(x): x not in list

The newest version of django-rest-framework handles the fields attribute differently https://github.com/encode/django-rest-framework/blob/master/rest_framework/serializers.py#L352 It now returns a new copy of the field dict with every call, causing problems in the django-rest-framework-gis code at https://github.com/djangonauts/django-rest-framework-gis/blob/master/rest_framework_gis/serializers.py#L107 when trying to remove the id field from the list. Python does not recognize that the value is in list because it is a different object (successive calls of the fields property)

Unfortunatelly i have no time to fix this myself at the moment and make a pull request. Maybe i can do it another time. I am adding it as an issue anyway in case i forget about it.