diff --git a/docs/configuration.rst b/docs/configuration.rst index e1dc3a80f5..c3d9bc8bca 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -21,6 +21,10 @@ each setting you want to define which takes four keyword arguments: * ``description``: The description of the setting. * ``editable``: If ``True``, the setting will be editable via the admin. * ``default``: The default value of the setting. + * ``choices``: A list of choices the user can select from when the + setting is editable. + * ``append``: If registering an existing setting, the default value + given will be appended to the current. .. note:: @@ -28,15 +32,15 @@ each setting you want to define which takes four keyword arguments: strings, integers/floats and boolean values are supported for the ``default`` value. -For example suppose we had a ``gallery`` application and we wanted to -create a setting that controls the number of photos displayed per page, -we would define the following in ``gallery.defaults``:: +For example suppose we had a ``authors`` application and we wanted to +create a setting that controls the number of books displayed per author +page, we would define the following in ``authors.defaults``:: from mezzanine.conf import register_setting register_setting( - name="GALLERY_PHOTOS_PER_PAGE", - description="The number of gallery photos to show on a single page.", + name="AUTHORS_BOOKS_PER_PAGE", + description="The number of books to show per author page.", editable=True, default=10, ) @@ -52,16 +56,14 @@ which when called will cause the settings object to reload editable settings from the database the next time an editable setting is accessed. Continuing on from our previous example, suppose we have a view for photos:: - from django.shortcuts import render_to_response - from django.template import RequestContext - + from django.shortcuts import render from mezzanine.conf import settings - from models import GalleryImage + from .models import Book - def gallery_view(request): + def books_view(request): settings.use_editable() - photos = GalleryImage.objects.all()[:settings.GALLERY_PHOTOS_PER_PAGE] - return render_to_response("gallery.html", {"photos": photos}, RequestContext(request)}) + books = Book.objects.all()[:settings.AUTHORS_BOOKS_PER_PAGE] + return render(request, "books.html", {"books": books}) When defining editable settings, care should be taken when considering where in your project the setting will be used. For example if a setting