fields.py
22.4 KB
-
added support for custom slug field and kwargs · ff7725f0
without subclassing HyperlinkedRelatedField and overwriting slug_url_kwarg and slug_field there is no possibility to use other fields / arguments. now you can do something like this: url(r'^users/(?P<username>\w[\w-]*)$', UserInstance.as_view(), name='user-detail') class ProjectSerializer(serializers.HyperlinkedModelSerializer): created_by = serializers.HyperlinkedRelatedField(view_name='user-detail', slug_url_kwargs='username', slug_field='username')
Stephan Groß committed