Skip to main content

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

Project description

=============================
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::

import django_dynamic_views


```
pip install django-dynamic-views
```

Add django-dynamic-views to installed apps



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

models.py
---------

::

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

views.py
--------
::

class ArticleCRUDView(dynamicviews.DynamicCRUDView):
model = Article

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

django_dynamic_views-0.1.0-py2.py3-none-any.whl (17.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django_dynamic_views-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_dynamic_views-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6cf998a29bd0bac789c2e419676712875915b9a44d930e6a65d2cd1224a62fc4
MD5 00f129a7814ff07faf48ac845c49ea4c
BLAKE2b-256 775f4f404776af176187fcc902aea50e7ea6e03f6758bb3a38369aad8d37700b

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page