Skip to content

Simple Django library for quickly using Ajax calls in regular views.

License

Notifications You must be signed in to change notification settings

kkinder/django-ajaxview

Repository files navigation

Django Ajax View

Simple Django library for quickly using Ajax calls in regular views.

For example, suppose you have a regular TemplateView in Django, which you want to add Ajax interactivity to. Simply add an @ajax method to your controller, and it becomes accessible in the HTML template side as a function:

class MyController(AjaxView):
    ...

    @ajax
    def greetings(self, name):
        return f'Why hello there, {name}!'

Inside the rendered HTML:

const message = await greetings({name: 'Ken'})

See documentation for details. Licensed under MIT.

About

Simple Django library for quickly using Ajax calls in regular views.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published