or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

admin-forms.mdcms-integration.mdconfiguration.mdfeeds-sitemaps.mdindex.mdmodels.mdtemplates-utilities.mdviews.md
tile.json

tessl/pypi-djangocms-blog

The blog application for django CMS providing multilingual blog functionality with advanced content management features

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/djangocms-blog@2.0.x

To install, run

npx @tessl/cli install tessl/pypi-djangocms-blog@2.0.0

index.mddocs/

Django CMS Blog

A comprehensive blog application for django CMS providing multilingual blog functionality with advanced content management features. The package enables creation of complex blog websites with placeholder content editing, multilingual support, social media integration, and extensive customization options.

Package Information

  • Package Name: djangocms-blog
  • Language: Python
  • Installation: pip install djangocms-blog

Core Imports

from djangocms_blog.models import Post, BlogCategory
from djangocms_blog.views import PostDetailView, PostListView
from djangocms_blog.admin import PostAdmin, BlogCategoryAdmin
from djangocms_blog.cms_apps import BlogApp
from djangocms_blog.cms_appconfig import BlogConfig

Basic Usage

# Basic post creation and retrieval
from djangocms_blog.models import Post, BlogCategory
from django.contrib.auth import get_user_model
from django.utils import timezone

User = get_user_model()

# Create a blog category
category = BlogCategory.objects.create()
category.set_current_language('en')
category.name = 'Technology'
category.slug = 'technology'
category.save()

# Create a blog post  
post = Post.objects.create(
    author=User.objects.get(pk=1),
    app_config=BlogConfig.objects.first(),
    date_published=timezone.now(),
    enable_comments=True
)
post.set_current_language('en')
post.title = 'My First Blog Post'
post.slug = 'my-first-blog-post'
post.abstract = 'This is the post abstract'
post.meta_description = 'SEO description for the post'
post.save()

# Add the post to category
post.categories.add(category)

# Query published posts
published_posts = Post.objects.published()
recent_posts = Post.objects.published()[:5]

Architecture

Django CMS Blog integrates deeply with django CMS's architecture and extends it with blog-specific functionality:

  • Models: Core data models (Post, BlogCategory) with multilingual support via django-parler
  • Views: Class-based views for post display, lists, archives, and filtering
  • CMS Integration: Full CMS app, plugins, menus, wizards, and toolbar integration
  • Admin Interface: Advanced admin with placeholder editing and frontend editing support
  • Configuration: Per-apphook configuration system for multi-site blog setups
  • Template System: Flexible template organization with custom template tags
  • SEO Features: Built-in meta tag support, sitemaps, and RSS feeds

The package follows django CMS patterns for extensibility and provides hooks for customization across all components.

Capabilities

Core Models and Data Management

Primary data models for blog posts and categories with full multilingual support, meta tag integration, and relationship management.

class Post(KnockerModel, BlogMetaMixin, TranslatableModel):
    """Main blog post model with multilingual and meta support."""
    
    # Key properties
    is_published: bool
    guid: str
    date: datetime
    liveblog_group: str
    
    # Key methods
    def get_absolute_url(self, lang: Optional[str] = None) -> str: ...
    def get_title(self) -> str: ...
    def get_description(self) -> str: ...
    def get_keywords(self) -> List[str]: ...
    def get_tags(self) -> str: ...
    def get_author(self) -> Optional[AbstractUser]: ...
    
    # Manager methods
    objects: GenericDateTaggedManager
    # Post.objects.published(current_site=True)
    # Post.objects.archived(current_site=True)
    # Post.objects.tagged(other_model=None, queryset=None)
    
class BlogCategory(BlogMetaMixin, TranslatableModel):
    """Blog category model with multilingual support."""
    
    # Key properties
    linked_posts: QuerySet
    count: int
    count_all_sites: int
    
    # Key methods
    def get_absolute_url(self, lang: Optional[str] = None) -> str: ...
    def descendants(self) -> List['BlogCategory']: ...
    def get_title(self) -> str: ...
    def get_description(self) -> str: ...

Models and Data Management

View Classes and URL Handling

Complete set of class-based views for displaying blog content including detail views, list views, archive views, and filtered views.

class PostDetailView(TranslatableSlugMixin, BaseBlogView, DetailView): ...
class PostListView(BaseBlogListView, ListView): ...
class PostArchiveView(BaseBlogListView, ListView): ...
class TaggedListView(BaseBlogListView, ListView): ...
class AuthorEntriesView(BaseBlogListView, ListView): ...
class CategoryEntriesView(BaseBlogListView, ListView): ...

Views and URL Handling

CMS Integration and Plugins

Full django CMS integration including CMS app configuration, plugins for embedding blog content, wizards for content creation, and toolbar integration.

class BlogApp(AutoCMSAppMixin, CMSConfigApp): ...
class BlogLatestEntriesPlugin(BlogPlugin): ...
class BlogFeaturedPostsPlugin(BlogPlugin): ...
class BlogAuthorPostsPlugin(BlogPlugin): ...
class PostWizard(Wizard): ...

CMS Integration

Admin Interface and Forms

Advanced admin interface with placeholder editing, frontend editing, and comprehensive form handling for posts, categories, and configuration.

class PostAdmin(PlaceholderAdminMixin, FrontendEditableAdminMixin, ModelAppHookConfig, TranslatableAdmin): ...
class BlogCategoryAdmin(ModelAppHookConfig, TranslatableAdmin): ...
class PostAdminForm(PostAdminFormBase): ...

Admin and Forms

Configuration and Settings

Per-apphook configuration system enabling multiple blog instances with different settings, plus global settings management.

class BlogConfig(TranslatableModel, AppHookConfig): ...
class BlogConfigForm(AppDataForm): ...
def get_setting(name: str): ...

Configuration

Template Tags and Utilities

Template tags for extracting media content from posts, utility functions, and helper classes for template integration.

@register.simple_tag(name="media_plugins", takes_context=True)
def media_plugins(context: Dict[str, Any], post: Post) -> List[CMSPlugin]: ...

@register.simple_tag(name="media_images", takes_context=True)  
def media_images(context: Dict[str, Any], post: Post, main: bool = True) -> List[str]: ...

def slugify(base: str) -> str: ...

# Manager utilities
class GenericDateTaggedManager(TaggedFilterItem, AppHookConfigTranslatableManager):
    def published(self, current_site: bool = True) -> QuerySet: ...
    def archived(self, current_site: bool = True) -> QuerySet: ...
    def tagged(self, other_model: Optional[models.Model] = None, queryset: Optional[QuerySet] = None) -> QuerySet: ...

Template Tags and Utilities

RSS Feeds and Sitemaps

Automated RSS feed generation and sitemap integration for SEO optimization.

class LatestEntriesFeed(Feed):
    """RSS feed for latest blog entries."""
    def items(self, obj: BlogConfig) -> QuerySet: ...
    def item_title(self, item: Post) -> str: ...
    def item_description(self, item: Post) -> str: ...
    def item_link(self, item: Post) -> str: ...

class TagFeed(LatestEntriesFeed):
    """RSS feed for posts filtered by specific tag."""
    def get_object(self, request: HttpRequest, tag: str) -> Dict[str, Any]: ...
    def items(self, obj: Dict[str, Any]) -> QuerySet: ...

class FBInstantArticles(LatestEntriesFeed):
    """Facebook Instant Articles feed with custom XML format."""
    content_type: str = 'application/rss+xml; charset=utf-8'

class BlogSitemap(Sitemap):
    """Sitemap generator for blog posts."""
    def items(self) -> List[Post]: ...
    def location(self, obj: Post) -> str: ...
    def lastmod(self, obj: Post) -> datetime: ...

Feeds and Sitemaps

Types

# Common type aliases and imports
from typing import Optional, List, Dict, Any, Union
from datetime import datetime
from django.db import models
from django.db.models import QuerySet
from django.contrib.auth.models import AbstractUser
from django.contrib.syndication.views import Feed
from django.contrib.sitemaps import Sitemap
from django.http import HttpRequest, HttpResponse
from django.forms import ModelForm
from django.template import Library, register
from cms.models import PlaceholderField, CMSPlugin
from cms.toolbar_base import CMSToolbar
from cms.wizards.wizard_base import Wizard
from parler.models import TranslatableModel
from djangocms_blog.models import Post, BlogCategory
from djangocms_blog.cms_appconfig import BlogConfig
from djangocms_blog.managers import GenericDateTaggedManager, TaggedFilterItem