Register Routes
Django decorated routes is not opinionated but help you do something pretty simple: place your views any where you want. You need to follow two basic rules:
Your class view must extends from the
django.views.generic.base.View
. Yes, views based on DRF base views are welcome.You need to add the decorator.
How to
Well, it's no rocket science. Have a look at the next peace of code:
from django.http import JsonResponse
from django.views.generic.base import View
from decorated_router.api.decorators import url_decoration
@url_decoration(path="api/blog/")
class Blog(View):
def get(self, request):
return JsonResponse({'foo': 'bar'})