aboutsummaryrefslogtreecommitdiffstats
path: root/mkdocs.py
diff options
context:
space:
mode:
authorPaul Melnikow2014-01-02 17:44:47 -0500
committerPaul Melnikow2014-01-04 16:45:03 -0500
commita1d7aa8f712b659f9d8302a2d2a098d2538e6c89 (patch)
tree5399f7784620f73d288b1b7f7a4ac52ac7e1d1c4 /mkdocs.py
parent52686420f4bf866064ee88a15903665f14289394 (diff)
downloaddjango-rest-framework-a1d7aa8f712b659f9d8302a2d2a098d2538e6c89.tar.bz2
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.
Diffstat (limited to 'mkdocs.py')
0 files changed, 0 insertions, 0 deletions