Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:pstch/django-crucrudile into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
Hugo Geoffroy committed Apr 23, 2014
2 parents 9d1a874 + d6d600d commit 10804ac
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
7 changes: 6 additions & 1 deletion django_crucrudile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@
-- views.mixins : view mixins
-- urls : automatic URL patterns functions
-- utils : utility functions
"""

__title__ = 'django-crucrudile'
__version__ = '1.4.0'
__author__ = 'Hugo Geoffroy'
__license__ = 'GNU General Public License V3.0'
__copyright__ = 'Copyright 2013-2014 Hugo Geoffroy'
17 changes: 6 additions & 11 deletions docs/gettingstarted.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ Getting started
Getting ``django-crucrudile`` to automatically generate your URL
patterns is a 4-step process :

1. Define, or extend, your views
2. Define your model mixins
3. Use these model mixins in your models
4. Call automatic patterns functions in your urls.py

1. Views
--------

Expand Down Expand Up @@ -51,7 +46,7 @@ delete Django generic views (these views require an URL argument to
know which object it needs to handle), and use these views in
``make_model_mixin``.

Model mixins
2. Model mixins
------------

Once you defined your views (or the needed arguments on generic views) defining your model mixins is very
Expand All @@ -70,7 +65,7 @@ You now have ``Listable`` and ``Detailable`` defined, and they are

``make_model_mixin`` can also take other arguments, to define view-specific functions on your Model, or to set model-specific arguments to use when calling the view. Please see the :func:`django_crucrudile.models.mixins.make_model_mixin` documentation for more information.

Models
3. Models
------

Example::
Expand All @@ -82,21 +77,21 @@ Example::

Your ``Book`` now inherits functions from ``AutoPatternsMixin`` (the base class for model mixins), that you can use to get the model's URL patterns. See the :class:`django_crucrudile.models.mixins.AutoPatternsMixin` documentation for more information.

``urls.py``
4. ``urls.py``
-----------

To get the list of `url` objects for a specific Model (here ``Book``), you can use ``Book.get_url_patterns``, and use the return value of this function in your ``urls.py``::
To get the list of `url` objects for a specific Model (here ``Book``), you can use ``Book.get_url_patterns()``, and use the return value of this function in your ``urls.py``::

urlpatterns = [
Book.get_url_patterns(),
]

Or you could loop through your models, and append the URL patterns to ``urlpatterns`` :
Or you could loop through your models, and append the URL patterns to ``urlpatterns``::

model_list = Book, Author
urlpatterns = [model.get_url_patterns() for model in model_list]

Also, if you have lots of different Models that all use model mixins, you can use ``auto_patterns_for_app`` (from ``django_crucrudile.urls``, giving it an application name as argument, and it will gather all the URL patterns for all defined models in the application (here, ``'booklist'`` is the application name)::
Also, if you have lots of different Models that all use model mixins, you can use :func:`django_crucrudile.urls.auto_patterns_for_app`, giving it an application name as argument, and it will gather all the URL patterns for all defined models in the application (here, ``'booklist'`` is the application name)::

from django_crucrudile.urls import auto_patterns_for_app
urlpatterns = auto_patterns_for_app('booklist')
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

from setuptools import setup, find_packages

import django_crucrudile

setup(
name='django-crucrudile',
version='0.3',
version=django_crucrudile.__version__,

description='Model-defined CRUD views & patterns for Django',
long_description="views, models, auto URL patterns, ...",
Expand All @@ -28,6 +30,7 @@
'Intended Audience :: Developers',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
'Framework :: Django',
],
platforms=['any'],

Expand Down

0 comments on commit 10804ac

Please sign in to comment.