Django Material
Material design for Django.
- Django-Material 1.10.x compatible with Django 2.2/3.0/3.1/3.2/4.0
- Django-Material 1.[8,9].x compatible with Django 1.11/2.0/2.1/2.2/3.0/3.1/3.2
- Django-Material 1.7.x compatible with Django 1.11/2.0/2.1/2.2/3.0/3.1
- Django-Material 1.6.x compatible with Django 1.11/2.0/2.1/2.2/3.0
- Django-Material 1.[3,4,5].x compatible with Django 1.11/2.0/2.1/2.2
- Django-Material 1.2.x compatible with Django 1.11/2.0
- Django-Material 1.1.x compatible with Django 1.8/1.9/1.10/1.11
Tested with:

Overview
- Forms - New way to render django forms
- Strong python/html code separation
- Easy redefinition of particular fields rendering
- Complex form layout support
- Frontend - Quick starter template for modular admin-line applications development
Demo
To checkout and run open source demo version locally, you need to have git and tox tools installed.
git clone https://github.com/viewflow/django-material.git
cd django-material
TOXENV=py36-dj111 tox -- python manage.py migrate --settings=demo.settings
TOXENV=py36-dj111 tox -- python manage.py loaddata demo/fixtures/* --settings=demo.settings
TOXENV=py36-dj111 tox -- python manage.py runserver --settings=demo.settings
Then you can go to http://127.0.0.1:8000/integration/ and login with admin:admin username and password to the demo site.
Documentation
http://docs.viewflow.io/material_forms.html
License
Django Material is an Open Source project licensed under the terms of the BSD3 license
Django Material Pro with additional features has a commercial-friendly license. Check http:viewflow.io/pro/ for details.
Changelog
1.10.0 2021-11-12
- Drop support for python 2.7
- Drop support for Django 1.11, Django 2.0, Django 2.1
- Add support for Django 4.0
- Keep viewset.queryset for detai and delete views
- Improve multiple ajax select
- Speed up model List View
Invalid template name in 'extends' tag: ''. Got this from the 'current_module.base_template' variable.
hello guys, I created a module with manage.py startmodule applitest and i leave all by default and i uncomment default code in (models.py, urls.py and views.py) and everything was fine. But when go to localhost:8000/applitest/mymodel/ it throws TemplateSyntaxError.
Make list_actions consistent between ModelViewSet and ListMovelView
ModelViewSet
accepts list of tuples in format:Whereas the
ListMovelView
accepts in format:A relatively easy fix should be to simply move the
_get_actions
,get_action_view_kwargs
andget_action_view
fromModelViewSet
intoListMovelView
because as defaultModelViewSet
usesListMovelView
as itslist_view_class
anyway. This would make it possible to uselist_actions
inListMovelView
with passing the view directly into it, rather than reversing the url regardless of whether theListMovelView
is used fromModelViewSet
or independently.EDIT: Additionally, it would be nice to have
template_name
default to{model_name}_action_{action_name}.html
(throughget_template_names
)EDIT 2: A
has_action_permission
should be added toBaseActionView
which defaults to not requiring any permission. This makes it easy to e.g. restrict delete action to people with model'scan_delete
permission (which makes sense).Foreign Key Popup not opening in a new window
Hi,
When I've got a foreign key field, it's possible to "add" a new foreign key value. Normally with Django, it opens a new browser (target=blank).
However, with Material, it just opens a new page- meaning you leave the original model you were trying to edit.
I made a screenshot which should make more sense.
Not sure if this is a one-off bug for me, or a project wide-issue...
AjaxModelSelect OPTIONS header issue
OPTIONS header is used for CORS and cannot be trusted for data transfer in request body.
Eg. on AWS lambda request body is cleared with OPTIONS header. I've managed to override this by reading body from wsgi:
request_body = request.environ['wsgi.input']
Sadly, this is not the solution. Microsoft Edge 16 doesn't send request body with OPTIONS request. So AJAX widget is not usable on Edge at all. After all component should be using POST or GET for this. I suggest using POST with some kind of parameter and provide backward compatibility for OPTIONS. In JS with autocompleter initialization provide parametrization:
That way we could use POST method for both POSTs and autocompletes using URL param.
v2: publish npm package
Perhaps components from https://github.com/viewflow/django-material/tree/v2/material/static/material/components could be installed with npm install django-material, do you think this will be possible ?
When I click an item in dropdown selector , the item won't be selected
for example ,in http://forms.viewflow.io/demo/bank/, when I click America in Nationality, America won't be choosed. My browser is Google Chrome v61.0.3163.100.
Contributing by adding formsets: little bit of guidance
Hi! First of all: awesome project, first thing i thought about when I learned about Google's Material design.
I don't have an issue but I didn't know where to put this, so I figured I'd do it here.
I'd like to build out some missing parts of the Admin, I want it in one of my projects and would love to be able to offer this design to my clients. I've forked and integrated the project as a dev version in a current project, and ran into the missing formsets thing and I'd like to start there!
I was hoping someone could point me in the right direction for adding formsets, it would save me quite some time figuring out how the Admin internals work. If not, no problem, I'll do it anyway but it'll take me a little bit longer :) I'll take a look at the issues as well to see if I can fix a couple of them while I'm at it.
I'd be happy to write a small contributing guide in the process to try to give the project a boost.
Let me know if help is welcome!
Drop admin styling
Unfortunately, i can't no longer support django-material admin custom theme. But it's not so bad
I going to spend more efforts on the material.frontend improvements. Frontend going to be complete, more flexible and customizable django-admin replacement.
--
CheckboxSelectMultiple not displaying checkboxes
I'm using a ModelForm, my 'Person' model has a ManyToMany relationship with 'Problem' and I've set the form to show checkboxes as so
But it doesn't show checkboxes with Material Form, instead it shows a MultipleSelect
Removing the Material template shows up the checkboxes
404 error when trying to add a related (FK) object
In my model form i have some FK to another models, and when trying to add them in the admin, i got a 404 error. The problem seems to be at:
. /admin/templates/material/fields/django_relatedfieldwidgetwrapper.html:
I have attached a screenshot, when i click '+' i got the 404 error. Unfortunatly i dont know how to fix this issue to send a pr :-\
Selecting an item in datatable, going to next page and trying to perform action - the action is not performed on the item from previous page.
If we select an item on page 1 of datatable, go to page 2 and select 1 more item, then try to perform action (e.g. delete), the action is performed only on the 1 item from second page.
See: https://i.imgur.com/apEHsr8.gif
Edit: I've made a quick demo from version django-material-pro-1.1.3 and it works as expected there. I select 1 item on first page, 1 item on second page. Both items are accessible through JS and are passed to delete action.
See: https://i.imgur.com/zFgqhNi.gif As you can see the same JS function returns only the 'current page' item on the up to date django-material version: https://i.imgur.com/KGHkQ0L.gif
This is not intended, this is the standard behaviour of DataTables and I don't see why would it relate to materializecss itself.
Bump json5 from 2.2.0 to 2.2.3
Bumps json5 from 2.2.0 to 2.2.3.
Release notes
Sourced from json5's releases.
Changelog
Sourced from json5's changelog.
Commits
c3a7524
2.2.394fd06d
docs: update CHANGELOG for v2.2.33b8cebf
docs(security): use GitHub security advisoriesf0fd9e1
docs: publish a security policy6a91a05
docs(template): bug -> bug report14f8cb1
2.2.210cc7ca
docs: update CHANGELOG for v2.2.27774c10
fix: add proto to objects and arraysedde30a
Readme: slight tweak to intro97286f8
Improve example in readmeDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
Bump decode-uri-component from 0.2.0 to 0.2.2
Bumps decode-uri-component from 0.2.0 to 0.2.2.
Release notes
Sourced from decode-uri-component's releases.
Commits
a0eea46
0.2.2980e0bf
Prevent overwriting previously decoded tokens3c8a373
0.2.176abc93
Switch to GitHub workflows746ca5d
Fix issue where decode throws - fixes #6486d7e2
Update license (#1)a650457
Tidelift tasks66e1c28
Meta tweaksDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
Bump nth-check and cssnano
Bumps nth-check and cssnano. These dependencies needed to be updated together. Updates
nth-check
from 1.0.2 to 2.1.1Release notes
Sourced from nth-check's releases.
Commits
639fd2a
2.1.10eec65b
fix(test): AddmoduleNameMapper
aeeb067
fix: Fix ESM432ebc6
2.1.03e8cd1e
feat: Addgenerate
andsequence
methods (#207)57a5c62
feat: Add ESM (#206)1ce0c7c
chore(deps-dev): Bump@types/node
from 17.0.34 to 17.0.35 (#205)eebb040
chore(deps-dev): Bump@typescript-eslint/parser
from 5.24.0 to 5.25.0 (#204)a316aaa
chore(deps-dev): Bump@typescript-eslint/eslint-plugin
(#203)454c0de
chore(deps-dev): Bump@typescript-eslint/eslint-plugin
(#202)Updates
cssnano
from 4.1.11 to 5.1.13Release notes
Sourced from cssnano's releases.
... (truncated)
Commits
d6e3d82
Publish cssnano 5.1.13b92dbe3
FixcssnanoPlugin
type to return Processor not Plugin1b6e4ec
chore: downgrade uvu to check if Node.js tests pass8ee9287
chore: update development dependencies48f0397
chore: update TypeScript and re-generate types789474f
docs: update website dependencies335f532
chore: update prettier and reformat4a8f54a
Publish cssnano 5.1.120a3a133
fix(cssnano-preset-default): update css-declaration-sorter120a888
fix(postcss-merge-longhand): preserve hyphenated custom property caseDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
Bump yargs-parser from 5.0.0-security.0 to 5.0.1
Bumps yargs-parser from 5.0.0-security.0 to 5.0.1.
Changelog
Sourced from yargs-parser's changelog.
... (truncated)
Commits
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
Bump terser from 4.8.0 to 4.8.1
Bumps terser from 4.8.0 to 4.8.1.
Changelog
Sourced from terser's changelog.
Commits
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
django.urls.exceptions.NoReverseMatch: Reverse for 'cameramodel_add' not found.
I've started trying to reimplement a UI with django-material again from scratch. I'm running into an error and I've put quite a lot of time into trying to figure it out, but I can't make progress.
I assume
cameramodel_add
has the_add
suffix automatically added by theModelViewSet
, but somehow the autoloading isn't working?camerahub
models.py
isschema
ui
The
schema
app used to contain a bunch of views I wrote myself, but I have now deleted everything apart frommodels.py
and the migrations.Trying to browse to
http://127.0.0.1:8000/ui/cameramodel/
I getOriginally posted by @djjudas21 in https://github.com/viewflow/django-material/issues/513#issuecomment-1110268057