Simple (and sane) class-based views for Django
Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
scbv
LICENSE
README.textile
setup.py

README.textile

Simple (and sane) class-based views for Django

What this packages provides can be described as class-based views done right.

  • No assigning to self outside of __init__.
  • No mixins within mixins within mixins.
  • App-like handlers for common tasks

Usage example

# models.py

class Parrot(models.Model):
    name = models.CharField(max_length=20)
# views.py

from scbv import views

from . import models

class ParrotHandler(views.ModelHandler):
    model = models.Parrot
    success_url_create = 'parrot-created'
    success_url_update = 'parrot-updated'
    success_url_delete = 'parrot-deleted'
# urls.py

from django.conf.urls.defaults import patterns, include, url

from . import views

urlpatterns = patterns('',
    url(r'^parrot/', include(views.ParrotHandler().get_urls(prefix='parrot-form'))),
)