Skip to main content

Django Rest Framework meets Angular 5 dynamic forms - rapid development of create and edit dialogs

Project description

This repo provides Django mixins and Angular library for rapid development of create/edit dialogs for django rest framework. It depends on Angular5 and Material UI.

On django side, extend your Viewset to use AngularFormMixin and optionally configure the mixin by providing either layout information or field defaults (such as css classes). See demos for details.

class CityViewSet(AngularFormMixin, viewsets.ModelViewSet):
    API for cities
    queryset = City.objects.all()
    serializer_class = CitySerializer

On angular side, use DjangoFormDialogService to display a dialog:

constructor(private dialog: DjangoFormDialogService) {
createCity() {'/api/1.0/cities/').subscribe(result => {
        console.log('City created, result from server is:', result);

You can also display the form inside your own component via <inpage-django-form> tag.

<inpage-django-form django_url="/api/1.0/cities/"

Demo and sample source files

See demos at

With a bit of work on your side, foreign keys and many-to-many relationships are supported as well (see the demos for details)


Django side:

pip install django-angular-dynamic-forms

Angular side:

npm install --save django-angular-dynamic-forms @ng-dynamic-forms/core @ng-dynamic-forms/ui-material

To render forms, this library uses - do not forget to add it to your package.json.

and add DjangoFormModule to imports. You will need to provide your own ErrorService for showing communication errors back to the user. See the demo/angular/src/app/mat-error.service.ts for an example implementation.

import {DjangoFormModule, ErrorService} from 'django-angular-dynamic-forms';

    declarations: [
    imports: [
    providers: [
            provide: ErrorService,
            useClass: MatErrorService
    bootstrap: [AppComponent]
export class AppModule {

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-angular-dynamic-forms, version 1.1.1
Filename, size File type Python version Upload date Hashes
Filename, size django-angular-dynamic-forms-1.1.1.tar.gz (13.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page