django-admindigo 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_admindigo-0.1.0/.gitignore +29 -0
- django_admindigo-0.1.0/CHANGELOG.md +25 -0
- django_admindigo-0.1.0/LICENSE +21 -0
- django_admindigo-0.1.0/PKG-INFO +195 -0
- django_admindigo-0.1.0/README.md +160 -0
- django_admindigo-0.1.0/pyproject.toml +58 -0
- django_admindigo-0.1.0/src/admindigo/__init__.py +3 -0
- django_admindigo-0.1.0/src/admindigo/apps.py +22 -0
- django_admindigo-0.1.0/src/admindigo/static/admindigo/css/admindigo-admin.css +110 -0
- django_admindigo-0.1.0/src/admindigo/static/admindigo/img/logo.svg +5 -0
- django_admindigo-0.1.0/src/admindigo/templates/admin/base_site.html +16 -0
- django_admindigo-0.1.0/src/admindigo/templatetags/__init__.py +0 -0
- django_admindigo-0.1.0/src/admindigo/templatetags/admindigo.py +23 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
|
|
7
|
+
# Builds
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
|
|
11
|
+
# Venvs
|
|
12
|
+
.venv/
|
|
13
|
+
venv/
|
|
14
|
+
env/
|
|
15
|
+
|
|
16
|
+
# Testes / cobertura
|
|
17
|
+
.pytest_cache/
|
|
18
|
+
.tox/
|
|
19
|
+
.coverage
|
|
20
|
+
htmlcov/
|
|
21
|
+
|
|
22
|
+
# Ferramentas
|
|
23
|
+
.ruff_cache/
|
|
24
|
+
.mypy_cache/
|
|
25
|
+
|
|
26
|
+
# IDE / SO
|
|
27
|
+
.vscode/
|
|
28
|
+
.idea/
|
|
29
|
+
.DS_Store
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Todas as mudanças relevantes deste projeto são documentadas aqui.
|
|
4
|
+
|
|
5
|
+
O formato segue [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/)
|
|
6
|
+
e o projeto adota [Versionamento Semântico](https://semver.org/lang/pt-BR/).
|
|
7
|
+
|
|
8
|
+
## [Não lançado]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-06-15
|
|
11
|
+
|
|
12
|
+
### Adicionado
|
|
13
|
+
- Tema índigo simples para o Django Admin: paleta navy/azul (`#002133` /
|
|
14
|
+
`#00314D`, acento `#1B5589`) aplicada a cabeçalho, breadcrumbs, botões,
|
|
15
|
+
títulos e links.
|
|
16
|
+
- Linha fina vermelha fixa no topo, como alerta de que se está no Admin.
|
|
17
|
+
- Override de `admin/base_site.html` com a marca e um logo padrão neutro.
|
|
18
|
+
- Template tag `{% admindigo_logo %}` e setting `ADMINDIGO_LOGO` para trocar o
|
|
19
|
+
logo.
|
|
20
|
+
- Settings `ADMINDIGO_SITE_HEADER`, `ADMINDIGO_SITE_TITLE` e
|
|
21
|
+
`ADMINDIGO_INDEX_TITLE`.
|
|
22
|
+
- Suporte aos temas claro e escuro do admin via CSS custom properties.
|
|
23
|
+
|
|
24
|
+
[Não lançado]: https://github.com/LisandroGuerra/django-admindigo/compare/v0.1.0...HEAD
|
|
25
|
+
[0.1.0]: https://github.com/LisandroGuerra/django-admindigo/releases/tag/v0.1.0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lisandro Guerra
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: django-admindigo
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tema índigo simples para o Django Admin: paleta navy/azul + linha de alerta de Admin.
|
|
5
|
+
Project-URL: Homepage, https://github.com/LisandroGuerra/django-admindigo
|
|
6
|
+
Project-URL: Repository, https://github.com/LisandroGuerra/django-admindigo
|
|
7
|
+
Project-URL: Issues, https://github.com/LisandroGuerra/django-admindigo/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/LisandroGuerra/django-admindigo/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: Lisandro Guerra <lisandro.digital@gmail.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: admin,blue,django,indigo,theme
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Web Environment
|
|
15
|
+
Classifier: Framework :: Django
|
|
16
|
+
Classifier: Framework :: Django :: 4.2
|
|
17
|
+
Classifier: Framework :: Django :: 5.0
|
|
18
|
+
Classifier: Framework :: Django :: 5.1
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
28
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Requires-Dist: django>=4.2
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: pytest-django>=4.8; extra == 'test'
|
|
33
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# django-admindigo
|
|
37
|
+
|
|
38
|
+
[](https://github.com/LisandroGuerra/django-admindigo/actions/workflows/ci.yml)
|
|
39
|
+
[](https://pypi.org/project/django-admindigo/)
|
|
40
|
+
[](https://pypi.org/project/django-admindigo/)
|
|
41
|
+
[](https://www.djangoproject.com/)
|
|
42
|
+
[](LICENSE)
|
|
43
|
+
|
|
44
|
+
Tema **índigo simples** para o Django Admin, empacotado como app reutilizável.
|
|
45
|
+
Aplica uma identidade visual azul/navy (`#002133` / `#00314D`, acento `#1B5589`)
|
|
46
|
+
ao admin e adiciona uma **linha fina vermelha fixa no topo**, alertando que você
|
|
47
|
+
está no ambiente administrativo.
|
|
48
|
+
|
|
49
|
+
- 🎨 Cabeçalho, breadcrumbs, botões, títulos e links na paleta índigo.
|
|
50
|
+
- 🛡️ Linha de alerta vermelha persistente no topo (você está no Admin!).
|
|
51
|
+
- 🏷️ Logo padrão neutro na marca do admin (substituível).
|
|
52
|
+
- 🌓 Funciona nos temas claro e escuro do admin do Django.
|
|
53
|
+
- ⚙️ Zero código: configurável apenas por `settings`.
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
> Dashboard do admin com o tema aplicado e o branding padrão (`Administração`).
|
|
58
|
+
> O texto é configurável via `ADMINDIGO_SITE_HEADER`.
|
|
59
|
+
|
|
60
|
+
## Requisitos
|
|
61
|
+
|
|
62
|
+
- Python ≥ 3.10
|
|
63
|
+
- Django ≥ 4.2
|
|
64
|
+
|
|
65
|
+
## Instalação
|
|
66
|
+
|
|
67
|
+
### 1. Instale o pacote
|
|
68
|
+
|
|
69
|
+
**Via PyPI:**
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
pip install django-admindigo
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Direto do GitHub** (última versão da branch `main`):
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
pip install "git+https://github.com/LisandroGuerra/django-admindigo.git"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**De uma tag/versão específica:**
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
pip install "git+https://github.com/LisandroGuerra/django-admindigo.git@v0.1.0"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Local, para desenvolvimento** (modo editável):
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
git clone https://github.com/LisandroGuerra/django-admindigo.git
|
|
91
|
+
pip install -e ./django-admindigo
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Em `pyproject.toml` (uv / PEP 621):
|
|
95
|
+
|
|
96
|
+
```toml
|
|
97
|
+
dependencies = ["django-admindigo"]
|
|
98
|
+
|
|
99
|
+
# durante o desenvolvimento, apontando para um diretório local:
|
|
100
|
+
[tool.uv.sources]
|
|
101
|
+
django-admindigo = { path = "../django-admindigo" }
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 2. Registre o app **antes** de `django.contrib.admin`
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
# settings.py
|
|
108
|
+
INSTALLED_APPS = [
|
|
109
|
+
"admindigo", # <-- OBRIGATÓRIO: antes do admin
|
|
110
|
+
"django.contrib.admin",
|
|
111
|
+
"django.contrib.auth",
|
|
112
|
+
"django.contrib.contenttypes",
|
|
113
|
+
"django.contrib.sessions",
|
|
114
|
+
"django.contrib.messages",
|
|
115
|
+
"django.contrib.staticfiles",
|
|
116
|
+
# seus apps...
|
|
117
|
+
]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
> Por que antes? O tema sobrescreve `admin/base_site.html`. Com o loader
|
|
121
|
+
> `APP_DIRS=True`, o Django procura templates na ordem do `INSTALLED_APPS`, então
|
|
122
|
+
> o `admindigo` precisa aparecer antes do admin para ter prioridade.
|
|
123
|
+
|
|
124
|
+
### 3. Garanta o serviço de arquivos estáticos
|
|
125
|
+
|
|
126
|
+
`django.contrib.staticfiles` deve estar no `INSTALLED_APPS` e `STATIC_URL`
|
|
127
|
+
definido. **Em produção**, rode `collectstatic` e sirva os estáticos por um
|
|
128
|
+
servidor real (ex.: [WhiteNoise](https://whitenoise.readthedocs.io/) ou nginx):
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
python manage.py collectstatic --noinput
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Pronto. Acesse `/admin/`.
|
|
135
|
+
|
|
136
|
+
## Configuração
|
|
137
|
+
|
|
138
|
+
Tudo via `settings.py` — sem escrever templates:
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
ADMINDIGO_SITE_HEADER = "Meu Sistema · Administração" # marca no topo + <title>
|
|
142
|
+
ADMINDIGO_SITE_TITLE = "Meu Sistema Admin" # <title> da aba
|
|
143
|
+
ADMINDIGO_INDEX_TITLE = "Painel" # título do dashboard
|
|
144
|
+
ADMINDIGO_LOGO = "minhaapp/img/logo.svg" # caminho em static/ ou URL
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
| Setting | Padrão | Descrição |
|
|
148
|
+
|---|---|---|
|
|
149
|
+
| `ADMINDIGO_SITE_HEADER` | `"Administração"` | Texto da marca + título |
|
|
150
|
+
| `ADMINDIGO_SITE_TITLE` | `"Admin"` | `<title>` das páginas |
|
|
151
|
+
| `ADMINDIGO_INDEX_TITLE` | `"Painel administrativo"` | Título do dashboard |
|
|
152
|
+
| `ADMINDIGO_LOGO` | logo neutro embutido | Caminho em `static/` **ou** URL absoluta / iniciada por `/` |
|
|
153
|
+
|
|
154
|
+
> Um `admin.py` do projeto que defina `admin.site.site_header` tem prioridade
|
|
155
|
+
> sobre `ADMINDIGO_SITE_HEADER` (o tema só preenche o padrão).
|
|
156
|
+
|
|
157
|
+
### Personalizar as cores
|
|
158
|
+
|
|
159
|
+
As cores vêm de CSS custom properties. Para ajustar, carregue um CSS próprio
|
|
160
|
+
depois do tema (ex.: criando seu `admin/base_site.html` que estende o do tema e
|
|
161
|
+
adiciona um `<link>` no bloco `extrastyle`), sobrescrevendo:
|
|
162
|
+
|
|
163
|
+
```css
|
|
164
|
+
:root {
|
|
165
|
+
--admindigo-primary: #002133; /* cabeçalho / títulos */
|
|
166
|
+
--admindigo-secondary: #00314D; /* breadcrumbs / botões */
|
|
167
|
+
--admindigo-accent: #1B5589; /* hover / links */
|
|
168
|
+
--admindigo-alert: #c62828; /* linha de alerta no topo */
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Como funciona
|
|
173
|
+
|
|
174
|
+
- Sobrescreve `admin/base_site.html` (marca + injeção do CSS via bloco
|
|
175
|
+
`extrastyle`).
|
|
176
|
+
- Mapeia as variáveis nativas do admin (`--header-bg`, `--primary`, …) e reforça
|
|
177
|
+
com seletores diretos, cobrindo tema claro e escuro.
|
|
178
|
+
- A linha de alerta é um `body::before` fixo de 3px.
|
|
179
|
+
- Os títulos do admin são preenchidos por um `AppConfig.ready()` a partir das
|
|
180
|
+
settings `ADMINDIGO_*`.
|
|
181
|
+
|
|
182
|
+
## Desenvolvimento
|
|
183
|
+
|
|
184
|
+
```sh
|
|
185
|
+
git clone https://github.com/LisandroGuerra/django-admindigo.git
|
|
186
|
+
cd django-admindigo
|
|
187
|
+
pip install -e ".[test]"
|
|
188
|
+
pytest
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Veja [CONTRIBUTING.md](CONTRIBUTING.md) para detalhes (build, testes e release).
|
|
192
|
+
|
|
193
|
+
## Licença
|
|
194
|
+
|
|
195
|
+
[MIT](LICENSE) © Lisandro Guerra
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# django-admindigo
|
|
2
|
+
|
|
3
|
+
[](https://github.com/LisandroGuerra/django-admindigo/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/django-admindigo/)
|
|
5
|
+
[](https://pypi.org/project/django-admindigo/)
|
|
6
|
+
[](https://www.djangoproject.com/)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
Tema **índigo simples** para o Django Admin, empacotado como app reutilizável.
|
|
10
|
+
Aplica uma identidade visual azul/navy (`#002133` / `#00314D`, acento `#1B5589`)
|
|
11
|
+
ao admin e adiciona uma **linha fina vermelha fixa no topo**, alertando que você
|
|
12
|
+
está no ambiente administrativo.
|
|
13
|
+
|
|
14
|
+
- 🎨 Cabeçalho, breadcrumbs, botões, títulos e links na paleta índigo.
|
|
15
|
+
- 🛡️ Linha de alerta vermelha persistente no topo (você está no Admin!).
|
|
16
|
+
- 🏷️ Logo padrão neutro na marca do admin (substituível).
|
|
17
|
+
- 🌓 Funciona nos temas claro e escuro do admin do Django.
|
|
18
|
+
- ⚙️ Zero código: configurável apenas por `settings`.
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
> Dashboard do admin com o tema aplicado e o branding padrão (`Administração`).
|
|
23
|
+
> O texto é configurável via `ADMINDIGO_SITE_HEADER`.
|
|
24
|
+
|
|
25
|
+
## Requisitos
|
|
26
|
+
|
|
27
|
+
- Python ≥ 3.10
|
|
28
|
+
- Django ≥ 4.2
|
|
29
|
+
|
|
30
|
+
## Instalação
|
|
31
|
+
|
|
32
|
+
### 1. Instale o pacote
|
|
33
|
+
|
|
34
|
+
**Via PyPI:**
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
pip install django-admindigo
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Direto do GitHub** (última versão da branch `main`):
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
pip install "git+https://github.com/LisandroGuerra/django-admindigo.git"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**De uma tag/versão específica:**
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
pip install "git+https://github.com/LisandroGuerra/django-admindigo.git@v0.1.0"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Local, para desenvolvimento** (modo editável):
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
git clone https://github.com/LisandroGuerra/django-admindigo.git
|
|
56
|
+
pip install -e ./django-admindigo
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Em `pyproject.toml` (uv / PEP 621):
|
|
60
|
+
|
|
61
|
+
```toml
|
|
62
|
+
dependencies = ["django-admindigo"]
|
|
63
|
+
|
|
64
|
+
# durante o desenvolvimento, apontando para um diretório local:
|
|
65
|
+
[tool.uv.sources]
|
|
66
|
+
django-admindigo = { path = "../django-admindigo" }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Registre o app **antes** de `django.contrib.admin`
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
# settings.py
|
|
73
|
+
INSTALLED_APPS = [
|
|
74
|
+
"admindigo", # <-- OBRIGATÓRIO: antes do admin
|
|
75
|
+
"django.contrib.admin",
|
|
76
|
+
"django.contrib.auth",
|
|
77
|
+
"django.contrib.contenttypes",
|
|
78
|
+
"django.contrib.sessions",
|
|
79
|
+
"django.contrib.messages",
|
|
80
|
+
"django.contrib.staticfiles",
|
|
81
|
+
# seus apps...
|
|
82
|
+
]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> Por que antes? O tema sobrescreve `admin/base_site.html`. Com o loader
|
|
86
|
+
> `APP_DIRS=True`, o Django procura templates na ordem do `INSTALLED_APPS`, então
|
|
87
|
+
> o `admindigo` precisa aparecer antes do admin para ter prioridade.
|
|
88
|
+
|
|
89
|
+
### 3. Garanta o serviço de arquivos estáticos
|
|
90
|
+
|
|
91
|
+
`django.contrib.staticfiles` deve estar no `INSTALLED_APPS` e `STATIC_URL`
|
|
92
|
+
definido. **Em produção**, rode `collectstatic` e sirva os estáticos por um
|
|
93
|
+
servidor real (ex.: [WhiteNoise](https://whitenoise.readthedocs.io/) ou nginx):
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
python manage.py collectstatic --noinput
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Pronto. Acesse `/admin/`.
|
|
100
|
+
|
|
101
|
+
## Configuração
|
|
102
|
+
|
|
103
|
+
Tudo via `settings.py` — sem escrever templates:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
ADMINDIGO_SITE_HEADER = "Meu Sistema · Administração" # marca no topo + <title>
|
|
107
|
+
ADMINDIGO_SITE_TITLE = "Meu Sistema Admin" # <title> da aba
|
|
108
|
+
ADMINDIGO_INDEX_TITLE = "Painel" # título do dashboard
|
|
109
|
+
ADMINDIGO_LOGO = "minhaapp/img/logo.svg" # caminho em static/ ou URL
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
| Setting | Padrão | Descrição |
|
|
113
|
+
|---|---|---|
|
|
114
|
+
| `ADMINDIGO_SITE_HEADER` | `"Administração"` | Texto da marca + título |
|
|
115
|
+
| `ADMINDIGO_SITE_TITLE` | `"Admin"` | `<title>` das páginas |
|
|
116
|
+
| `ADMINDIGO_INDEX_TITLE` | `"Painel administrativo"` | Título do dashboard |
|
|
117
|
+
| `ADMINDIGO_LOGO` | logo neutro embutido | Caminho em `static/` **ou** URL absoluta / iniciada por `/` |
|
|
118
|
+
|
|
119
|
+
> Um `admin.py` do projeto que defina `admin.site.site_header` tem prioridade
|
|
120
|
+
> sobre `ADMINDIGO_SITE_HEADER` (o tema só preenche o padrão).
|
|
121
|
+
|
|
122
|
+
### Personalizar as cores
|
|
123
|
+
|
|
124
|
+
As cores vêm de CSS custom properties. Para ajustar, carregue um CSS próprio
|
|
125
|
+
depois do tema (ex.: criando seu `admin/base_site.html` que estende o do tema e
|
|
126
|
+
adiciona um `<link>` no bloco `extrastyle`), sobrescrevendo:
|
|
127
|
+
|
|
128
|
+
```css
|
|
129
|
+
:root {
|
|
130
|
+
--admindigo-primary: #002133; /* cabeçalho / títulos */
|
|
131
|
+
--admindigo-secondary: #00314D; /* breadcrumbs / botões */
|
|
132
|
+
--admindigo-accent: #1B5589; /* hover / links */
|
|
133
|
+
--admindigo-alert: #c62828; /* linha de alerta no topo */
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Como funciona
|
|
138
|
+
|
|
139
|
+
- Sobrescreve `admin/base_site.html` (marca + injeção do CSS via bloco
|
|
140
|
+
`extrastyle`).
|
|
141
|
+
- Mapeia as variáveis nativas do admin (`--header-bg`, `--primary`, …) e reforça
|
|
142
|
+
com seletores diretos, cobrindo tema claro e escuro.
|
|
143
|
+
- A linha de alerta é um `body::before` fixo de 3px.
|
|
144
|
+
- Os títulos do admin são preenchidos por um `AppConfig.ready()` a partir das
|
|
145
|
+
settings `ADMINDIGO_*`.
|
|
146
|
+
|
|
147
|
+
## Desenvolvimento
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
git clone https://github.com/LisandroGuerra/django-admindigo.git
|
|
151
|
+
cd django-admindigo
|
|
152
|
+
pip install -e ".[test]"
|
|
153
|
+
pytest
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Veja [CONTRIBUTING.md](CONTRIBUTING.md) para detalhes (build, testes e release).
|
|
157
|
+
|
|
158
|
+
## Licença
|
|
159
|
+
|
|
160
|
+
[MIT](LICENSE) © Lisandro Guerra
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "django-admindigo"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Tema índigo simples para o Django Admin: paleta navy/azul + linha de alerta de Admin."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Lisandro Guerra", email = "lisandro.digital@gmail.com" }]
|
|
13
|
+
keywords = ["django", "admin", "theme", "indigo", "blue"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Framework :: Django",
|
|
17
|
+
"Framework :: Django :: 4.2",
|
|
18
|
+
"Framework :: Django :: 5.0",
|
|
19
|
+
"Framework :: Django :: 5.1",
|
|
20
|
+
"Environment :: Web Environment",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"License :: OSI Approved :: MIT License",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
31
|
+
]
|
|
32
|
+
dependencies = ["Django>=4.2"]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://github.com/LisandroGuerra/django-admindigo"
|
|
36
|
+
Repository = "https://github.com/LisandroGuerra/django-admindigo"
|
|
37
|
+
Issues = "https://github.com/LisandroGuerra/django-admindigo/issues"
|
|
38
|
+
Changelog = "https://github.com/LisandroGuerra/django-admindigo/blob/main/CHANGELOG.md"
|
|
39
|
+
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
test = [
|
|
42
|
+
"pytest>=8",
|
|
43
|
+
"pytest-django>=4.8",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.wheel]
|
|
47
|
+
packages = ["src/admindigo"]
|
|
48
|
+
|
|
49
|
+
[tool.hatch.build.targets.sdist]
|
|
50
|
+
include = ["src/admindigo", "README.md", "LICENSE", "CHANGELOG.md"]
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
DJANGO_SETTINGS_MODULE = "tests.settings"
|
|
54
|
+
python_files = ["test_*.py"]
|
|
55
|
+
testpaths = ["tests"]
|
|
56
|
+
# Garante a raiz do projeto no sys.path para importar "tests.settings"
|
|
57
|
+
# ao rodar via console script `pytest` (como faz o CI).
|
|
58
|
+
pythonpath = ["."]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from django.apps import AppConfig
|
|
2
|
+
from django.conf import settings
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class AdmindigoConfig(AppConfig):
|
|
6
|
+
name = "admindigo"
|
|
7
|
+
verbose_name = "Admindigo (Django Admin)"
|
|
8
|
+
|
|
9
|
+
def ready(self):
|
|
10
|
+
# Aplica os títulos padrão do tema. Como o admindigo deve ficar ANTES de
|
|
11
|
+
# django.contrib.admin no INSTALLED_APPS, isto roda antes do autodiscover
|
|
12
|
+
# do admin — então um admin.py do projeto que defina site_header tem
|
|
13
|
+
# prioridade. Para customizar sem código, use as settings ADMINDIGO_*.
|
|
14
|
+
from django.contrib import admin
|
|
15
|
+
|
|
16
|
+
admin.site.site_header = getattr(
|
|
17
|
+
settings, "ADMINDIGO_SITE_HEADER", "Administração"
|
|
18
|
+
)
|
|
19
|
+
admin.site.site_title = getattr(settings, "ADMINDIGO_SITE_TITLE", "Admin")
|
|
20
|
+
admin.site.index_title = getattr(
|
|
21
|
+
settings, "ADMINDIGO_INDEX_TITLE", "Painel administrativo"
|
|
22
|
+
)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/* admindigo — tema índigo simples para o Django Admin.
|
|
2
|
+
Paleta: navy #002133 / #00314D, acento #1B5589, alerta #c62828.
|
|
3
|
+
Personalize sobrescrevendo as variáveis --admindigo-* num CSS carregado depois. */
|
|
4
|
+
|
|
5
|
+
:root {
|
|
6
|
+
--admindigo-primary: #002133;
|
|
7
|
+
--admindigo-secondary: #00314D;
|
|
8
|
+
--admindigo-accent: #1B5589;
|
|
9
|
+
--admindigo-alert: #c62828;
|
|
10
|
+
--admindigo-on-dark: #ffffff;
|
|
11
|
+
|
|
12
|
+
/* Mapeia para as variáveis nativas do admin do Django. */
|
|
13
|
+
--primary: var(--admindigo-secondary);
|
|
14
|
+
--secondary: var(--admindigo-primary);
|
|
15
|
+
--accent: var(--admindigo-accent);
|
|
16
|
+
--header-bg: var(--admindigo-primary);
|
|
17
|
+
--header-color: var(--admindigo-on-dark);
|
|
18
|
+
--header-branding-color: var(--admindigo-on-dark);
|
|
19
|
+
--header-link-color: var(--admindigo-on-dark);
|
|
20
|
+
--breadcrumbs-bg: var(--admindigo-secondary);
|
|
21
|
+
--breadcrumbs-fg: #cfe2f3;
|
|
22
|
+
--breadcrumbs-link-fg: var(--admindigo-on-dark);
|
|
23
|
+
--link-fg: var(--admindigo-accent);
|
|
24
|
+
--link-hover-color: var(--admindigo-primary);
|
|
25
|
+
--link-selected-fg: var(--admindigo-primary);
|
|
26
|
+
--button-bg: var(--admindigo-secondary);
|
|
27
|
+
--button-hover-bg: var(--admindigo-accent);
|
|
28
|
+
--default-button-bg: var(--admindigo-primary);
|
|
29
|
+
--default-button-hover-bg: var(--admindigo-accent);
|
|
30
|
+
--object-tools-bg: var(--admindigo-secondary);
|
|
31
|
+
--object-tools-hover-bg: var(--admindigo-accent);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Linha fina vermelha no topo, antes do corpo da página: alerta de Admin.
|
|
35
|
+
Fixa, para o aviso permanecer visível durante a rolagem. */
|
|
36
|
+
body { padding-top: 3px; }
|
|
37
|
+
body::before {
|
|
38
|
+
content: "";
|
|
39
|
+
position: fixed;
|
|
40
|
+
top: 0;
|
|
41
|
+
left: 0;
|
|
42
|
+
right: 0;
|
|
43
|
+
height: 3px;
|
|
44
|
+
background: var(--admindigo-alert);
|
|
45
|
+
z-index: 3000;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Reforços diretos (valem tanto no tema claro quanto no escuro). */
|
|
49
|
+
#header {
|
|
50
|
+
background: var(--admindigo-primary);
|
|
51
|
+
color: var(--admindigo-on-dark);
|
|
52
|
+
}
|
|
53
|
+
#branding h1,
|
|
54
|
+
#branding h1 a:link,
|
|
55
|
+
#branding h1 a:visited {
|
|
56
|
+
color: var(--admindigo-on-dark);
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
}
|
|
59
|
+
.admindigo-logo {
|
|
60
|
+
vertical-align: middle;
|
|
61
|
+
margin-right: 8px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
div.breadcrumbs {
|
|
65
|
+
background: var(--admindigo-secondary);
|
|
66
|
+
color: #cfe2f3;
|
|
67
|
+
}
|
|
68
|
+
div.breadcrumbs a {
|
|
69
|
+
color: var(--admindigo-on-dark);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.module caption,
|
|
73
|
+
.module h2,
|
|
74
|
+
.inline-group h2 {
|
|
75
|
+
background: var(--admindigo-primary);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.button,
|
|
79
|
+
input[type=submit],
|
|
80
|
+
input[type=button],
|
|
81
|
+
.submit-row input,
|
|
82
|
+
a.button {
|
|
83
|
+
background: var(--admindigo-secondary);
|
|
84
|
+
}
|
|
85
|
+
.button:hover,
|
|
86
|
+
input[type=submit]:hover,
|
|
87
|
+
input[type=button]:hover,
|
|
88
|
+
.submit-row input:hover,
|
|
89
|
+
a.button:hover {
|
|
90
|
+
background: var(--admindigo-accent);
|
|
91
|
+
}
|
|
92
|
+
.button.default,
|
|
93
|
+
input[type=submit].default,
|
|
94
|
+
.submit-row input.default {
|
|
95
|
+
background: var(--admindigo-primary);
|
|
96
|
+
}
|
|
97
|
+
.button.default:hover,
|
|
98
|
+
input[type=submit].default:hover,
|
|
99
|
+
.submit-row input.default:hover {
|
|
100
|
+
background: var(--admindigo-accent);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
a:link,
|
|
104
|
+
a:visited {
|
|
105
|
+
color: var(--admindigo-accent);
|
|
106
|
+
}
|
|
107
|
+
a:hover,
|
|
108
|
+
a:focus {
|
|
109
|
+
color: var(--admindigo-primary);
|
|
110
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48" role="img" aria-label="admindigo">
|
|
2
|
+
<rect width="48" height="48" rx="10" fill="#00314D"/>
|
|
3
|
+
<rect x="9" y="9" width="30" height="30" rx="6" fill="none" stroke="#1B5589" stroke-width="2.5"/>
|
|
4
|
+
<path d="M16 32V20l8 9 8-9v12" fill="none" stroke="#ffffff" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{% extends "admin/base.html" %}
|
|
2
|
+
{% load static admindigo %}
|
|
3
|
+
|
|
4
|
+
{% block extrastyle %}{{ block.super }}
|
|
5
|
+
<link rel="stylesheet" href="{% static 'admindigo/css/admindigo-admin.css' %}">
|
|
6
|
+
{% endblock %}
|
|
7
|
+
|
|
8
|
+
{% block branding %}
|
|
9
|
+
<div id="site-name">
|
|
10
|
+
<a href="{% url 'admin:index' %}">
|
|
11
|
+
<img src="{% admindigo_logo %}" alt="{{ site_header|default:'Admin' }}"
|
|
12
|
+
height="24" class="admindigo-logo">
|
|
13
|
+
{{ site_header|default:'Administração' }}
|
|
14
|
+
</a>
|
|
15
|
+
</div>
|
|
16
|
+
{% endblock %}
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from django import template
|
|
2
|
+
from django.conf import settings
|
|
3
|
+
from django.templatetags.static import static
|
|
4
|
+
|
|
5
|
+
register = template.Library()
|
|
6
|
+
|
|
7
|
+
DEFAULT_LOGO = "admindigo/img/logo.svg"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@register.simple_tag
|
|
11
|
+
def admindigo_logo():
|
|
12
|
+
"""URL do logo do tema.
|
|
13
|
+
|
|
14
|
+
Override com a setting ``ADMINDIGO_LOGO``, que pode ser:
|
|
15
|
+
- um caminho dentro de ``static/`` (ex.: "minhaapp/img/logo.svg"), ou
|
|
16
|
+
- uma URL absoluta / caminho começando com "/".
|
|
17
|
+
"""
|
|
18
|
+
logo = getattr(settings, "ADMINDIGO_LOGO", None)
|
|
19
|
+
if not logo:
|
|
20
|
+
return static(DEFAULT_LOGO)
|
|
21
|
+
if logo.startswith(("http://", "https://", "/")):
|
|
22
|
+
return logo
|
|
23
|
+
return static(logo)
|