Snippet List
**[Improved and Released as Save The Change.](https://github.com/karanlyons/django-save-the-change)**
Django 1.5 added the `update_fields` `kwarg` to `Model.save()`, which allows the developer to specify that only certain fields should actually be committed to the database. However, Django provides no way to automatically commit only changed fields if they're not specified.
This mixin keeps track of which fields have changed from their value in the database, and automatically applies `update_fields` to update only those fields.
- model
- save
- mixin
- class
- automatic
- update_fields
A management command to automatically generate a fully specified admin for the models in a specific app.
It automatically generates raw_id_fields, search_fields, list_filter and more. It bases this on date fields, fields named as "name" or slug.
Usage: ./manage admin_autogen <model>
- django
- scaffold
- auto
- django-admin
- automatic
- generation
- generate
A pre_save signal that will automatically generate a slug for your model based on the "title" attribute, and will store the new slug in the "slug" attribute.
USAGE:
from django.db.models.signals import pre_save
from YOURPACKAGE import slug_generator
pre_save.connect(slug_generator, sender=YOURMODEL)
5 snippets posted so far.