Abstract model for extending custom models with an audit of when things were changed. By extension, allows us to use get_latest_by and get_next_by_FOO() if we want to.
Note
It transpires that this is basically an accidental rewrite of django-model-utils TimeStampedModel, though it provides a few extra bits.
a datetime representing the original date this object was saved. Represented as a DateTimeField.
Was this object created recently? Accepts a list of kwargs which are passed directly to timedelta; in the absence of any kwargs the timedelta is told 30 minutes is recent.
Returns: | whether or not this object was recently created |
---|---|
Return type: | boolean |
a datetime representing the last time this object was changed. Represented as a DateTimeField.
A perennial favourite, publish start and end dates, as an abstract model.
Has the same is_published attribute that Publishing has.
For querying, this should be combined with DatePublishingQuerySet.
For API compatibility with the alternate publishing model Publishing which uses a boolean property, this method is accessed the same way, and is decorated with property() for this reason.
Returns: | Whether or not this object is currently visible |
---|---|
Return type: | boolean |
Defaults to datetime.datetime.now() - the date on which this should be available on the site. Represented as a DateTimeField.
the datetime on which this should expire from the site. Represented as a DateTimeField.
For handling generic relations in a uniform way (assuming that only 1 is required on the subclassing model).
A virtual field which allows us to get the actual object, as and when we need it. Calling this will almost always result in a query.
The foreign key to Django‘s internal ContentType for a specific model. Doesn’t provide a related_name from ContentType back to the subclass implementing this model.
For when you don’t need date based publishing (using DatePublishing) this abstract model provides the same API.
For better results, this should be combined with PublishingQuerySet.
BooleanField deciding whether or not the object is available on the site. Defaults to False.
Abstract model for extending custom models with SEO fields
Attempts to maintain compatibility with django CMS, in terms of access methods, but not underlying objects (as django CMS has Title objects).
utility method for django CMS api compatibility
Returns: | the meta_description field’s value |
---|---|
Return type: | unicode string |
utility method for django CMS api compatibility
Returns: | the meta_description field’s value |
---|---|
Return type: | unicode string |
utility method for django CMS api compatibility
Returns: | the meta_title field’s value |
---|---|
Return type: | unicode string |
a CharField for storing the description sometimes used in Search Engines. Defined with a max_length of 255.
a CharField for storing a bunch of keywords. Not used by many (any?) Search engines now, but provided for historical completeness, and API compatibility with django CMS. Defined with a max_length of 255.
I’ve not actually used this yet. It’s just a sketch of something I’d like.
The idea is that nothing should ever really be deleted, but I have no idea how feasible this is at an abstract level.
Warning
This should not be relied on to prevent data loss, as it is very much an incomplete idea right now.
Instead of deleting this object, and all it’s related items, we hide remove it softly. This means that currently there will be a lot of pseudo-orphans, because I’ve not yet decided on how to handle them. They’re just hangers-on, really.
Parameters: | using – the db router to use. |
---|---|
Return type: | None |
Abstract model for providing a title + menu title field.
Also supplies a get_menu_title method, which falls back to the title if no menu title is set.
utility method for django CMS api compatibility
Returns: | the menu_title, or if not set, the title |
---|---|
Return type: | unicode string |
Optional CharField for an object, whose max_length is 255, and may be used to represent this object in menus.