Metadata-Version: 2.4
Name: django_xprez
Version: 0.3.10
Summary: Django CMS for presentation websites
Home-page: https://github.com/s-cape/django_xprez
Author: Jakub Dolejšek, Martin Kappel, Michal Tilsch, Michal Májský - s-cape.cz & mimatik.com
Author-email: jakub.dolejsek@s-cape.cz
License: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: html5lib>=1.0b3
Requires-Dist: beautifulsoup4>=4.5.3
Requires-Dist: Pillow>=3.0.0
Requires-Dist: sorl-thumbnail
Requires-Dist: django>=3.1
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

[![PyPI version](https://badge.fury.io/py/django-xprez.svg)](https://badge.fury.io/py/django-xprez)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/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.
- **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:

```bash
pip install django-xprez
```


2. Add following apps to your settings.INSTALLED_APPS:

```python
INSTALLED_APPS = [
        ...
        'sorl.thumbnail',
        'xprez',
        ...
    ]
```

3. Run `python manage.py migrate` to create xprez models.


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

```python
TEMPLATES = [
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'django.template.context_processors.request',
                ...
            ]
        },
        ...
    ]
```

5. Include the xprez urls in your project urls.py like this:

```python
path('xprez/', include('xprez.urls')),
```

6. Create models:

```python
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
```

7. Register models in admin:

```python
from django.contrib import admin
from xprez.admin import XprezAdmin
from .models import Page

@admin.register(Page)
class PageAdmin(XprezAdmin):
    pass
```

8. Render page in template:

```django-html
{% load xprez %}
<link rel="stylesheet" href="{% url 'xprez:css_variables_global' %}">
{% xprez_front_media page %}
{% include 'xprez/container.html' with container=page %}
```

9. (optional) Add a custom module:

```python
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](xprez/modules/) source for more examples.

10. (optional) Change sorl thumbnail backend in settings — for seo-friendly thumbnail filenames:

```python
THUMBNAIL_BACKEND = 'xprez.contrib.sorl_thumbnail.thumbnail_backend.NamingThumbnailBackend'
```

---

For user documentation, see [docs/user/README.md](docs/user/README.md).

For an example, see the [example_app](example_app/) in this repository.

For development and contributing, see [docs/development.md](docs/development.md).
