blog.models

Classes

Category(*args, **kwargs) Represents a blog posts category
Post(*args, **kwargs) Represents a blog post
class blog.models.CategoryQuerySet(model=None, query=None, using=None, hints=None)[source]

Bases: django.db.models.query.QuerySet

Custom QuerySet for Categories

non_empty()[source]

Get Categories that have posts

ordered_by_post_count()[source]

Get the generator of Categories ordered by their post count

class blog.models.Category(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Represents a blog posts category

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

class blog.models.PostQuerySet(model=None, query=None, using=None, hints=None)[source]

Bases: django.db.models.query.QuerySet

Custom QuerySet for Posts

published()[source]

Get only published posts

featured()[source]

Get only published featured posts

class blog.models.Post(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Represents a blog post

save(*args, **kwargs)[source]

Saves the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned