Login

Snippets by nipuL

Snippet List

Automatic Manager Choice Filters

Automatically adds filter methods to your objects manager based on their display name. class Foo(models.Model): MOO_CHOICES=((1,'foo'),(2,'bar')) moo = models.IntegerField(choices=MOO_CHOICES) objects = ChoiceFilterManager('moo',MOO_CHOICES) Foo.objects.foo() Foo.objects.bar()

  • managers
  • choices
Read More

Set test cookie unless logged in

This allows you to use a quick login forms outside of the django.contrib.auth.views.login view, the cookie will be deleted once you login.

  • middleware
  • cookie
  • login
Read More

Control FCGI processes through management

Add fcgi to settings.INSTALLED_APPS then you can start and stop FCGI through manage.py >python manage.py startfcgi >python manage.py stopfcgi In settings define runfcgi arguments using **FCGI_*** in settings For example: >FCGI_SOCKET='/var/tmp/project.sock' >FCGI_PIDFILE='/var/run/project.pid' One of **FCGI_SOCKET** or **FCGI_HOST**/**FCGI_PORT** will need to be defined, but if you forget they will error out. **FCGI_PIDFILE** is required to be defined to allow the process to be terminated.

  • management
  • fcgi
Read More

nipuL has posted 4 snippets.