Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baxeico/django-lazycrud
A little Django app to reduce boilerplate code at a minimum when you write class based views in a typical CRUD scenario.
https://github.com/baxeico/django-lazycrud
crud django
Last synced: 5 days ago
JSON representation
A little Django app to reduce boilerplate code at a minimum when you write class based views in a typical CRUD scenario.
- Host: GitHub
- URL: https://github.com/baxeico/django-lazycrud
- Owner: baxeico
- License: mit
- Created: 2017-05-09T13:02:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-24T16:48:55.000Z (22 days ago)
- Last Synced: 2024-10-25T23:53:34.175Z (21 days ago)
- Topics: crud, django
- Language: JavaScript
- Size: 315 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
django-lazycrud
===============A little Django app to reduce boilerplate code at a minimum when you write class based views in a typical CRUD scenario.
Django compatibility
--------------------The app is tested on Django 1.8 and 1.11.
Dependencies:
-------------The app depends on `django-crispy-forms `_ to generate forms and includes a static version of
`Datatables `_ and `Bootstrap Datepicker `_ to provide
client side enhancements to tables and forms.Install:
--------::
pip install django-lazycrud
Then add `lazycrud` and `crispy_forms` to your `INSTALLED_APPS` in Django settings.
Example:
---------Define your CRUD views with few lines of Python code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~No need to write any html code, let lazycrud handle all the templates for you.
::
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazyfrom .models import Model
class ModelListView(ListView):
model = Model
template_name = 'lazycrud/object_list.html'
page_title = 'My Model list'
fields = [ 'model_field1', 'model_field2', ]
create_url = reverse_lazy('yourapp:model_create')
create_label = 'Create new Model'class ModelDetailView(DetailView):
model = Model
template_name = 'lazycrud/object_detail.html'
fields = [ 'model_field1', 'model_field2', 'model_field3', ]
update_url = 'yourapp:model_update'
delete_url = 'yourapp:model_delete'class ModelCreateView(CreateView):
model = Model
template_name = 'lazycrud/object_form.html'
form_title = 'Create new Model'
fields = [ 'model_field1', 'model_field2', 'model_field3', ]class ModelUpdateView(UpdateView):
model = Model
template_name = 'lazycrud/object_form.html'
form_title = 'Edit Model'
fields = ModelCreateView.fieldsclass ModelDeleteView(DeleteView):
model = Model
template_name = 'lazycrud/object_confirm_delete.html'
success_url = reverse_lazy('yourapp:model_list')