Snippet List
This is useful to run before you add a unique key to a character field that has duplicates in it. It just adds numbers to the end of the contents, so they will be unique.
It takes a model class and a field name. The model class can be a South fake orm object, so this can be used inside data migrations.
- rename
- duplicate
- south
- unique-key
Sometimes it is desirable to use values like the primary key when naming `FileField` and `ImageField` files, but such values are only available after saving the model instance. This abstract class implements a two-phase save in order to make this case easy. See the example in the docstring.
Another solution would be to write a `save()` that requires `upload_to` to be a callable that checks for `instance.pk`, then calls it again after saving. However, this would require more work from the developer for simple cases.
- imagefield
- filefield
- rename
- upload_to
3 snippets posted so far.