Let Django play well with AngularJS
Project description
django-angular
Let Django play well with AngularJS
Deprecation Warning: AngularJS is dead
Since AngularJS is deprecated now, this library shall not be used for new projects anymore. Instead please proceed with my follow-up project django-formset. All the useful features for Django Form validation have been reimplemented in django-formset, this time in vanilla TypeScript and without depending on any third party package.
What does it offer?
Add AngularJS directives to Django Forms. This allows to handle client side form validation using the constraints provided by the server side Form declaration.
For more information, please visit the demo site.
How to run
git clone https://github.com/jrief/django-angular.git django-angular.git
cd django-angular.git
docker build -t django-angular.git .
docker run -d -it -p 9002:9002 django-angular.git
Open the application at http://{docker-host's-ip}:9002/
Backward Incompatibility
To be compliant with other libraries such as djangorestframework, server-side responses on rejected forms use error code 422, rather than 200. If you use your own form controllers, adopt them accordingly. The JSON format used to communicate errors downstream has changed slightly.
New Features
For a smoother transition path, django-angular added two directives in version 2.0:
<form djng-endpoint="/path/to/endpoint">...</form>
, which can be used to upload form
data to the server. It also populates the error fields, in case the server rejected some data.
<djng-forms-set endpoint="/path/to/endpoint"><form ...>...</form>...</djng-forms-set>
Similar to the above directive, but rather than validating one single form, it validates a
set of forms using one shared endpoint.
A promise chain has been introduced. Buttons used to submit form data and then proceed with something else, now can be written as:
<button ng-click="do(update()).then(redirectTo('/path/to/other/page'))">Label</button>
Documentation
Detailed documentation on ReadTheDocs.
Demo on how to combine Django with Angular's form validation.
Please drop me a line, if and where you use this project.
Features
- Seamless integration of Django forms with AngularJS controllers.
- Client side form validation for Django forms using AngularJS.
- Let an AngularJS controller call methods in a Django view - kind of Javascript RPCs.
- Manage Django URLs for static controller files.
- Three way data binding to connect AngularJS models with a server side message queue.
- Perform basic CRUD operations.
Examples
- Implement Filter On Single Page Application using Django & Angular JS https://shriniket.home.blog/2019/09/22/integrate-angular-js-with-django-filter-application/
License
Copyright © 2019
MIT licensed
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-angular-2.3.1.tar.gz
.
File metadata
- Download URL: django-angular-2.3.1.tar.gz
- Upload date:
- Size: 164.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9c97de2b4658d30f6e3a4f9d5515a479914ac5976a3cb46a609faae0bd95852 |
|
MD5 | 646d9b9d4614a3e6b5970ca6acd53226 |
|
BLAKE2b-256 | 102f150b761f96b0e64b6a77c313b958e9177bc6cebaa4f713b8875b169b6b96 |
Provenance
File details
Details for the file django_angular-2.3.1-py3-none-any.whl
.
File metadata
- Download URL: django_angular-2.3.1-py3-none-any.whl
- Upload date:
- Size: 192.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4841cb6e8e3323300e7ffff44d8a7c54bc474974e76d7b47145c0010de79913b |
|
MD5 | 707b249bd5c1e086b57c372f7289f7e9 |
|
BLAKE2b-256 | 5c3d789136a2ab3ecc251f7d27a4a9193e6e9cd2d434e6ae9bba87527ec38ac9 |