django-rest-framework/docs
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
..
api-guide Allow viewset to specify lookup value regex for routing 2014-01-04 16:45:03 -05:00
css Fix sidebar styling when browser window is too small 2013-06-26 23:26:35 +01:00
img First pass on contribution guide 2013-12-04 14:59:09 +00:00
js Tweak static files with docs 2012-10-09 14:12:38 +01:00
topics Merge branch 'bennbollay-patch-1' into 2.4.0 2013-12-23 09:48:59 +00:00
tutorial Merge branch 'bennbollay-patch-1' into 2.4.0 2013-12-23 09:48:59 +00:00
404.html Add a 404 page to the docs 2013-11-18 16:10:26 +00:00
index.md Expanded notes in quickstart. Closes #1127. Closes #1128. 2013-12-13 15:30:59 +00:00
requirements.txt Add basic serializer tests 2012-09-07 15:14:23 +01:00
template.html Minor grammar fix -- 'team' is singular 2013-12-08 19:34:24 -05:00