Skip to main content

Django CMS for presentation websites

Project description

PyPI version Code style: black

Django Xprez

A flexible Django CMS with built-in modules and easy custom modules.

The backend works well with Django admin but can also be used standalone.

Features

  • Structure
    • Containers — apply or extend in your own models (e.g. Page, Article).
    • Sections — rows with max-width, background (part of the structure).
    • Modules (content blocks)
      • Built-in: text, quote, gallery, files, video, numbers, code input, code template, anchor.
      • Custom: simply subclass Module in your app; they auto-register and appear in the same admin UI and frontend.
  • Responsive
    • Layout (visibility, columns, padding, margin, colspan) per breakpoint.
    • Responsive images (srcset, breakpoint-aware sizes).
  • Styles
    • Ready-made frontend CSS included.
    • Or import xprez SCSS into your build; link {% url 'xprez:css_variables_global' %} for breakpoint variables.
  • Clipboard and symlinks — Copy modules or sections; paste into another page or paste as symlink to reuse the same content.

Quick start

  1. Install django-xprez:
pip install django-xprez
  1. Add following apps to your settings.INSTALLED_APPS:
INSTALLED_APPS = [
        ...
        'sorl.thumbnail',
        'xprez',
        ...
    ]
  1. Run python manage.py migrate to create xprez models.

  2. Make sure request context processor is enabled in settings:

TEMPLATES = [
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'django.template.context_processors.request',
                ...
            ]
        },
        ...
    ]
  1. Include the xprez urls in your project urls.py like this:
path('xprez/', include('xprez.urls')),
  1. Create models:
from xprez.models import Container

class Page(Container):
    title = models.CharField(max_length=255)
    slug = models.SlugField(max_length=255, unique=True)

    def __str__(self):
        return self.title
  1. Register models in admin:
from django.contrib import admin
from xprez.admin import XprezAdmin
from .models import Page

@admin.register(Page)
class PageAdmin(XprezAdmin):
    pass
  1. Render page in template:
{% load xprez %}
<link rel="stylesheet" href="{% url 'xprez:css_variables_global' %}">
{% xprez_front_media page %}
{% include 'xprez/container.html' with container=page %}
  1. (optional) Add a custom module:
from xprez.models import Module

class MyModule(Module):
    title = models.CharField(max_length=200)
    count = models.PositiveIntegerField(default=0)
    is_featured = models.BooleanField(default=False)

    front_template_name = "myapp/modules/my.html"

    class Meta:
        verbose_name = "My module"

See the built-in modules source for more examples.

  1. (optional) Change sorl thumbnail backend in settings — for seo-friendly thumbnail filenames:
THUMBNAIL_BACKEND = 'xprez.contrib.sorl_thumbnail.thumbnail_backend.NamingThumbnailBackend'

For user documentation, see docs/user/README.md.

For an example, see the example_app in this repository.

For development and contributing, see docs/development.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_xprez-0.3.0.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_xprez-0.3.0-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

Details for the file django_xprez-0.3.0.tar.gz.

File metadata

  • Download URL: django_xprez-0.3.0.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for django_xprez-0.3.0.tar.gz
Algorithm Hash digest
SHA256 84ca3aa885126a729bbafcdaeacb480bf49ef2f566ac819e2d642587c6d4357e
MD5 321b3626d6a358387ea7370c54a35c10
BLAKE2b-256 99de0c1ef3873a8efc5e5b8130220ed53b96373172b9dcafb0fadecbba4c7d9d

See more details on using hashes here.

File details

Details for the file django_xprez-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: django_xprez-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for django_xprez-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfe0137a0611872612f8899b9ff4a980cdf21f6703ed228ce22e8901a6966523
MD5 d6fc25803a5ef6451feeb3515d5be10a
BLAKE2b-256 6c4024db0b4d041d250d8101c2f89405a73d422b892d0a400cd0c04a9881ff4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page