Skip to content

feature request: class-based views support. #54

@Lazerbeak12345

Description

@Lazerbeak12345

for some things, such as integration with DjangoRESTFramework, it would be nice if, in addition to the @inertia('ClientSidePage') decorator, support for class based views could be added.

My recommendation is to provide a mix-in (as shown here), which might be used like this:

from django.views import View
from inertia import InertiaMixin


class AsdfView(InertiaMixin, View):
    component = "Asdf"

    def get(self, request):
        return { "message": "asdf" }

If you're careful, then the mixin could function by internally decorating each method function with @inertia("Asdf") - though bear in mind these method functions take the View instance as the first arg, so chaperoning the mixin is necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions