=============================
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
------------
* Django>=3.2<=4.0
Raw data
{
"_id": null,
"home_page": "https://github.com/bmihelac/django-cruds",
"name": "django-cruds",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "django-cruds",
"author": "Bojan Mihelac",
"author_email": "bmihelac@mihelac.org",
"download_url": "https://files.pythonhosted.org/packages/6b/ae/d3eca8195cea6494a493946097537a6958ac5030ba5d6df86c78fd96511a/django_cruds-3.0.0.tar.gz",
"platform": null,
"description": "=============================\ndjango-cruds\n=============================\n\n.. image:: https://travis-ci.org/bmihelac/django-cruds.png?branch=master\n :target: https://travis-ci.org/bmihelac/django-cruds\n\n.. image:: https://coveralls.io/repos/bmihelac/django-cruds/badge.png?branch=master\n :target: https://coveralls.io/r/bmihelac/django-cruds?branch=master\n\n.. image:: https://img.shields.io/pypi/v/django-cruds.svg \n :target: https://crate.io/packages/django-cruds\n\ndjango-cruds is simple drop-in django app that creates CRUD\n(Create, read, update and delete) views for existing models and apps.\n\ndjango-cruds goal is to make prototyping faster.\n\nDocumentation\n-------------\n\nTo add CRUD for whole app, add this to urls.py::\n\n from cruds.urls import crud_for_app\n urlpatterns += crud_for_app('testapp')\n\nThis will create following urls and appropriate views (assuming \nthere is a application named ``testapp`` with model ``Author``:\n\n===================================== =====================\nURL name\n===================================== =====================\n/testapp/author/ testapp_author_list\n/testapp/author/new/ testapp_author_create\n/testapp/author/(?P<pk>\\d+)/ testapp_author_detail\n/testapp/author/(?P<pk>\\d+)/edit/ testapp_author_update\n/testapp/author/(?P<pk>\\d+)/remove/ testapp_author_delete\n===================================== =====================\n\nIt is also possible to add CRUD for one model::\n\n from django.db.models.loading import get_model\n from cruds.urls import crud_for_model\n urlpatterns += crud_for_model(get_model('testapp', 'Author'))\n\n``crud_fields`` templatetag displays fields for an object::\n\n {% load crud_tags %}\n\n <table class=\"table\">\n <tbody>\n {% crud_fields object \"name, description\" %}\n </tbody>\n </table>\n\nCustomizable CRUD url patterns ``crud_urls``::\n\n urlpatterns += crud_urls(\n Author, \n list_view=MyAuthorListView.as_view(),\n activate=ActivateAuthorView.as_view(),\n )\n\nUse ``cruds.util.crud_url`` shortcut function to quickly get url for\ninstance for given action::\n\n crud_url(author, 'update')\n\nIs same as::\n\n reverse('testapp_author_update', kwargs={'pk': author.pk})\n\n``cruds.util.crud_url`` accepts Model class as well for list actions, ie:\n\n crud_url(Author, 'list')\n crud_url(Author, 'create')\n\n``cruds.util.crud_permission_name`` returns permission name using Django \nnaming convention, ie: `testapp.change_author`.\n\nTemplates\n^^^^^^^^^\n\ndjango-cruds views will append CRUD template name to a list of default\ncandidate template names for given action.\n\nCRUD Templates are::\n\n cruds/create.html\n cruds/delete.html\n cruds/detail.html\n cruds/list.html\n cruds/update.html\n\nQuickstart\n----------\n\nInstall django-cruds::\n\n pip install django-cruds\n\nThen use it in a project, add ``cruds`` to ``INSTALLED_APPS``.\n\nRequirements\n------------\n\n* Django>=3.2<=4.0\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "django-cruds is simple drop-in django app that creates CRUD for faster prototyping.",
"version": "3.0.0",
"project_urls": {
"Homepage": "https://github.com/bmihelac/django-cruds"
},
"split_keywords": [
"django-cruds"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e3a8fbcb4345f10697c504e07e3af9287953830ea4dad3932abe0950144d3226",
"md5": "ac325f5668a5beab6930c1cf9d13dbd4",
"sha256": "f46cb61ad2ee1bb90be274868056d376ee237f179b6537d6c8f4a17c3f426e37"
},
"downloads": -1,
"filename": "django_cruds-3.0.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "ac325f5668a5beab6930c1cf9d13dbd4",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 11633,
"upload_time": "2024-06-24T18:02:14",
"upload_time_iso_8601": "2024-06-24T18:02:14.961842Z",
"url": "https://files.pythonhosted.org/packages/e3/a8/fbcb4345f10697c504e07e3af9287953830ea4dad3932abe0950144d3226/django_cruds-3.0.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6baed3eca8195cea6494a493946097537a6958ac5030ba5d6df86c78fd96511a",
"md5": "20623114fb4fb438354ff450e67385ca",
"sha256": "9df7d093566c15c6e5c0992ae75cd628fd741251dac4fd672a10f12e12f24dd7"
},
"downloads": -1,
"filename": "django_cruds-3.0.0.tar.gz",
"has_sig": false,
"md5_digest": "20623114fb4fb438354ff450e67385ca",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13596,
"upload_time": "2024-06-24T18:02:16",
"upload_time_iso_8601": "2024-06-24T18:02:16.817255Z",
"url": "https://files.pythonhosted.org/packages/6b/ae/d3eca8195cea6494a493946097537a6958ac5030ba5d6df86c78fd96511a/django_cruds-3.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-24 18:02:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bmihelac",
"github_project": "django-cruds",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "Django",
"specs": [
[
">=",
"4"
],
[
"<",
"5"
]
]
},
{
"name": "wheel",
"specs": [
[
"==",
"0.23.0"
]
]
}
],
"tox": true,
"lcname": "django-cruds"
}