django-rest-framework/rest_framework/tests
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
..
extras Be more informative when reporting import errors. 2013-01-07 12:52:20 +00:00
__init__.py Push tests into a seperate app namespace 'rest_framework.test' 2012-10-27 18:44:23 +01:00
description.py Use imported views to expose python 2.6 bug. Refs #943 2013-06-27 11:58:34 +01:00
models.py add test case around ensuring proper field inference for boolean model field types 2013-10-18 21:10:49 -04:00
test_authentication.py Merge branch 'bennbollay-patch-1' into 2.4.0 2013-12-23 09:48:59 +00:00
test_breadcrumbs.py Drop 1.3 support 2013-09-25 10:30:04 +01:00
test_decorators.py Added APIRequestFactory 2013-06-28 17:17:39 +01:00
test_description.py Updated tests for view name and description 2013-08-18 00:29:05 -04:00
test_fields.py Add unittests for ChoiceField metadata. 2013-11-27 11:06:42 +00:00
test_files.py Add missing newline at the end of test file 2013-09-12 16:04:33 +01:00
test_filters.py Merge branch 'master' into 2.4.0 2013-12-13 16:32:34 +00:00
test_genericrelations.py Rename test modules to 1.6 style 2013-05-29 08:57:11 +01:00
test_generics.py Added handling of validation errors in PUT-as-create. 2013-11-19 15:49:31 +01:00
test_htmlrenderer.py Drop 1.3 support 2013-09-25 10:30:04 +01:00
test_hyperlinkedserializers.py Drop 1.3 support 2013-09-25 10:30:04 +01:00
test_multitable_inheritance.py Rename test modules to 1.6 style 2013-05-29 08:57:11 +01:00
test_negotiation.py Added APIRequestFactory 2013-06-28 17:17:39 +01:00
test_pagination.py remove stray func from test 2013-10-21 14:26:21 -07:00
test_parsers.py Rename test modules to 1.6 style 2013-05-29 08:57:11 +01:00
test_permissions.py Address pending deprecation of Model._meta.module_name in Django 1.6 2013-09-23 17:48:25 +02:00
test_relations_hyperlink.py Drop 1.3 support 2013-09-25 10:30:04 +01:00
test_relations_nested.py Failing test case for nullifying nested object 2013-08-12 21:06:37 +03:00
test_relations_pk.py Regression test for #1072 2013-08-31 17:10:15 +03:00
test_relations_slug.py Rename test modules to 1.6 style 2013-05-29 08:57:11 +01:00
test_relations.py Rename test modules to 1.6 style 2013-05-29 08:57:11 +01:00
test_renderers.py Merge branch 'master' into 2.4.0 2013-12-13 16:32:34 +00:00
test_request.py Merge branch 'master' into 2.4.0 2013-12-13 16:32:34 +00:00
test_response.py Drop 1.3 support 2013-09-25 10:30:04 +01:00
test_reverse.py Drop 1.3 support 2013-09-25 10:30:04 +01:00
test_routers.py Allow viewset to specify lookup value regex for routing 2014-01-04 16:45:03 -05:00
test_serializer_bulk_update.py Rename test modules to 1.6 style 2013-05-29 08:57:11 +01:00
test_serializer_empty.py Ensure read-only fields don't break with current HTML renderer behavior 2013-10-10 17:33:22 +01:00
test_serializer_nested.py Fixed the nested model serializers in case of the related_name isn’t set. 2013-11-17 01:27:16 +01:00
test_serializer.py Merge branch 'bennbollay-patch-1' into 2.4.0 2013-12-23 09:48:59 +00:00
test_settings.py Rename test modules to 1.6 style 2013-05-29 08:57:11 +01:00
test_status.py Version 2.3.10 2013-12-06 22:13:50 +00:00
test_testing.py Drop 1.3 support 2013-09-25 10:30:04 +01:00
test_throttling.py PEP8 Compliance 2013-12-06 14:52:39 -08:00
test_urlpatterns.py Drop 1.3 support 2013-09-25 10:30:04 +01:00
test_validation.py Merge pull request #1309 from lukaszb/errors-for-renamed-fields 2013-12-21 13:58:49 -08:00
test_views.py Support customizable view EXCEPTION_HANDLER 2013-09-06 12:47:33 -05:00
tests.py Only use test import munging prior to Django 1.6's new test runner 2013-06-02 21:04:47 +01:00