Metadata-Version: 2.4
Name: django-simorgh
Version: 1.0.0
Summary: A beautiful, modern, fully redesigned Django admin template with RTL support, theming, and offline assets.
Author: Simorgh Contributors
License: MIT License
        
        Copyright (c) 2024 Simorgh Contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/username/django-simorgh
Project-URL: Repository, https://github.com/username/django-simorgh
Project-URL: Issues, https://github.com/username/django-simorgh/issues
Keywords: django,admin,template,theme,rtl,persian
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=4.0
Dynamic: license-file

# Django Simorgh

A beautiful, modern, fully redesigned Django admin interface.

Django Simorgh replaces the default Django admin UI with a complete custom design: dark sidebar, collapsible app groups, responsive tables, modern forms, RTL layout, 9 color themes, light/dark mode, and all assets bundled — no CDN required.

---

## Features

- **Sidebar navigation** with app groups and model sub-items
- **Top navbar** with user profile dropdown and dark mode toggle
- **Configurable icons** for apps and models (Font Awesome 6 Free)
- **9 color themes**: green, blue, red, yellow, black, purple, orange, pink, navy
- **Light and dark mode** — auto-detected from OS preference, toggle-able, persisted
- **RTL support** — layout direction follows Django's `LANGUAGE_BIDI`; the browser automatically applies Vazirmatn for Arabic/Persian text and Sniglet for Latin text via CSS `unicode-range`
- **Modern filters panel** — clean, compact, visually consistent with the theme
- **Responsive tables** with hover effects and row selection
- **Modern forms** with clean fieldsets and styled inputs
- **Fully offline** — Font Awesome, Vazirmatn, and Sniglet are bundled in the package
- **Configurable branding** — custom logo and favicon via settings
- **Production-ready** pip package

---

## Installation

```bash
pip install django-simorgh
```

---

## Django Configuration

### 1. Add to INSTALLED_APPS

`django_simorgh` must appear **before your project apps and before** `django.contrib.admin` so its custom model `Meta` options are registered before models are imported:

```python
INSTALLED_APPS = [
    "django_simorgh",          # ← MUST be before django.contrib.admin
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    # ... your apps
]
```

### 2. Add context processor

```python
TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",   # required
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
                "django_simorgh.context_processors.simorgh_context",  # ← add this
            ],
        },
    },
]
```

### 3. Collect static files

```bash
python manage.py collectstatic
```

That's it. All fonts and icons are bundled — no external CDN calls needed.

---

## Theme Color Configuration

```python
# settings.py
DJANGO_ADMIN_THEME_COLOR = "green"   # default
```

Available values: `green`, `blue`, `red`, `yellow`, `black`, `purple`, `orange`, `pink`, `navy`

---

## Branding, Logo, and Favicon Configuration

```python
DJANGO_ADMIN_SITE_HEADER = "My Admin Panel"   # default: "Simorgh Admin"
DJANGO_ADMIN_LOGO        = "path/to/logo.png"
DJANGO_ADMIN_FAVICON     = "path/to/favicon.ico"
```

If logo or favicon are not set, the bundled default assets are used automatically.

---

## Model Icon Configuration

### Option 1 — Model Meta (recommended)

```python
from django.db import models

class Product(models.Model):
    name = models.CharField(max_length=120)

    class Meta:
        simorgh_icon = "fa-solid fa-box"
        simorgh_app_icon = "fa-solid fa-store"
```

`simorgh_icon` controls the model icon. `simorgh_app_icon` can be defined on any model in the app and controls the sidebar app-group icon.

Because these are custom Django `Meta` options, keep `django_simorgh` before your own apps in `INSTALLED_APPS`.

### Option 2 — Per-ModelAdmin

```python
from django.contrib import admin
from .models import Product

@admin.register(Product)
class ProductAdmin(admin.ModelAdmin):
    icon = "fa-solid fa-box"   # any Font Awesome 6 Free class string
```

### Option 3 — Via settings

```python
DJANGO_ADMIN_ICONS = {
    "shop": {
        "_app_icon": "fa-solid fa-store",   # icon for the app group in the sidebar
        "Product":   "fa-solid fa-box",
        "Category":  "fa-solid fa-tag",
        "Order":     "fa-solid fa-receipt",
    },
    "auth": {
        "_app_icon": "fa-solid fa-shield-halved",
        "User":      "fa-solid fa-user",
        "Group":     "fa-solid fa-users",
    },
}
```

Keys: `app_label` (outer), `ModelName` / `_app_icon` (inner).

Resolution order:
1. Model `Meta.simorgh_icon`
2. `ModelAdmin.icon` attribute
3. `DJANGO_ADMIN_ICONS` settings dict
4. Built-in defaults for `auth`, `admin`, `contenttypes`, etc.
5. Generic fallback `fa-solid fa-circle-dot`

---

## Bundled Assets

All external assets are included in the package and served from your own static files after `collectstatic`. No CDN requests are made at runtime.

| Asset | License |
|---|---|
| Font Awesome 6 Free | SIL OFL 1.1 / MIT / CC BY 4.0 |
| Vazirmatn | SIL OFL 1.1 |
| Sniglet | SIL OFL 1.1 |

---

## RTL Support

Set `LANGUAGE_CODE` to a RTL language and Django's `LANGUAGE_BIDI` will be `True` automatically. The template uses this to set `dir="rtl"` on the `<html>` element, which flips the sidebar, navbar, and tables.

Font selection is handled entirely by CSS `unicode-range` — no settings needed:
- Latin/English characters → **Sniglet**
- Arabic/Persian characters → **Vazirmatn**

```python
LANGUAGE_CODE = "fa-ir"   # RTL layout + correct fonts — no extra config needed
```

---

## Screenshots

> _Screenshots will be added after first public release._

| Dashboard | Change List | Change Form |
|---|---|---|
| ![Dashboard]() | ![List]() | ![Form]() |

---

## Development Setup

```bash
git clone https://github.com/username/django-simorgh
cd django-simorgh
python -m venv .venv
source .venv/bin/activate
pip install django
```

Create a minimal test project:

```python
# testproject/settings.py
import sys, pathlib
sys.path.insert(0, str(pathlib.Path(__file__).parents[2]))

INSTALLED_APPS = [
    "django_simorgh",
    "django.contrib.admin",
    ...
]
```

---

## Build and Publish

```bash
pip install build twine

python -m build

twine upload --repository testpypi dist/*   # test first
twine upload dist/*                          # publish to PyPI
```

---

## License

MIT — see [LICENSE](LICENSE) for details.
