Skip to main content

django-usp-theme

Tema visual USP para aplicações Django — design system, componentes e templates reutilizáveis.

Instalação

pip install django-usp-theme

Configuração

Adicione django_usp_theme ao INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'django_usp_theme',
]

Uso

Template base

Estenda o template base em seus templates:

{% extends "usp_theme/base.html" %}
{% load static usp_filters %}

{% block title %}Minha Aplicação{% endblock %}

{% block header_logo %}
<a href="https://www.usp.br">
    <img src="{% static 'usp_theme/img/usp-logo-f.png' %}" alt="Logo USP">
</a>
{% endblock %}

{% block brand %}Minha Aplicação{% endblock %}

{% block nav %}
<a class="nav-link" href="{% url 'home' %}">INÍCIO</a>
<a class="nav-link" href="{% url 'lista' %}">LISTA</a>
{% endblock %}

{% block nav_user %}
<div class="nav-user">
    <span>{{ user.username }}</span>
    <form action="{% url 'logout' %}" method="post" class="mb-0">
        {% csrf_token %}
        <button type="submit" class="btn btn-sm btn-outline-secondary">
            <i class="bi bi-door-open"></i> Sair
        </button>
    </form>
</div>
{% endblock %}

{% block content %}
<!-- Conteúdo da página -->
{% endblock %}

Componentes

Page Header

{% include "usp_theme/components/page_header.html" %}

Ou com bloco:

{% include "usp_theme/components/page_header.html" with title="Minha Página" %}

Content Card

{% include "usp_theme/components/content_card.html" with card_title="Título do Card" %}

Empty State

{% include "usp_theme/components/empty_state.html" %}

Ou customizado:

{% include "usp_theme/components/empty_state.html" with empty_icon="bi-folder" empty_text="Nenhum item encontrado." %}

Loading Button

{% include "usp_theme/components/loading_button.html" with text="Salvar" icon="bi-check-lg" loading=False %}

Template Tags

usp_moeda

Formata valor para formato brasileiro:

{% load usp_filters %}

{{ valor|usp_moeda }}
<!-- Saída: R$ 1.234,56 -->

usp_filename

Extrai nome do arquivo de um caminho:

{% load usp_filters %}

{{ caminho|usp_filename }}
<!-- Saída: arquivo.docx -->

CSS

O design system é composto por módulos CSS:

  • tokens.css — Variáveis CSS (cores, tipografia, espaçamento)
  • base.css — Reset e tipografia
  • components.css — Botões, formulários, tabelas, cards, alertas
  • layout.css — Header, navegação, container
  • utilities.css — Espaçamento, impressão, acessibilidade

Para usar apenas parte do CSS:

<link href="{% static 'usp_theme/css/tokens.css' %}" rel="stylesheet">
<link href="{% static 'usp_theme/css/base.css' %}" rel="stylesheet">

Ou usar o CSS unificado:

<link href="{% static 'usp_theme/css/usp_theme.css' %}" rel="stylesheet">

Variáveis CSS

O tema utiliza CSS custom properties com prefixo --usp-*. Para customizar:

:root {
    --usp-color-primary: #0066cc; /* Cor primária personalizada */
}

Licença

MIT

Release files for django-usp-theme 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-usp-theme 0.1.3
File Size Uploaded
django_usp_theme-0.1.3.tar.gz 24.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-usp-theme 0.1.3
File Interpreter ABI Platform
django_usp_theme-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 51.5 kB

Release files / django_usp_theme-0.1.3.tar.gz

Download URL django_usp_theme-0.1.3.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
abcb09e0a9f4a9f8ebe520a89e6437bbbfe2f6b3becc8431529235cbd26e92bb
BLAKE2b-256 checksum
How to use checksums
17f32a23905dc47278d5369bad4dc435de4d041c7db81f45dacf13eaa63c0eea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / django_usp_theme-0.1.3-py3-none-any.whl

Download URL django_usp_theme-0.1.3-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1eb119f7dba86e4c0853211c0a6681f206f31ab046f93ecaa0092a6609e1009b
BLAKE2b-256 checksum
How to use checksums
ec7c5b3bcd97fcd82207264549cb4a67a4f2025ce4dc33b98d660a3d34a6cdcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page