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

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.1
File Size Uploaded
django_usp_theme-0.1.1.tar.gz 24.0 kB Details

Built distribution (wheel)

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

Total release size: 50.2 kB

Release files / django_usp_theme-0.1.1.tar.gz

Download URL django_usp_theme-0.1.1.tar.gz
Size 24.0 kB
Tags Source
SHA-256 checksum
How to use checksums
381aba37efc77e7194679698497fe47e42d75cd016f90ef802745a394bca5103
BLAKE2b-256 checksum
How to use checksums
6263af7d5c3cc5cac105281dfd83591104a6c53d52d503c96be14a64186587f2
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 23, 2026.

Transparency log

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

Download URL django_usp_theme-0.1.1-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f282716cba3a6a5ef3065aa80ac54f752d45b448262ff65e30e4e246a483cc75
BLAKE2b-256 checksum
How to use checksums
4e84e7d3946e79f512d36a4cc2984357b11acb561f388245b5aa5d3c173f4d5e
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 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

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