django-articleappkit 0.3 documentation

Model Reference

ArticleBase

class ArticleBase

This is the core model and basis for all management. It includes the basic fields.

title

Required CharField(255)

The title or headline of the item.

subtitle

CharField(255)

An optional subtitle or subheadline for the item.

slug

Required SlugField

URL-friendly title. It is automatically generated from the title.

summary

TextField

Is this item active. If it is inactive, all children are set to inactive as well.

content

Required TextField

The primary content of the item. The “article” of ArticleBase.

Attribution Mixins

SingleAuthorMixin

class SingleAuthorMixin

A mixin that adds a relation to another model (typically auth.User)

author

ForeignKey ( django.contrib.auth.models.User )

The model to which this field relates is set in AUTHOR_MODEL. The default is auth.User. You can limit the choices available using the authormodellimit_setting setting.

In your custom Admin class, you may want to include this field in raw_id_fields to reduce load time.

MutliAuthorMixin

class MultiAuthorMixin

A mixin that adds a many-to-many relation to another model (typically auth.User)

author

ManyToManyField ( django.contrib.auth.models.User )

The model to which this field relates is set in AUTHOR_MODEL. The default is auth.User. You can limit the choices available using the authormodellimit_setting setting.

NonStaffAuthorMixin

class NonStaffAuthorMixin

A mixin that adds a character field to set a one-time or non-staff author

author

CharField(200)

An HTML-formatted rendering of an author or authors not on staff.

Key Image Mixins

KeyImageMixin

class KeyImageMixin

A mixin that allows author’s to upload a file to their article. Manages the height and width in fields and provides for a credit to the media’s author as well.

key_image

ModelUploadFileField

A custom Django FileField that uses the name of the model as the default upload_to location. IMAGE_STORAGE allows for customization of the storage engine and IMAGE_UPLOAD_TO allows customization of the upload_to path.

key_image_width

IntegerField

A private field for keeping track of the key image’s width. This field is auto-populated when the record is saved.

key_image_height

IntegerField

A private field for keeping track of the key image’s height. This field is auto-populated when the record is saved.

key_image_credit

CharField(255)

An optional field to store an attribution for the key image, if necessary

Publishing Mixins

Publishing Mixins provide for a workflow, even if it is as simple as “Draft->Finished”. With a workflow, only one state is viewable on the site.

PubWorkflowMixin

This mixin provides for a simple, linear workflow using a choice list. Four settings define crucial aspects to the workflow:

  • STATUS_CHOICES is the tuple of (int, 'choice') that defines the key, value pairings.
  • DEFAULT_STATUS is the key for the status choice when you first create an article.
  • PUBLISHED_STATUS is the key for the status meaning it is live on the site.
  • UNPUBLISHED_STATUS is the key to use when “unpublishing” an item.
class PubWorkflowMixin
status

Required IntegerField

The current state of the article.

pub_date

DateField

The date in which the article was or will be published. The date and time are separated to provide support for uniqueness by date published. A datetime value will allow multiple articles with the same slug on the same date, since the published times will likely be different.

pub_time

TimeField

The time in which the article was or will be published.

published

boolean property

The published property allows the workflow to act like a boolean. It returns True if the article’s PubWorkflowMixin.status equals the PUBLISHED_STATUS.

If you set this attribute to True, it updates its PubWorkflowMixin.pub_date and PubWorkflowMixin.pub_time and the PubWorkflowMixin.status to PUBLISHED_STATUS.

If you set this attribute to False, it updates its PubWorkflowMixin.status to UNPUBLISHED_STATUS.

objects

PubWorkflowManager

A subclass of Manager that adds a PubWorkflowManager.published() method.

class PubWorkflowManager

A subclass of Django’s default model manager that adds shortcut functions to get published content

published()

Returns a QuerySet of all published content as of the date and time first called.

Return type:QuerySet