django-rest-framework/rest_framework
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
..
authtoken Don't import compat.py from authtoken.models. Closes #1297 2013-12-16 08:59:10 +00:00
runtests Drop 1.3 support 2013-09-25 10:30:04 +01:00
static/rest_framework Browsable API tab preferences should be site-wide 2013-08-30 09:20:12 +01:00
templates/rest_framework Merge branch 'master' into 2.4.0 2013-12-13 16:32:34 +00:00
templatetags Drop 1.3 support 2013-09-25 10:30:04 +01:00
tests Allow viewset to specify lookup value regex for routing 2014-01-04 16:45:03 -05:00
utils Merge branch 'master' into 2.4.0 2013-12-13 16:32:34 +00:00
__init__.py Version 2.3.10 2013-12-06 22:13:50 +00:00
authentication.py Merge branch 'bennbollay-patch-1' into 2.4.0 2013-12-23 09:48:59 +00:00
compat.py Merge branch 'bennbollay-patch-1' into 2.4.0 2013-12-23 09:48:59 +00:00
decorators.py Commenting link/action decorators as pending deprecation 2013-08-19 21:02:22 +01:00
exceptions.py Remove ConfigurationError in favor of Django's ImproperlyConfigured 2013-06-05 13:45:28 +01:00
fields.py Merge branch 'bennbollay-patch-1' into 2.4.0 2013-12-23 09:48:59 +00:00
filters.py Add queryset aggregates to allowed fields in OrderingFilter 2013-11-12 23:40:07 +00:00
generics.py Merge branch 'master' into 2.4.0 2013-12-13 16:32:34 +00:00
mixins.py Merge branch 'master' into 2.4.0 2013-12-13 16:32:34 +00:00
models.py Change package name: djangorestframework -> rest_framework 2012-09-20 13:06:27 +01:00
negotiation.py Added proper charset support 2013-05-18 17:21:43 +01:00
pagination.py Cleanup docstrings 2013-04-25 12:47:34 +01:00
parsers.py Fixed exception handling with YAML and XML parsers. 2013-10-31 15:03:50 -07:00
permissions.py Merge branch 'bennbollay-patch-1' into 2.4.0 2013-12-23 09:48:59 +00:00
relations.py Merge master 2013-09-25 09:44:26 +01:00
renderers.py Catch and mask ParseErrors that occur during rendering of the BrowsableAPI. 2013-12-09 07:34:08 +00:00
request.py Catch and mask ParseErrors that occur during rendering of the BrowsableAPI. 2013-12-09 07:34:08 +00:00
response.py Remove Content-Type header from empty responses. Fixes #1196 2013-12-03 16:55:11 +00:00
reverse.py Cleanup imports 2013-02-04 20:55:35 +00:00
routers.py Allow viewset to specify lookup value regex for routing 2014-01-04 16:45:03 -05:00
serializers.py Merge branch 'bennbollay-patch-1' into 2.4.0 2013-12-23 09:48:59 +00:00
settings.py Add get_ident method to pass new tests. 2013-12-06 14:21:52 -08:00
status.py Version 2.3.10 2013-12-06 22:13:50 +00:00
test.py force_authenticate(None) also clears session info. 2013-08-23 11:21:52 +01:00
throttling.py Allow NUM_PROXIES=0 and include more docs 2013-12-13 00:02:18 +00:00
urlpatterns.py Merge branch 'master' into 2.4.0 2013-12-13 16:32:34 +00:00
urls.py Drop 1.3 support 2013-09-25 10:30:04 +01:00
views.py Update comment in get_parser_context. 2013-10-24 13:45:16 +01:00
viewsets.py minor typo 2013-10-29 15:10:06 -05:00