duck.backend.django.viewsΒΆ

Module containing the default view to handle all Django requests through redirecting them to the appropriate Duck view to produce a response.

Module ContentsΒΆ

FunctionsΒΆ

_duck_django_view

Django default view to handle requests meant for urlpatterns registered within Duck.

duck_django_view

Django default view to handle requests meant for urlpatterns registered within Duck.

request_meta_update

Decorator to ensure that the Django request.META gets updated with the Duck request.META before processing the function.

APIΒΆ

duck.backend.django.views._duck_django_view(request: django.http.request.HttpRequest) β†’ django.http.response.HttpResponseΒΆ

Django default view to handle requests meant for urlpatterns registered within Duck.

Parameters:

request – The Django HTTP request.

Returns:

The corresponding Django HTTP response.

Return type:

DjangoHttpResponse

duck.backend.django.views.duck_django_view(request: django.http.request.HttpRequest) β†’ django.http.response.HttpResponseΒΆ

Django default view to handle requests meant for urlpatterns registered within Duck.

Parameters:

request – The Django HTTP request.

Returns:

The corresponding Django HTTP response.

Return type:

DjangoHttpResponse

duck.backend.django.views.request_meta_update(func: Callable)ΒΆ

Decorator to ensure that the Django request.META gets updated with the Duck request.META before processing the function.

Why Do This:

  • Keeps the Django request.META in sync with the Duck request.META.

  • Ensures consistency in metadata between the two request objects.

Parameters:

func – The function to be wrapped.

Returns:

The wrapped function with synchronized request.META.

Return type:

Callable