Skip to main content

Library to provide a predicate dispatch for Django's generic views.

Project description

Library to provide a predicate dispatch for Django’s generic views.

Requirements

  • Python 2.7 or later (not support 3.x)
  • Django 1.4 or later

Features

Using this, You can create views call method in considering of value returned by predicate. For example folloing view calls method in considering of request parameter:

class PonyView(PredicateProcessView):
    dispatch_config = (
                          ('get_corn_1', (RequestParamPredicate('corn=1'),)),
                          ('get_corn', (RequestParamPredicate('corn'),)),
                      )
    def get_corn(self, request, *args, **kwargs):
        return HttpResponse('pony with some corn')

    def get_corn_1(self, request, *args, **kwargs):
        return HttpResponse('pony with unicorn')

    def get_default(self, request, *args, **kwargs):
        return HttpResponse('pony')

In this case, It used:

  • beautifulpredicates.views.PredicateProcessView
  • beautifulpredicates.predicates.RequestParamPredicate

History

0.0.1 (2012-01-13)

  • first release

Project details


Download files

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

Files for django-beautifulpredicates, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size django_beautifulpredicates-0.0.1-py2.7.egg (8.2 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size django-beautifulpredicates-0.0.1.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page