Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/patrys/django-scbv

Simple (and sane) class-based views for Django
https://github.com/patrys/django-scbv

Last synced: 20 days ago
JSON representation

Simple (and sane) class-based views for Django

Awesome Lists containing this project

README

        

h1. 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

h2. 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'))),
)