routers.py 568 Bytes
Newer Older
luxcem's avatar
luxcem committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from rest_framework import routers


class DefaultRouter(routers.DefaultRouter):
    """
    Extends `DefaultRouter` class to add a method for extending url
    routes from another router.  # from
    http://stackoverflow.com/questions/31483282/django-rest-framework-combining-routers-from-different-apps
    """

    def extend(self, router):
        """
        Extend the routes with url routes of the passed in router.
        Args:
             router: SimpleRouter instance containing route definitions.
        """
        self.registry.extend(router.registry)