Skip to content

Commit

Permalink
ADDED: check issubclass NestedViewSetMixin for nested routes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Bredehöft committed Aug 19, 2015
1 parent cae2a7a commit cf5e799
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drf_nested_routing/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from drf_nested_routing import add_parent_query_lookups
import drf_nested_routing
from drf_nested_routing.views import NestedViewSetMixin


class NestedRegistryItem(object):
Expand All @@ -14,6 +15,8 @@ def __init__(self, router, parent_prefix, parent_item=None):
self.parent_item = parent_item

def register(self, prefix, viewset, parent_query_lookups=None, base_name=None):
if not issubclass(viewset, NestedViewSetMixin):
raise ValueError("ViewSets of nested routes must subclass NestedViewSetMixin")
if not base_name:
base_name = viewset.queryset.model.__name__.lower()
if parent_query_lookups:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='drf-nested-routing',
version="0.9.1",
version="0.9.2",
url='https://github.com/seebass/drf-nested-routing',
license='MIT',
description='Nested routing extension for Django REST Framework 3',
Expand Down

0 comments on commit cf5e799

Please sign in to comment.