https://github.com/kkinder/django-ajaxview
Simple Django library for quickly using Ajax calls in regular views.
https://github.com/kkinder/django-ajaxview
ajax django
Last synced: 2 months ago
JSON representation
Simple Django library for quickly using Ajax calls in regular views.
- Host: GitHub
- URL: https://github.com/kkinder/django-ajaxview
- Owner: kkinder
- License: mit
- Created: 2020-12-13T22:42:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-09-28T11:32:31.000Z (over 3 years ago)
- Last Synced: 2026-01-14T01:42:15.432Z (2 months ago)
- Topics: ajax, django
- Language: Python
- Homepage:
- Size: 47.9 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```python
class MyController(AjaxView):
...
@ajax
def greetings(self, name):
return f'Why hello there, {name}!'
```
Inside the rendered HTML:
```javascript
const message = await greetings({name: 'Ken'})
```
See [documentation for details](https://django-ajaxview.readthedocs.io/). Licensed under MIT.