django-cruds is simple drop-in django app that creates CRUD for faster prototyping.
Project description
=============================
django-cruds
=============================
.. image:: https://travis-ci.org/bmihelac/django-cruds.png?branch=master
:target: https://travis-ci.org/bmihelac/django-cruds
.. image:: https://coveralls.io/repos/bmihelac/django-cruds/badge.png?branch=master
:target: https://coveralls.io/r/bmihelac/django-cruds?branch=master
.. image:: https://img.shields.io/pypi/v/django-cruds.svg
:target: https://crate.io/packages/django-cruds
django-cruds is simple drop-in django app that creates CRUD
(Create, read, update and delete) views for existing models and apps.
django-cruds goal is to make prototyping faster.
Documentation
-------------
To add CRUD for whole app, add this to urls.py::
from cruds.urls import crud_for_app
urlpatterns += crud_for_app('testapp')
This will create following urls and appropriate views (assuming
there is a application named ``testapp`` with model ``Author``:
===================================== =====================
URL name
===================================== =====================
/testapp/author/ testapp_author_list
/testapp/author/new/ testapp_author_create
/testapp/author/(?P<pk>\d+)/ testapp_author_detail
/testapp/author/(?P<pk>\d+)/edit/ testapp_author_update
/testapp/author/(?P<pk>\d+)/remove/ testapp_author_delete
===================================== =====================
It is also possible to add CRUD for one model::
from django.db.models.loading import get_model
from cruds.urls import crud_for_model
urlpatterns += crud_for_model(get_model('testapp', 'Author'))
``crud_fields`` templatetag displays fields for an object::
{% load crud_tags %}
<table class="table">
<tbody>
{% crud_fields object "name, description" %}
</tbody>
</table>
Customizable CRUD url patterns ``crud_urls``::
urlpatterns += crud_urls(
Author,
list_view=MyAuthorListView.as_view(),
activate=ActivateAuthorView.as_view(),
)
Use ``cruds.util.crud_url`` shortcut function to quickly get url for
instance for given action::
crud_url(author, 'update')
Is same as::
reverse('testapp_author_update', kwargs={'pk': author.pk})
``cruds.util.crud_url`` accepts Model class as well for list actions, ie:
crud_url(Author, 'list')
crud_url(Author, 'create')
``cruds.util.crud_permission_name`` returns permission name using Django
naming convention, ie: `testapp.change_author`.
Templates
^^^^^^^^^
django-cruds views will append CRUD template name to a list of default
candidate template names for given action.
CRUD Templates are::
cruds/create.html
cruds/delete.html
cruds/detail.html
cruds/list.html
cruds/update.html
Quickstart
----------
Install django-cruds::
pip install django-cruds
Then use it in a project, add ``cruds`` to ``INSTALLED_APPS``.
Requirements
------------
* Python 2.7+ or Python 3.4+
* Django >= 1.11
History
-------
1.0.0
+++++++++++++++++++
- feat: Customizable CRUD url patterns with crud_urls
- feat: crud_url fuction accepts model alongside with instances
- feat: add crud_permission_name function
- breaking: Django 1.11 and Django 2.0 compatibility
Remove < Django 1.11 support
- test coverage 100%
0.1.10 (2015-12-04)
+++++++++++++++++++
- Nothing changed yet.
0.1.9 (2015-12-04)
++++++++++++++++++
- Nothing changed yet.
0.1.8 (2014-12-08)
++++++++++++++++++
- ``format_value`` display FileField url
0.1.7 (2014-09-23)
++++++++++++++++++
- Add optional prefix to crud_url_name, crud_url functions.
0.1.6 (2014-08-21)
++++++++++++++++++
- ADD: cruds.util.crud_url function
0.1.5 (2014-07-01)
++++++++++++++++++
- ADD: get_fields assignment_tag
0.1.4 (2014-06-30)
++++++++++++++++++
- add human-readable name for the field’s with choices
0.1.3 (2014-06-30)
++++++++++++++++++
- append instead of prepending CRUD template name to a list of default
candidate template names
0.1.2 (2014-06-10)
++++++++++++++++++
- FIX: action url patterns should be in format /appname/model/3/edit/ and not
/appname/model/edit/3/
- add ``crud_fields`` templatetag
0.1.1 (2014-06-09)
++++++++++++++++++
- Handle and FK returns link to detail view if exists.
- fixes and tweaks
0.1.0 (2014-06-08)
++++++++++++++++++
* First release on PyPI.
django-cruds
=============================
.. image:: https://travis-ci.org/bmihelac/django-cruds.png?branch=master
:target: https://travis-ci.org/bmihelac/django-cruds
.. image:: https://coveralls.io/repos/bmihelac/django-cruds/badge.png?branch=master
:target: https://coveralls.io/r/bmihelac/django-cruds?branch=master
.. image:: https://img.shields.io/pypi/v/django-cruds.svg
:target: https://crate.io/packages/django-cruds
django-cruds is simple drop-in django app that creates CRUD
(Create, read, update and delete) views for existing models and apps.
django-cruds goal is to make prototyping faster.
Documentation
-------------
To add CRUD for whole app, add this to urls.py::
from cruds.urls import crud_for_app
urlpatterns += crud_for_app('testapp')
This will create following urls and appropriate views (assuming
there is a application named ``testapp`` with model ``Author``:
===================================== =====================
URL name
===================================== =====================
/testapp/author/ testapp_author_list
/testapp/author/new/ testapp_author_create
/testapp/author/(?P<pk>\d+)/ testapp_author_detail
/testapp/author/(?P<pk>\d+)/edit/ testapp_author_update
/testapp/author/(?P<pk>\d+)/remove/ testapp_author_delete
===================================== =====================
It is also possible to add CRUD for one model::
from django.db.models.loading import get_model
from cruds.urls import crud_for_model
urlpatterns += crud_for_model(get_model('testapp', 'Author'))
``crud_fields`` templatetag displays fields for an object::
{% load crud_tags %}
<table class="table">
<tbody>
{% crud_fields object "name, description" %}
</tbody>
</table>
Customizable CRUD url patterns ``crud_urls``::
urlpatterns += crud_urls(
Author,
list_view=MyAuthorListView.as_view(),
activate=ActivateAuthorView.as_view(),
)
Use ``cruds.util.crud_url`` shortcut function to quickly get url for
instance for given action::
crud_url(author, 'update')
Is same as::
reverse('testapp_author_update', kwargs={'pk': author.pk})
``cruds.util.crud_url`` accepts Model class as well for list actions, ie:
crud_url(Author, 'list')
crud_url(Author, 'create')
``cruds.util.crud_permission_name`` returns permission name using Django
naming convention, ie: `testapp.change_author`.
Templates
^^^^^^^^^
django-cruds views will append CRUD template name to a list of default
candidate template names for given action.
CRUD Templates are::
cruds/create.html
cruds/delete.html
cruds/detail.html
cruds/list.html
cruds/update.html
Quickstart
----------
Install django-cruds::
pip install django-cruds
Then use it in a project, add ``cruds`` to ``INSTALLED_APPS``.
Requirements
------------
* Python 2.7+ or Python 3.4+
* Django >= 1.11
History
-------
1.0.0
+++++++++++++++++++
- feat: Customizable CRUD url patterns with crud_urls
- feat: crud_url fuction accepts model alongside with instances
- feat: add crud_permission_name function
- breaking: Django 1.11 and Django 2.0 compatibility
Remove < Django 1.11 support
- test coverage 100%
0.1.10 (2015-12-04)
+++++++++++++++++++
- Nothing changed yet.
0.1.9 (2015-12-04)
++++++++++++++++++
- Nothing changed yet.
0.1.8 (2014-12-08)
++++++++++++++++++
- ``format_value`` display FileField url
0.1.7 (2014-09-23)
++++++++++++++++++
- Add optional prefix to crud_url_name, crud_url functions.
0.1.6 (2014-08-21)
++++++++++++++++++
- ADD: cruds.util.crud_url function
0.1.5 (2014-07-01)
++++++++++++++++++
- ADD: get_fields assignment_tag
0.1.4 (2014-06-30)
++++++++++++++++++
- add human-readable name for the field’s with choices
0.1.3 (2014-06-30)
++++++++++++++++++
- append instead of prepending CRUD template name to a list of default
candidate template names
0.1.2 (2014-06-10)
++++++++++++++++++
- FIX: action url patterns should be in format /appname/model/3/edit/ and not
/appname/model/edit/3/
- add ``crud_fields`` templatetag
0.1.1 (2014-06-09)
++++++++++++++++++
- Handle and FK returns link to detail view if exists.
- fixes and tweaks
0.1.0 (2014-06-08)
++++++++++++++++++
* First release on PyPI.
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
django-cruds-1.0.0.tar.gz
(11.6 kB
view hashes)