From 7a203e61d89411601ef9db7e11278258a065944c Mon Sep 17 00:00:00 2001 From: Sylvain Le Bon <sylvain@happy-dev.fr> Date: Sun, 3 Jun 2018 18:42:19 +0000 Subject: [PATCH] Update README.md --- README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2cc57df4..7a3ce01e 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,22 @@ To start the server, `cd` to the root of your Django project and run : python3 manage.py runserver ``` -## Lic ense +## Custom Parameters to LDPViewSet -No licence yet. Please wait... +### lookup_field +Can be used to use a slug in the url instead of the primary key. +``` +LDPViewSet.urls(model=User, lookup_field='username') +``` + +### nested_fields +list of ForeignKey, ManyToManyField, OneToOneField and their reverse relations. When a field is listed in this parameter, a container will be created inside each single element of the container. + +In the following example, besides the urls `/members/` and `/members/<pk>/`, two other will be added to serve a container of the skills of the member: `/members/<pk>/skills/` and `/members/<pk>/skills/<pk>/` +``` + url(r'^members/', LDPViewSet.urls(model=Member, nested_fields=("skills",))), +``` + +## License + +Licence MIT -- GitLab