classy-django-rest-framework icon indicating copy to clipboard operation
classy-django-rest-framework copied to clipboard

Use repr for an Attribute value

Open KommuSoft opened this issue 2 years ago • 0 comments
trafficstars

For string values for attributes, for example on a GenericAPIView, it uses:

lookup_field = pk

(see https://www.cdrf.co/3.7/rest_framework.generics/GenericAPIView.html )

It thus fails to perform a repr over the item and thus displays it as a variable. We can use repr to show this as:

lookup_field = 'pk'

instead.

KommuSoft avatar Jan 11 '23 00:01 KommuSoft