django-rest-framework/docs/api-guide
Paul Melnikow a1d7aa8f71 Allow viewset to specify lookup value regex for routing
This patch allows a viewset to define a pattern for its lookup field, which the router will honor. Without this patch, any characters are allowed in the lookup field, and overriding this behavior requires subclassing router and copying and pasting the implementation of get_lookup_regex.

It's possible it would be better to remove this functionality from the routers and simply expose a parameter to get_lookup_regex which allows overriding the lookup_regex. That way the viewset config logic could be in the a subclass, which could invoke the super method directly.

I'm using this now for PostgreSQL UUID fields using https://github.com/dcramer/django-uuidfield . Without this patch, that field passes the lookup string to the database driver, which raises a DataError to complain about the invalid UUID. It's possible the field ought to signal this error in a different way, which could obviate the need to specify a pattern.
2014-01-04 16:45:03 -05:00
..
authentication.md Use get_user_model instead of User in Generating Tokens example 2013-12-11 13:56:56 +00:00
content-negotiation.md Include import paths throughout docs. 2013-08-21 19:46:09 +01:00
exceptions.md Added example of using APIException class. Closes #1300 2013-12-21 21:10:05 +00:00
fields.md Rephrased documentation changes according to feedback on IRC. 2013-11-27 14:47:37 +02:00
filtering.md Add third party packages 2013-12-12 23:10:31 +00:00
format-suffixes.md Fix md formatting and typos 2013-05-28 17:13:12 +02:00
generic-views.md Adds pre_delete and post_delete hooks on 2013-12-03 00:07:41 +00:00
pagination.md Docs for MAX_PAGINATE_BY setting & view attribute. 2013-08-28 12:55:49 +01:00
parsers.md Docs tweaks 2013-12-21 17:18:25 +00:00
permissions.md Tweak REST condition text. 2013-12-10 08:38:43 +00:00
relations.md Links to drf-nested-routers 2013-12-13 20:27:17 +00:00
renderers.md Docs tweaks 2013-12-21 17:18:25 +00:00
requests.md Note 'request.session' as available on requests. 2013-08-27 12:37:55 +01:00
responses.md Fixed typos in a bunch of docs 2013-08-07 14:00:06 -04:00
reverse.md Include import paths throughout docs. 2013-08-21 19:46:09 +01:00
routers.md Allow viewset to specify lookup value regex for routing 2014-01-04 16:45:03 -05:00
serializers.md Fix typo "Not" -> "Note" 2013-12-09 09:53:16 +00:00
settings.md Allow NUM_PROXIES=0 and include more docs 2013-12-13 00:02:18 +00:00
status-codes.md Version 2.3.10 2013-12-06 22:13:50 +00:00
testing.md In the API test client example 'data' was not defined. There's also no 2013-10-25 11:45:33 +13:00
throttling.md Merge branch 'master' into 2.4.0 2013-12-13 16:32:34 +00:00
views.md fix broken documentation links 2013-12-04 16:10:05 -08:00
viewsets.md Merge branch 'master' into 2.4.0 2013-12-13 16:32:34 +00:00