django-unfold-extra


Namedjango-unfold-extra JSON
Version 0.1.9 PyPI version JSON
download
home_pageNone
SummaryUnofficial extra for Django Unfold Admin. Supports django-parler and django-cms.
upload_time2025-11-08 22:21:24
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords admin django django cms tailwind theme unfold
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django Unfold Extra

Unofficial extension for Django Unfold Admin. Adds support for django-parler and django-cms to the modern and
clean [Django Unfold](https://github.com/unfoldadmin/django-unfold) admin interface.

## Overview

Django Unfold Extra enhances the beautiful Django Unfold admin interface (v.0.66.0) with additional functionality for:

- **django-cms**: Integration with Django CMS 5.0 - Uses unfold admin colors for django cms
- **django-parler**: Multilingual support for your Django models
- **versatile-image**: Improved integration with django-versatileimagefield, including preview and ppoi
- **Unfold auto-update**: Styles can be automatically updaten from official unfold package via npm
- **Theme-Sync**: Use either Unfold or Django CMS switcher to control themes. You can run both at the same time, with or without both controls enabled.

![img.png](docs/img/cms-pagetree.png)
![img.png](docs/img/parler-tabs.png)

This package maintains the clean, modern aesthetic of Django Unfold while adding specialized interfaces for these
popular Django packages.

It uses unobtrusive template and CSS-styling overrides where possible. As Django CMS uses many '!important' flags, 
pagetree.css had to be rebuilt from sources to remove some conflicting style definitions.

> **Note:** Django CMS support is not fully tested, but all features should work, beside filer. 

## Installation

1. Install the package via pip:
   ```bash
   pip install django-unfold-extra
   ```

2. Add to your INSTALLED_APPS in settings.py:

```python
INSTALLED_APPS = [
   # Unfold theme
   'unfold',
   'unfold_extra',
   'unfold_extra.contrib.cms',  # if extra packages
   'unfold_extra.contrib.parler',
   'unfold_extra.contrib.auth'  # you likely want to use your own implementation
   'unfold_extra.contrib.sites'

   # Your apps
   # ...
]
```

Make sure you've set up Django Unfold according to its documentation.
https://github.com/unfoldadmin/django-unfold

Add the following to your settings.py:

```python
from django.templatetags.static import static

UNFOLD = {
    "STYLES": [
        lambda request: static("unfold_extra/css/styles.css"), # additional styles for 3rd party packages
    ],
    "SCRIPTS": [
        lambda request: static("unfold_extra/js/theme-sync.js"), # switch django cms theme from "Unfold Admin"
    ],
}
CMS_COLOR_SCHEME_TOGGLE = False # disable django cms theme switch -> use Unfold admin theme switch or disable Unfold theme switch via styles, no config option yet.
```

Add `{% unfold_extra_styles %}` and `{% unfold_extra_theme_receiver %}`  from `unfold_extra_tags` to your base HTML template. 
- Enables unfold admin colors in django cms
- theme switch from unfold admin to change theme in djangs cms (light/dark/auto)

```html
{% load static cms_tags sekizai_tags unfold_extra_tags%}
<!DOCTYPE html>
<html>
    <head>
        <title>{% block title %}{% endblock title %}</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        {% render_block "css" %}
        {% unfold_extra_styles %}
        {% unfold_extra_theme_sync %}
        ...
    </head>
...
</html>
```

## Usage

### django-parler Support

- UnfoldTranslatableAdminMixin
- UnfoldTranslatableStackedAdminMixin
- UnfoldTranslatableTabularAdminMixin
- TranslatableStackedInline, TranslatableTabularInline

#### Example use:

```python
class TranslatableAdmin(UnfoldTranslatableAdminMixin, BaseTranslatableAdmin):
   """custom translatable admin implementation"""

   # ... your code


class MyInlineAdmin(TranslatableStackedInline):
   model = MyModel
   tab = True  # Unfold inline settings
   extra = 0  # django inline settings
```

### django-cms Support

- Theme integration in django admin (partial support in frontend)
- Pagetree
- PageUser, PageUserGroup, GlobalPagePermission
- Versioning
- Modal support
- Not supported: Filer

Support is automatically applied. Currently, it does not support customization besides compiling your own unfold_extra
styles.

#### Frontend django CMS support

Add `unfold_extra_tags` to your base HTML template to after loading all CSS styles. 
This adds additional styles to integrate django CMS with Unfold Admin and includes `"COLORS"` from unfold settings to 
the public website for authenticated django-cms admin users.

```html
{% load cms_tags sekizai_tags unfold_extra_tags%}
<head>
   ...
   {% render_block "css" %}
   {% unfold_extra_styles %}
   ...
</head>
```

#### Custom compilation via npm/pnpm (see src/package.json)

```json
{
	"name": "django-unfold-extra",
	"description": "Enhancing Django Unfold to support additional packages",
	"scripts": {
		"update:unfold-deps": "curl -s https://raw.githubusercontent.com/unfoldadmin/django-unfold/main/package.json | jq -r '[\"tailwindcss@\" + .dependencies.tailwindcss, \"@tailwindcss/typography@\" + .devDependencies[\"@tailwindcss/typography\"]] | join(\" \")' | xargs npm install --save-dev",
		"update:unfold-css": "curl -o css/styles.css https://raw.githubusercontent.com/unfoldadmin/django-unfold/main/src/unfold/styles.css",
		"update:unfold": "npm run update:unfold-deps && npm run update:unfold-css",
		"tailwind:build": "npx @tailwindcss/cli -i css/unfold_extra.css -o ../static/unfold_extra/css/styles.css --minify",
		"tailwind:watch": "npx @tailwindcss/cli -i css/unfold_extra.css -o ../static/unfold_extra/css/styles.css --watch --minify"
	},
	"devDependencies": {
		"@tailwindcss/cli": "^4.1.7",
		"@tailwindcss/typography": "^0.5.19",
		"tailwindcss": "^4.1.13"
	}
}
```

#### Change colors for Django CMS

You can change the colors for django CMS by editing `css/unfold_extra.css` or just update the unfold colors via settings.py.

1. Fetch the latest Unfold version using `update:unfold-deps` and `update:unfold-css`
2. Update config `update:unfold`
3. Add changes `tailwind:watch` and `tailwind:build

```css
html:root {
   --dca-light-mode: 1;
   --dca-dark-mode: 0;
   --dca-white: theme('colors.white');
   --dca-black: theme('colors.black');
   --dca-shadow: theme('colors.base.950');
   --dca-primary: theme('colors.primary.600');
   --dca-gray: theme('colors.base.500');
   --dca-gray-lightest: theme('colors.base.100');
   --dca-gray-lighter: theme('colors.base.200');
   --dca-gray-light: theme('colors.base.400');
   --dca-gray-darker: theme('colors.base.700');
   --dca-gray-darkest: theme('colors.base.800');
   --dca-gray-super-lightest: theme('colors.base.50');

   --active-brightness: 0.9;
   --focus-brightness: 0.95;
}


html.dark {
   --dca-light-mode: 0;
   --dca-dark-mode: 1;
   --dca-white: theme('colors.base.900');
   --dca-black: theme('colors.white');
   --dca-primary: theme('colors.primary.500');
   --dca-gray: theme('colors.base.300') !important;
   --dca-gray-lightest: theme('colors.base.700');
   --dca-gray-lighter: theme('colors.base.600');
   --dca-gray-light: theme('colors.base.400');
   --dca-gray-darker: theme('colors.base.200');
   --dca-gray-darkest: theme('colors.base.100');
   --dca-gray-super-lightest: theme('colors.base.800');

   --active-brightness: 2;
   --focus-brightness: 1.5;
}
```


### Versatile Image Support

- Improved unfold integration via CSS only.

### Django Auth, Sites

- Add Unfolds standard settings to `django.contrib.auth`,`django.contrib.sites`.

This is for personal use. You likely want to customize this. 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-unfold-extra",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "admin, django, django cms, tailwind, theme, unfold",
    "author": null,
    "author_email": "Marc Widmer <marc@koga.cx>",
    "download_url": "https://files.pythonhosted.org/packages/d4/70/a535509e064ef945b0c325dcee3d99d71a55875314593bbc1a4a1115b746/django_unfold_extra-0.1.9.tar.gz",
    "platform": null,
    "description": "# Django Unfold Extra\n\nUnofficial extension for Django Unfold Admin. Adds support for django-parler and django-cms to the modern and\nclean [Django Unfold](https://github.com/unfoldadmin/django-unfold) admin interface.\n\n## Overview\n\nDjango Unfold Extra enhances the beautiful Django Unfold admin interface (v.0.66.0) with additional functionality for:\n\n- **django-cms**: Integration with Django CMS 5.0 - Uses unfold admin colors for django cms\n- **django-parler**: Multilingual support for your Django models\n- **versatile-image**: Improved integration with django-versatileimagefield, including preview and ppoi\n- **Unfold auto-update**: Styles can be automatically updaten from official unfold package via npm\n- **Theme-Sync**: Use either Unfold or Django CMS switcher to control themes. You can run both at the same time, with or without both controls enabled.\n\n![img.png](docs/img/cms-pagetree.png)\n![img.png](docs/img/parler-tabs.png)\n\nThis package maintains the clean, modern aesthetic of Django Unfold while adding specialized interfaces for these\npopular Django packages.\n\nIt uses unobtrusive template and CSS-styling overrides where possible. As Django CMS uses many '!important' flags, \npagetree.css had to be rebuilt from sources to remove some conflicting style definitions.\n\n> **Note:** Django CMS support is not fully tested, but all features should work, beside filer. \n\n## Installation\n\n1. Install the package via pip:\n   ```bash\n   pip install django-unfold-extra\n   ```\n\n2. Add to your INSTALLED_APPS in settings.py:\n\n```python\nINSTALLED_APPS = [\n   # Unfold theme\n   'unfold',\n   'unfold_extra',\n   'unfold_extra.contrib.cms',  # if extra packages\n   'unfold_extra.contrib.parler',\n   'unfold_extra.contrib.auth'  # you likely want to use your own implementation\n   'unfold_extra.contrib.sites'\n\n   # Your apps\n   # ...\n]\n```\n\nMake sure you've set up Django Unfold according to its documentation.\nhttps://github.com/unfoldadmin/django-unfold\n\nAdd the following to your settings.py:\n\n```python\nfrom django.templatetags.static import static\n\nUNFOLD = {\n    \"STYLES\": [\n        lambda request: static(\"unfold_extra/css/styles.css\"), # additional styles for 3rd party packages\n    ],\n    \"SCRIPTS\": [\n        lambda request: static(\"unfold_extra/js/theme-sync.js\"), # switch django cms theme from \"Unfold Admin\"\n    ],\n}\nCMS_COLOR_SCHEME_TOGGLE = False # disable django cms theme switch -> use Unfold admin theme switch or disable Unfold theme switch via styles, no config option yet.\n```\n\nAdd `{% unfold_extra_styles %}` and `{% unfold_extra_theme_receiver %}`  from `unfold_extra_tags` to your base HTML template. \n- Enables unfold admin colors in django cms\n- theme switch from unfold admin to change theme in djangs cms (light/dark/auto)\n\n```html\n{% load static cms_tags sekizai_tags unfold_extra_tags%}\n<!DOCTYPE html>\n<html>\n    <head>\n        <title>{% block title %}{% endblock title %}</title>\n        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n        {% render_block \"css\" %}\n        {% unfold_extra_styles %}\n        {% unfold_extra_theme_sync %}\n        ...\n    </head>\n...\n</html>\n```\n\n## Usage\n\n### django-parler Support\n\n- UnfoldTranslatableAdminMixin\n- UnfoldTranslatableStackedAdminMixin\n- UnfoldTranslatableTabularAdminMixin\n- TranslatableStackedInline, TranslatableTabularInline\n\n#### Example use:\n\n```python\nclass TranslatableAdmin(UnfoldTranslatableAdminMixin, BaseTranslatableAdmin):\n   \"\"\"custom translatable admin implementation\"\"\"\n\n   # ... your code\n\n\nclass MyInlineAdmin(TranslatableStackedInline):\n   model = MyModel\n   tab = True  # Unfold inline settings\n   extra = 0  # django inline settings\n```\n\n### django-cms Support\n\n- Theme integration in django admin (partial support in frontend)\n- Pagetree\n- PageUser, PageUserGroup, GlobalPagePermission\n- Versioning\n- Modal support\n- Not supported: Filer\n\nSupport is automatically applied. Currently, it does not support customization besides compiling your own unfold_extra\nstyles.\n\n#### Frontend django CMS support\n\nAdd `unfold_extra_tags` to your base HTML template to after loading all CSS styles. \nThis adds additional styles to integrate django CMS with Unfold Admin and includes `\"COLORS\"` from unfold settings to \nthe public website for authenticated django-cms admin users.\n\n```html\n{% load cms_tags sekizai_tags unfold_extra_tags%}\n<head>\n   ...\n   {% render_block \"css\" %}\n   {% unfold_extra_styles %}\n   ...\n</head>\n```\n\n#### Custom compilation via npm/pnpm (see src/package.json)\n\n```json\n{\n\t\"name\": \"django-unfold-extra\",\n\t\"description\": \"Enhancing Django Unfold to support additional packages\",\n\t\"scripts\": {\n\t\t\"update:unfold-deps\": \"curl -s https://raw.githubusercontent.com/unfoldadmin/django-unfold/main/package.json | jq -r '[\\\"tailwindcss@\\\" + .dependencies.tailwindcss, \\\"@tailwindcss/typography@\\\" + .devDependencies[\\\"@tailwindcss/typography\\\"]] | join(\\\" \\\")' | xargs npm install --save-dev\",\n\t\t\"update:unfold-css\": \"curl -o css/styles.css https://raw.githubusercontent.com/unfoldadmin/django-unfold/main/src/unfold/styles.css\",\n\t\t\"update:unfold\": \"npm run update:unfold-deps && npm run update:unfold-css\",\n\t\t\"tailwind:build\": \"npx @tailwindcss/cli -i css/unfold_extra.css -o ../static/unfold_extra/css/styles.css --minify\",\n\t\t\"tailwind:watch\": \"npx @tailwindcss/cli -i css/unfold_extra.css -o ../static/unfold_extra/css/styles.css --watch --minify\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@tailwindcss/cli\": \"^4.1.7\",\n\t\t\"@tailwindcss/typography\": \"^0.5.19\",\n\t\t\"tailwindcss\": \"^4.1.13\"\n\t}\n}\n```\n\n#### Change colors for Django CMS\n\nYou can change the colors for django CMS by editing `css/unfold_extra.css` or just update the unfold colors via settings.py.\n\n1. Fetch the latest Unfold version using `update:unfold-deps` and `update:unfold-css`\n2. Update config `update:unfold`\n3. Add changes `tailwind:watch` and `tailwind:build\n\n```css\nhtml:root {\n   --dca-light-mode: 1;\n   --dca-dark-mode: 0;\n   --dca-white: theme('colors.white');\n   --dca-black: theme('colors.black');\n   --dca-shadow: theme('colors.base.950');\n   --dca-primary: theme('colors.primary.600');\n   --dca-gray: theme('colors.base.500');\n   --dca-gray-lightest: theme('colors.base.100');\n   --dca-gray-lighter: theme('colors.base.200');\n   --dca-gray-light: theme('colors.base.400');\n   --dca-gray-darker: theme('colors.base.700');\n   --dca-gray-darkest: theme('colors.base.800');\n   --dca-gray-super-lightest: theme('colors.base.50');\n\n   --active-brightness: 0.9;\n   --focus-brightness: 0.95;\n}\n\n\nhtml.dark {\n   --dca-light-mode: 0;\n   --dca-dark-mode: 1;\n   --dca-white: theme('colors.base.900');\n   --dca-black: theme('colors.white');\n   --dca-primary: theme('colors.primary.500');\n   --dca-gray: theme('colors.base.300') !important;\n   --dca-gray-lightest: theme('colors.base.700');\n   --dca-gray-lighter: theme('colors.base.600');\n   --dca-gray-light: theme('colors.base.400');\n   --dca-gray-darker: theme('colors.base.200');\n   --dca-gray-darkest: theme('colors.base.100');\n   --dca-gray-super-lightest: theme('colors.base.800');\n\n   --active-brightness: 2;\n   --focus-brightness: 1.5;\n}\n```\n\n\n### Versatile Image Support\n\n- Improved unfold integration via CSS only.\n\n### Django Auth, Sites\n\n- Add Unfolds standard settings to `django.contrib.auth`,`django.contrib.sites`.\n\nThis is for personal use. You likely want to customize this. \n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Unofficial extra for Django Unfold Admin. Supports django-parler and django-cms.",
    "version": "0.1.9",
    "project_urls": {
        "Homepage": "https://github.com/metaforx/django-unfold-extra"
    },
    "split_keywords": [
        "admin",
        " django",
        " django cms",
        " tailwind",
        " theme",
        " unfold"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1eb94c974a68cbbce09d297c387682309f30a05fdf4f6fc11ab05b6ccfba7132",
                "md5": "48e924dd7b4abdd558635479dafe31ee",
                "sha256": "ca5a3df00ff84f00923bbc3f3676918c1b61786c1040d2f88cfa920b4f75d3f0"
            },
            "downloads": -1,
            "filename": "django_unfold_extra-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "48e924dd7b4abdd558635479dafe31ee",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 326161,
            "upload_time": "2025-11-08T22:21:22",
            "upload_time_iso_8601": "2025-11-08T22:21:22.742854Z",
            "url": "https://files.pythonhosted.org/packages/1e/b9/4c974a68cbbce09d297c387682309f30a05fdf4f6fc11ab05b6ccfba7132/django_unfold_extra-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d470a535509e064ef945b0c325dcee3d99d71a55875314593bbc1a4a1115b746",
                "md5": "c3c0bfcd87b9e0ff262478a91ee3df36",
                "sha256": "f3ce98da3f53a6c77613f07fa1b2d37ae2a9fce3926cff249eca64e3d6b33b8a"
            },
            "downloads": -1,
            "filename": "django_unfold_extra-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "c3c0bfcd87b9e0ff262478a91ee3df36",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 312953,
            "upload_time": "2025-11-08T22:21:24",
            "upload_time_iso_8601": "2025-11-08T22:21:24.069815Z",
            "url": "https://files.pythonhosted.org/packages/d4/70/a535509e064ef945b0c325dcee3d99d71a55875314593bbc1a4a1115b746/django_unfold_extra-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-08 22:21:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "metaforx",
    "github_project": "django-unfold-extra",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-unfold-extra"
}
        
Elapsed time: 2.43131s