Snippet List
A simple helper function that clears the cache for a given URL, assuming no headers. Probably best used when wired up to a model's post_save event via signals. See [message to django-users mailing list](http://groups.google.com/group/django-users/msg/b077ec2e97697601) for background.
This manager is intended for use with models with publication and/or expiration dates. Objects will be retrieved only if their publication and/or expiration dates are within the current date.
Use is very simple:
class ExampleModel(models.Model):
publish_date = models.DateTimeField()
expire_date = models.DateTimeField(blank=True, null=True)
objects = models.Manager()
actives = ActiveManager(from_date='publish_date', to_date='expire_date')
ExampleModel.actives.all() # retrieve active objects according to the current date
The manager works correctly with nullable date fields. A null publication date means "*always published (until expiration date)*" and a null expiration date means "*never expires*".
Most models should define the `objects` manager as the default manager, because otherwise out of date objects won't appear in the admin app.
- model
- manager
- active
- publication
- expiration
- date-filter
2 snippets posted so far.