Skip to main content
=============================
django-dynamic-views
=============================

.. image:: https://badge.fury.io/py/django-dynamic-views.png
:target: https://badge.fury.io/py/django-dynamic-views

.. image:: https://travis-ci.org/ddaan/django-dynamic-views.png?branch=master
:target: https://travis-ci.org/ddaan/django-dynamic-views

Provides out of the box CRUD functionality including templates and gives you the ability to build your screen top-down.

Documentation
-------------

The full documentation is at https://django-dynamic-views.readthedocs.org.

Quickstart
----------

Install django-dynamic-views::

pip install django-dynamic-views

Then use it in a project::

from django_dynamic_views.views import DynamicListView, DynamicCRUDView, DynamicUpdateView, DynamicCreateView



Add django-dynamic-views to installed apps::

INSTALLED_APPS = (
...
'django_dynamic_views',
...
)



Example
=====================

Consider this simple model:

models.py

::

class Article(models.Model):
name = models.Charfield(max_length=200)
description = models.Charfield(max_length=200)

Define a Crud view by extending DynamicCRUDView and set the model as a attribute

views.py
::

class ArticleCRUDView(DynamicCRUDView):
model = Article

Now add the urls to your urlpatterns with one command

urls.py
::

urlpatterns += ArticleCRUDView.urls()

You'll point your browser to /article/list/ and a basic list with Create / Read / Update and Delete
buttons will be displayed.

So on the background it will create the following urls::

/article/list/
/article/create/
/article/(?P<pk>[-\w]+)/update/
/article/(?P<pk>[-\w]+)/read/
/article/(?P<pk>[-\w]+)/delete/

If you don't care for some of the urls you can modfiy the _links_ atribute on the CrudView::

class ArticleCRUDView(dynamicviews.DynamicCRUDView):
model = Article
links = ['list', 'read']

This will result in the following urls::

/article/list/
/article/(?P<pk>[-\w]+)/read/

So this will give you a basic list with a Read button next to it.

## Override the default classes
You can define which class the CRUD uses, so you can easily modify it's appearance and behaviour

::

class ArticleDetailView(DetailView):
template_name = 'articles/article_detail.html'


class ArticleCRUDView(dynamicviews.DynamicCRUDView):
model = Article
links = ['list', 'read']
read_class = ArticleDetail



Running Tests
--------------

Does the code actually work?

::

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements-test.txt
(myenv) $ python runtests.py

Credits
---------

Tools used in rendering this package:

* Cookiecutter_
* cookiecutter-pypackage_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _cookiecutter-djangopackage: https://github.com/pydanny/cookiecutter-djangopackage




History
-------

0.1.0 (2016-04-09)
++++++++++++++++++

* First release on PyPI.

Release files for django-dynamic-views 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for django-dynamic-views 0.1.1
File Interpreter ABI Platform
django_dynamic_views-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / django_dynamic_views-0.1.1-py2.py3-none-any.whl

Download URL django_dynamic_views-0.1.1-py2.py3-none-any.whl
Size 17.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
86f39a6149b0b9353eaf6580767c29d376e496f495832026e2b1827ccc8e4582
BLAKE2b-256 checksum
How to use checksums
9d109d31b54e42f07a61ac6108df62e53cc3f5712e700122b4cd14fed8d5a6d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page