Skip to content

Instantly share code, notes, and snippets.

View EmadMokhtar's full-sized avatar
🚀
Release often, fail fast, & always improve

Emad Mokhtar EmadMokhtar

🚀
Release often, fail fast, & always improve
View GitHub Profile
@EmadMokhtar
EmadMokhtar / Django + Ajax dynamic forms .py
Created January 4, 2018 14:15 — forked from goldhand/Django + Ajax dynamic forms .py
Django form with Ajax. A simple Task model that can be updated using a CBV with an AJAX mixin. The view sends post data with ajax then updates the view with a callback to a DetailView with a json mixin.There is an abstract CBV, AjaxableResponseMixin, based on the example form django docs, that is subclassed in the TaskUpdateView CBV. TaskUpdateV…
#models.py
class Task(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
def __unicode__(self):
return self.title