All Projects → asifpy → Django Crudbuilder

asifpy / Django Crudbuilder

Licence: apache-2.0
Generic CRUD implementation in Django

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Django Crudbuilder

Django Material
Material Design for Django
Stars: ✭ 2,362 (+1563.38%)
Mutual labels:  django, crud
Django Material Admin
Material design for django administration
Stars: ✭ 163 (+14.79%)
Mutual labels:  django, crud
Django Bootstrap3
Bootstrap 3 integration with Django.
Stars: ✭ 2,271 (+1499.3%)
Mutual labels:  django, bootstrap3
Django Bootstrap Modal Forms
A Django plugin for creating AJAX driven forms in Bootstrap modal.
Stars: ✭ 244 (+71.83%)
Mutual labels:  django, bootstrap3
Django Easy Audit
Yet another Django audit log app, hopefully the simplest one.
Stars: ✭ 289 (+103.52%)
Mutual labels:  django, crud
Django Auth0 Vue
A Django REST Framework + Vue.js CRUD Demo Secured Using Auth0
Stars: ✭ 99 (-30.28%)
Mutual labels:  django, crud
Flight Ticket Booksystem
大三下数据库课设 - 机票预订系统 - Django
Stars: ✭ 55 (-61.27%)
Mutual labels:  django, bootstrap3
Django Jinja Knockout
Django datatables and widgets, both AJAX and traditional. Display-only ModelForms. ModelForms / inline formsets with AJAX submit and validation. Works with Django templates.
Stars: ✭ 116 (-18.31%)
Mutual labels:  django, bootstrap3
Django Echarts
A django app for Echarts integration using pyecharts library as chart builder.
Stars: ✭ 138 (-2.82%)
Mutual labels:  django
Vaadin On Kotlin
Writing full-stack statically-typed web apps on JVM at its simplest
Stars: ✭ 141 (-0.7%)
Mutual labels:  crud
Freedombox
Easy to manage, privacy oriented home server. Read-only mirror of https://salsa.debian.org/freedombox-team/freedombox
Stars: ✭ 137 (-3.52%)
Mutual labels:  django
Django Starter Template
A project template for Django 2.0 that follows best practices.
Stars: ✭ 138 (-2.82%)
Mutual labels:  django
Django Intro Zh
Django 官方文档的 intro 部分的中文翻译
Stars: ✭ 141 (-0.7%)
Mutual labels:  django
Django Scopes
Safely separate multiple tenants in a Django database
Stars: ✭ 138 (-2.82%)
Mutual labels:  django
Django React Typescript
A boilerplate with Django on the backend, React on the frontend, and much more!
Stars: ✭ 142 (+0%)
Mutual labels:  django
Bootstrap
基于bootstrap3搭建的页面结构
Stars: ✭ 137 (-3.52%)
Mutual labels:  bootstrap3
Djangoweb
基于Django的运维平台
Stars: ✭ 137 (-3.52%)
Mutual labels:  django
Django Treenode
probably the best abstract model / admin for your tree based stuff. 🌳
Stars: ✭ 142 (+0%)
Mutual labels:  django
Django Amazon Price Monitor
Monitors prices of Amazon products via Product Advertising API
Stars: ✭ 141 (-0.7%)
Mutual labels:  django
Owasp Mth3l3m3nt Framework
OWASP Mth3l3m3nt Framework is a penetration testing aiding tool and exploitation framework. It fosters a principle of attack the web using the web as well as pentest on the go through its responsive interface.
Stars: ✭ 139 (-2.11%)
Mutual labels:  crud

|Build|_ |CodeHealth|_ |coverage|_ |pypi|_ |CodeQuality|_

.. |Build| image:: https://travis-ci.org/asifpy/django-crudbuilder.svg?branch=master .. _Build: https://travis-ci.org/asifpy/django-crudbuilder

.. |CodeHealth| image:: https://landscape.io/github/asifpy/django-crudbuilder/master/landscape.svg?style=flat .. _CodeHealth: https://landscape.io/github/asifpy/django-crudbuilder/master

.. |pypi| image:: https://img.shields.io/pypi/v/django-crudbuilder.svg .. _pypi: https://pypi.python.org/pypi/django-crudbuilder

.. |CodeQuality| image:: https://scrutinizer-ci.com/g/asifpy/django-crudbuilder/badges/build.png?b=master .. _CodeQuality: https://scrutinizer-ci.com/g/asifpy/django-crudbuilder/?branch=master

.. |coverage| image:: https://coveralls.io/repos/github/asifpy/django-crudbuilder/badge.svg?branch=master .. _coverage: https://coveralls.io/github/asifpy/django-crudbuilder?branch=master

================== django-crudbuilder

Generic CRUD implementation in Django which uses django tables2 to list objects.

Documentation

https://django-crudbuilder.readthedocs.org/en/latest/index.html

Features:

  • Generates class based views for CRUD
  • Uses django-tables2 to display objects in ListView
  • Define multiple crud builders for same model with separate URL
  • Allows custom forms/tables as additional arguments
  • Context provides additional template variables APP_LABEL and MODEL for all CRUD templates
  • Enable/disable login required option for CRUD views
  • Enable/disable permission required option for CRUD views
  • All the generated views/tables/forms/url are extendable.
  • post_create and post_update signals to handle specific actions in Create and Update views
  • Add your own custom templates for List/Create/Detail/Update/Delete views
  • Separate CREATE and UPDATE forms
  • Define your own custom queryset for list view
  • Inline Formset support for parent child models
  • Default Bootstrap3 CSS
  • All the generated views are extendable.

Prerequisites

  • Django 1.10+
  • Python 2.7+, 3.3+
  • Django Tables2 < 2.0

Installation

.. code-block:: python

pip install django-crudbuilder

Usage

Add "crudbuilder" to INSTALLED_APPS

.. code-block:: python

INSTALLED_APPS = {
	...
	'django_tables2',
	'crudbuilder'
}

LOGIN_REQUIRED_FOR_CRUD = True/False
PERMISSION_REQUIRED_FOR_CRUD = True/False
PROJECT_NAME = 'YOUR PROJECT NAME'

Create models in yourapp/models.py

.. code-block:: python

class Person(models.Model):
	""" an actual singular human being """
	name = models.CharField(blank=True, max_length=100)
	email = models.EmailField()
	created_at = models.DateTimeField(auto_now=True)
	created_by = models.ForeignKey(User, blank=True, null=True)

	def __unicode__(self):
		return self.name

Create CRUD for Person model in yourapp/crud.py

.. code-block:: python

from crudbuilder.abstract import BaseCrudBuilder
from yourapp.models import Person

class PersonCrud(BaseCrudBuilder):
	model = Person
	search_fields = ['name']
	tables2_fields = ('name', 'email')
	tables2_css_class = "table table-bordered table-condensed"
	tables2_pagination = 20  # default is 10
	modelform_excludes = ['created_by', 'updated_by']
	login_required=True
	permission_required=True
	# permissions = {
	#   'list': 'example.person_list',
	#	'create': 'example.person_create'
	# }

Open yourapp/urls.py and add the following

.. code-block:: python

from crudbuilder import urls

urlpatterns = [
	url(r'^admin/', include(admin.site.urls)),
	url(r'^crud/',  include(urls)),
]

View All your registered CRUDS

.. code-block:: python

http://127.0.0.1:8000/crud/

Now you can access the below CRUD URLS

.. code-block:: python

- http://127.0.0.1:8000/crud/yourappname/yourmodelname
- http://127.0.0.1:8000/crud/yourappname/yourmodelname/create/
- http://127.0.0.1:8000/crud/yourappname/yourmodelname/<pk>/detail/
- http://127.0.0.1:8000/crud/yourappname/yourmodelname/<pk>/update/
- http://127.0.0.1:8000/crud/yourappname/yourmodelname/<pk>/delete/

LOGIN REQUIRED

To enable global login required for all the models CRUD views, add the following to settings file

.. code-block:: python

LOGIN_REQUIRED_FOR_CRUD = True

If you want to enable login required only for specific model crud, then you need to add following to crud class

.. code-block:: python
	
	# myapp/crud.py
	login_required = True

PERMISSION REQUIRED

To enable global permission required for all the models CRUD views, add the following to settings file

.. code-block:: python

PERMISSION_REQUIRED_FOR_CRUD = True

If you want to enable permission required only for specific model crud, then you need to add following to crud class

.. code-block:: python
	
	# myapp/crud.py
	permission_required = True

By enabling either of above flag, crudbuilder by default checks for following permissions:

.. code-block:: python

- For ListView   : <your app_name>.<your model>_list
- For CreateView : <your app_name>.<your model>_create
- For DetailView : <your app_name>.<your model>_detail
- For UpdateView : <your app_name>.<your model>_update
- For DeleteView : <your app_name>.<your model>_delete

If you want to add your own permissions, then define your own permission required dictionary explicitly in CRUD class.

.. code-block:: python

permissions = {
	'list'  : 'example.permission1',
	'create': 'example.permission2'
	'detail': 'example.permission3',
	'update': 'example.permission4',
	'delete': 'example.permission5',
	}

EXTRA TEMPLATE VARIABLES

Added mixin which allows access to additional template variables like app lable and model name in every template.

.. code-block:: python

APP : {{app_label}}
MODEL : {{actual_model_name}}
PLURIZED MODEL : {{pluralized_model_name}}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].