A little Django app to reduce boilerplate code at a minimum when you write class based views in a typical CRUD scenario.
Project description
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_lazy
from .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.fields
class ModelDeleteView(DeleteView):
model = Model
template_name = 'lazycrud/object_confirm_delete.html'
success_url = reverse_lazy('yourapp:model_list')
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_lazycrud-1.9.0.tar.gz.
File metadata
- Download URL: django_lazycrud-1.9.0.tar.gz
- Upload date:
- Size: 290.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4fd3064e6ba27851f330ba0e98f5792e3197e91058806e23053384e6fffb96c
|
|
| MD5 |
b9b2c0c022d812f021d7993fb941f6a7
|
|
| BLAKE2b-256 |
9b14e2f99f6f35570a8114f354623b791f08a2d43ce6de8a31874baf9ca799df
|
File details
Details for the file django_lazycrud-1.9.0-py3-none-any.whl.
File metadata
- Download URL: django_lazycrud-1.9.0-py3-none-any.whl
- Upload date:
- Size: 309.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a24e56da98b8d04f04a3e9baea5c138deeee1b46d1cd59d020d47900fad9577
|
|
| MD5 |
b23d61ebcc5336a5cbb28ff85b061f4c
|
|
| BLAKE2b-256 |
e35836b1ee84ee6b1fcab929b5ef0152a5253f924f6b61881fc54eb87b7ae9fd
|