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.2

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.2
File Size Uploaded
django_usp_theme-0.1.2.tar.gz 24.5 kB Details

Built distribution (wheel)

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

Total release size: 51.5 kB

Release files / django_usp_theme-0.1.2.tar.gz

Download URL django_usp_theme-0.1.2.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d38ea63fda522c8951d62281efb0c39a312257eaf949aa069fd9766b3716c954
BLAKE2b-256 checksum
How to use checksums
4152351f8a93c1da6f768aef4e13c199053c004ec3b2529f0a2a438f00745916
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.2-py3-none-any.whl

Download URL django_usp_theme-0.1.2-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12ee68be3ee90dbacd29aa002671c002cc110b329505fe4945afacf61b4ee4db
BLAKE2b-256 checksum
How to use checksums
46b10d6519369b4e9e33cc09a50be19b62b3155336e9a62c4014aafd65a0bc96
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

0.1.3

2 release files

This release

0.1.2 This release

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