Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
django-dsgov
Commits
b80086a9
Commit
b80086a9
authored
Oct 21, 2025
by
Eduardo Silva
Browse files
testando com automatizacao
#9
parent
83097ddf
Changes
7
Show whitespace changes
Inline
Side-by-side
dsgov/__init__.py
View file @
b80086a9
default_app_config
=
"dsgov.apps.DsgovConfig"
\ No newline at end of file
dsgov/apps.py
View file @
b80086a9
from
django.apps
import
AppConfig
from
django.apps
import
AppConfig
from
django.conf
import
settings
class
DsgovConfig
(
AppConfig
):
name
=
"dsgov"
verbose_name
=
"Design System Gov.br (Django)"
class
DSGovConfig
(
AppConfig
):
def
ready
(
self
):
"""
name
=
'dsgov'
Registra automaticamente o context processor dsgov_init,
se ainda não estiver presente.
"""
try
:
templates
=
settings
.
TEMPLATES
[
0
][
"OPTIONS"
]
cps
=
templates
.
get
(
"context_processors"
,
[])
cp
=
"dsgov.context_processors.dsgov_init"
if
cp
not
in
cps
:
cps
.
append
(
cp
)
except
Exception
:
# Evita travar o setup se o settings estiver incompleto
pass
\ No newline at end of file
dsgov/context_processors.py
0 → 100644
View file @
b80086a9
from
django.template.loader
import
render_to_string
def
dsgov_init
(
request
):
"""
Injeta automaticamente o HTML de inicialização do DSGov em todos os templates.
"""
try
:
html
=
render_to_string
(
"dsgov/includes/init.html"
)
except
Exception
:
html
=
""
return
{
"DSGOV_INIT"
:
html
}
\ No newline at end of file
dsgov/templates/dsgov/base.html
View file @
b80086a9
...
@@ -11,17 +11,16 @@
...
@@ -11,17 +11,16 @@
{% block title %}
{% block title %}
{% endblock %}
{% endblock %}
</title>
</title>
<!-- Link para o fontawesome -->
<!-- FontAwesome -->
<link
rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
>
<link
rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
>
<!-- I
mportando o CSS do govbr-ds
-->
<!-- I
nicialização DSGov
-->
{% br_
stylesheets
%}
{% br_
init
%}
</head>
</head>
<body>
<body>
{% block content %}
{% block content %}
{% endblock %}
{% endblock %}
<!-- Importando o JS do govbr-ds -->
{% br_scripts %}
</body>
</body>
</html>
</html>
\ No newline at end of file
dsgov/templates/dsgov/includes/init.html
0 → 100644
View file @
b80086a9
{% load br_components %}
{% load static %}
<!-- Importando o CSS do govbr-ds -->
{% br_stylesheets %}
<!-- Importando o JS do govbr-ds -->
{% br_scripts %}
\ No newline at end of file
dsgov/templatetags/br_components.py
View file @
b80086a9
...
@@ -36,6 +36,10 @@ def br_scripts():
...
@@ -36,6 +36,10 @@ def br_scripts():
static
(
'dsgov/dist/js/bundle.js'
)
static
(
'dsgov/dist/js/bundle.js'
)
)
)
@
register
.
inclusion_tag
(
"dsgov/includes/init.html"
,
takes_context
=
True
)
def
br_init
(
context
):
"""Inclui automaticamente CSS e JS do DSGov."""
return
{}
@
register
.
simple_tag
@
register
.
simple_tag
def
br_button
(
text
=
''
,
button_type
=
''
,
style
=
''
,
extra_classes
=
''
,
icon_class
=
''
):
def
br_button
(
text
=
''
,
button_type
=
''
,
style
=
''
,
extra_classes
=
''
,
icon_class
=
''
):
...
...
tests/django_dsgov_test1/templates/index.html
View file @
b80086a9
{% extends "dsgov/base.html" %}
{% extends "dsgov/base.html" %}
{% load br_components %}
{% load static %}
{% block title %}
{% block title %}
Componentes Django-DsGOV
Componentes Django-DsGOV
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment