diff options
| author | Stephan Groß | 2012-10-31 15:30:01 +0100 |
|---|---|---|
| committer | Stephan Groß | 2012-10-31 15:30:01 +0100 |
| commit | ff7725f05e8ca624e54d707f7c655e3d5c8b8888 (patch) | |
| tree | ca01f596ac1bc41ac320b3915754dd742cc8dda2 /rest_framework/tests/models.py | |
| parent | de2ef5d9c24171eb6b945b7822eac809c099fec9 (diff) | |
| download | django-rest-framework-ff7725f05e8ca624e54d707f7c655e3d5c8b8888.tar.bz2 | |
added support for custom slug field and kwargs
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')
Diffstat (limited to 'rest_framework/tests/models.py')
0 files changed, 0 insertions, 0 deletions
