Commit Graph

17 Commits

Author SHA1 Message Date
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
Tom Christie
e441f85109 Drop 1.3 support 2013-09-25 10:30:04 +01:00
Tom Christie
9a5b2eefa9 Merge master 2013-08-30 09:28:33 +01:00
Tom Christie
1c935cd3d2 Fix failing test for router with no trailing slash 2013-08-23 15:18:47 +01:00
Alex Burgel
eaae8fb2d9 Combined link_* and action_* decorators into detail_route and list_route, marked the originals as deprecated. 2013-07-15 18:35:13 -04:00
Alex Burgel
e14cbaf696 Changed collection_* decorators to list_* 2013-07-15 17:59:36 -04:00
Alex Burgel
f022743078 Rename router collection test case 2013-07-15 17:59:36 -04:00
Alex Burgel
d72603bc6a Add support for collection routes to SimpleRouter 2013-07-15 17:59:03 -04:00
Tom Christie
7224b20d58 Added APIRequestFactory 2013-06-28 17:17:39 +01:00
Jamie Matthews
c127e63c32 Raise exception when attempting to dynamically route to a method that is already routed to. Fixes #940 2013-06-26 23:00:42 +01:00
Tom Christie
3d4bb4b553 Ensure action kwargs properly handdled. Refs #940. 2013-06-21 22:03:07 +01:00
Ethan Fremen
d89aade343 Allow the default router to have a custom name.
Signed-off-by: Ethan Fremen <ethan@matterport.com>
2013-06-07 19:49:18 -07:00
Tom Christie
f1251e8c58 Added trailing_slash argument to routers. Closes #905 2013-06-04 20:59:12 +01:00
Tom Christie
27d8b848bc Add notes on 'method' argument to '@action' decorator 2013-06-02 20:40:56 +01:00
Tom Christie
d7753123f6 HyperlinkedModelSerializer lookup_field option should apply to HyperlinkedIdentityField 2013-05-31 11:50:37 +01:00
Tom Christie
c36ff4e052 Cleaning up imports and whitespace 2013-05-31 11:17:33 +01:00
Tom Christie
cb49c5d3c0 Rename test modules to 1.6 style 2013-05-29 08:57:11 +01:00