Browse Source

Subtituir tema Material por djbs-theme

pull/184/head
Sesóstris Vieira 2 months ago
parent
commit
08405a0978
  1. 4
      sigi/apps/casas/forms.py
  2. 9
      sigi/apps/espacos/forms.py
  3. 35
      sigi/apps/eventos/forms.py
  4. 20
      sigi/apps/ocorrencias/forms.py
  5. 4
      sigi/apps/parlamentares/forms.py
  6. 78
      sigi/settings.py

4
sigi/apps/casas/forms.py

@ -2,7 +2,6 @@ from django import forms
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from localflavor.br.forms import BRZipCodeField from localflavor.br.forms import BRZipCodeField
from material.admin.widgets import MaterialAdminTextareaWidget
from sigi.apps.casas.models import Funcionario, Orgao from sigi.apps.casas.models import Funcionario, Orgao
from sigi.apps.servidores.models import Servidor from sigi.apps.servidores.models import Servidor
from sigi.apps.utils import valida_cnpj from sigi.apps.utils import valida_cnpj
@ -102,9 +101,6 @@ class FuncionarioForm(forms.ModelForm):
"email", "email",
"redes_sociais", "redes_sociais",
] ]
widgets = {
"redes_sociais": MaterialAdminTextareaWidget,
}
class CnpjErradoForm(forms.Form): class CnpjErradoForm(forms.Form):

9
sigi/apps/espacos/forms.py

@ -1,7 +1,6 @@
import calendar import calendar
from django.utils import timezone from django.utils import timezone
from django import forms from django import forms
from material.admin.widgets import MaterialAdminDateWidget
from django.forms.widgets import CheckboxSelectMultiple from django.forms.widgets import CheckboxSelectMultiple
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from sigi.apps.espacos.models import Espaco, Reserva from sigi.apps.espacos.models import Espaco, Reserva
@ -44,12 +43,8 @@ class UsoEspacoReportForm(forms.Form):
if s[0] <= timezone.localdate() <= s[-1] if s[0] <= timezone.localdate() <= s[-1]
][0] ][0]
data_inicio = forms.DateField( data_inicio = forms.DateField(label=_("Data início"), required=True)
label=_("Data início"), required=True, widget=MaterialAdminDateWidget data_fim = forms.DateField(label=_("Data fim"), required=True)
)
data_fim = forms.DateField(
label=_("Data fim"), required=True, widget=MaterialAdminDateWidget
)
virtual = forms.ChoiceField( virtual = forms.ChoiceField(
label=_("Tipo de uso"), choices=VIRTUAL_CHOICES, initial=VIRTUAL_ALL label=_("Tipo de uso"), choices=VIRTUAL_CHOICES, initial=VIRTUAL_ALL
) )

35
sigi/apps/eventos/forms.py

@ -1,9 +1,5 @@
from django import forms from django import forms
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from material.admin.widgets import (
MaterialAdminTextareaWidget,
MaterialAdminDateWidget,
)
from sigi.apps.casas.models import Funcionario, Orgao from sigi.apps.casas.models import Funcionario, Orgao
from sigi.apps.espacos.models import Espaco, Reserva from sigi.apps.espacos.models import Espaco, Reserva
from sigi.apps.eventos.models import ( from sigi.apps.eventos.models import (
@ -124,16 +120,8 @@ class EventosPorUfForm(forms.Form):
("V", _("Virtual")), ("V", _("Virtual")),
("P", _("Presencial")), ("P", _("Presencial")),
) )
data_inicio = forms.DateField( data_inicio = forms.DateField(required=True, label=_("data de início"))
required=True, data_fim = forms.DateField(required=True, label=_("data de término"))
label=_("data de início"),
widget=MaterialAdminDateWidget,
)
data_fim = forms.DateField(
required=True,
label=_("data de término"),
widget=MaterialAdminDateWidget,
)
categoria = forms.MultipleChoiceField( categoria = forms.MultipleChoiceField(
required=False, required=False,
label=_("Categoria"), label=_("Categoria"),
@ -164,16 +152,8 @@ class SolicitacoesPorPeriodoForm(forms.Form):
(True, _("Virtual")), (True, _("Virtual")),
(False, _("Presencial")), (False, _("Presencial")),
) )
data_inicio = forms.DateField( data_inicio = forms.DateField(required=True, label=_("data de início"))
required=True, data_fim = forms.DateField(required=True, label=_("data de término"))
label=_("data de início"),
widget=MaterialAdminDateWidget,
)
data_fim = forms.DateField(
required=True,
label=_("data de término"),
widget=MaterialAdminDateWidget,
)
tipos_evento = forms.ModelMultipleChoiceField( tipos_evento = forms.ModelMultipleChoiceField(
required=False, required=False,
label=_("Tipos de evento"), label=_("Tipos de evento"),
@ -208,7 +188,6 @@ class ConviteForm(forms.ModelForm):
class Meta: class Meta:
model = Convite model = Convite
fields = ["nomes_participantes"] fields = ["nomes_participantes"]
widgets = {"nomes_participantes": MaterialAdminTextareaWidget}
class CasaForm(forms.ModelForm): class CasaForm(forms.ModelForm):
@ -237,10 +216,6 @@ class FuncionarioForm(forms.ModelForm):
"email", "email",
"redes_sociais", "redes_sociais",
] ]
widgets = {
"nota": MaterialAdminTextareaWidget,
"redes_sociais": MaterialAdminTextareaWidget,
}
class ParlamentarForm(forms.ModelForm): class ParlamentarForm(forms.ModelForm):
@ -259,7 +234,5 @@ class ParlamentarForm(forms.ModelForm):
] ]
widgets = { widgets = {
"nome_completo": forms.HiddenInput, "nome_completo": forms.HiddenInput,
"redes_sociais": MaterialAdminTextareaWidget,
"observacoes": MaterialAdminTextareaWidget,
"status_mandato": forms.RadioSelect, "status_mandato": forms.RadioSelect,
} }

20
sigi/apps/ocorrencias/forms.py

@ -8,7 +8,6 @@ from django.utils.encoding import force_str
from django.utils.html import format_html from django.utils.html import format_html
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ngettext, gettext as _ from django.utils.translation import ngettext, gettext as _
from material.admin.widgets import MaterialAdminTextareaWidget
from sigi.apps.casas.models import Funcionario, Orgao from sigi.apps.casas.models import Funcionario, Orgao
from sigi.apps.eventos.models import TipoEvento from sigi.apps.eventos.models import TipoEvento
from sigi.apps.ocorrencias.models import Ocorrencia, Comentario, Anexo from sigi.apps.ocorrencias.models import Ocorrencia, Comentario, Anexo
@ -70,10 +69,7 @@ class ComentarioForm(forms.ModelForm):
"descricao", "descricao",
"novo_status", "novo_status",
] ]
widgets = { widgets = {"ocorrencia": forms.HiddenInput}
"ocorrencia": forms.HiddenInput(),
"descricao": MaterialAdminTextareaWidget(),
}
class OcorrenciaForm(forms.ModelForm): class OcorrenciaForm(forms.ModelForm):
@ -159,15 +155,12 @@ class PresidenteForm(forms.ModelForm):
"email", "email",
"redes_sociais", "redes_sociais",
] ]
widgets = {
"redes_sociais": MaterialAdminTextareaWidget,
}
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields[ self.fields["parlamentar"].queryset = (
"parlamentar" self.instance.casa_legislativa.parlamentar_set.all()
].queryset = self.instance.casa_legislativa.parlamentar_set.all() )
class ContatoForm(forms.ModelForm): class ContatoForm(forms.ModelForm):
@ -182,10 +175,6 @@ class ContatoForm(forms.ModelForm):
"email", "email",
"redes_sociais", "redes_sociais",
] ]
widgets = {
"nota": MaterialAdminTextareaWidget,
"redes_sociais": MaterialAdminTextareaWidget,
}
class DocumentoForm(forms.ModelForm): class DocumentoForm(forms.ModelForm):
@ -208,7 +197,6 @@ class ComentarioForm(forms.ModelForm):
class Meta: class Meta:
model = Comentario model = Comentario
fields = ["descricao"] fields = ["descricao"]
widgets = {"descricao": MaterialAdminTextareaWidget}
class ComentarioInternoForm(forms.ModelForm): class ComentarioInternoForm(forms.ModelForm):

4
sigi/apps/parlamentares/forms.py

@ -1,7 +1,6 @@
from requests import options from requests import options
from django import forms from django import forms
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from material.admin.widgets import MaterialAdminTextareaWidget
from sigi.apps.contatos.models import UnidadeFederativa from sigi.apps.contatos.models import UnidadeFederativa
from sigi.apps.parlamentares.models import Parlamentar from sigi.apps.parlamentares.models import Parlamentar
@ -61,6 +60,3 @@ class ParlamentarForm(forms.ModelForm):
"email", "email",
"redes_sociais", "redes_sociais",
] ]
widgets = {
"redes_sociais": MaterialAdminTextareaWidget,
}

78
sigi/settings.py

@ -1,19 +1,20 @@
""" """
Django base settings for sigi project. Django base settings for sigi project.
Generated by 'django-admin startproject' using Django 4.0.1. Generated by 'django-admin startproject' using Django 5.0.6.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/ https://docs.djangoproject.com/en/5.0/topics/settings/
For the full list of settings and their values, see For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/ https://docs.djangoproject.com/en/5.0/ref/settings/
""" """
import environ import environ
from pathlib import Path from pathlib import Path
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.conf.locale.pt_BR import formats as br_formats from django.conf.locale.pt_BR import formats as br_formats
from djbs import djbs_constants
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
@ -41,6 +42,22 @@ DATA_UPLOAD_MAX_NUMBER_FIELDS = 3000
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
"djbs",
"django.forms",
"django.contrib.admin",
"admin_auto_filters",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"django_extensions",
"django_filters",
"localflavor",
"import_export",
"tinymce",
"rest_framework",
"sigi.apps.casas", "sigi.apps.casas",
"sigi.apps.contatos", "sigi.apps.contatos",
"sigi.apps.convenios", "sigi.apps.convenios",
@ -53,22 +70,6 @@ INSTALLED_APPS = [
"sigi.apps.servicos", "sigi.apps.servicos",
"sigi.apps.servidores", "sigi.apps.servidores",
"sigi.apps.utils", "sigi.apps.utils",
"localflavor",
"import_export",
"tinymce",
"django.forms",
"rest_framework",
"material",
"material.admin",
"admin_auto_filters",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"django_extensions",
"django_filters",
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -107,7 +108,7 @@ DEFAULT_FROM_EMAIL = env(
SERVER_EMAIL = DEFAULT_FROM_EMAIL SERVER_EMAIL = DEFAULT_FROM_EMAIL
# Database # Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases # https://docs.djangoproject.com/en/5.0/ref/settings/#databases
DATABASES = { DATABASES = {
"default": env.db(), "default": env.db(),
@ -127,6 +128,7 @@ TEMPLATES = [
"django.contrib.auth.context_processors.auth", "django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages", "django.contrib.messages.context_processors.messages",
"django.template.context_processors.media", "django.template.context_processors.media",
"djbs.context_processors.sets",
"sigi.apps.utils.context_processors.site_context", "sigi.apps.utils.context_processors.site_context",
"sigi.apps.home.context_processors.dashboard", "sigi.apps.home.context_processors.dashboard",
], ],
@ -139,7 +141,7 @@ FORM_RENDERER = "django.forms.renderers.TemplatesSetting"
WSGI_APPLICATION = "sigi.wsgi.application" WSGI_APPLICATION = "sigi.wsgi.application"
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/ # https://docs.djangoproject.com/en/5.0/topics/i18n/
LANGUAGE_CODE = "pt-br" LANGUAGE_CODE = "pt-br"
@ -154,7 +156,7 @@ USE_TZ = True
USE_THOUSAND_SEPARATOR = True USE_THOUSAND_SEPARATOR = True
# Password validation # Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{ {
@ -214,7 +216,7 @@ LOGIN_REDIRECT_URL = "home_index"
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/ # https://docs.djangoproject.com/en/5.0/howto/static-files/
STATIC_URL = "static/" STATIC_URL = "static/"
STATICFILES_DIRS = [ STATICFILES_DIRS = [
@ -223,13 +225,13 @@ STATICFILES_DIRS = [
STATIC_ROOT = BASE_DIR / "../static/" STATIC_ROOT = BASE_DIR / "../static/"
# Media files # Media files
# https://docs.djangoproject.com/en/4.0/topics/files/#managing-files # https://docs.djangoproject.com/en/5.0/topics/files/#managing-files
MEDIA_ROOT = BASE_DIR / "../media" MEDIA_ROOT = BASE_DIR / "../media"
MEDIA_URL = "media/" MEDIA_URL = "media/"
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
@ -243,20 +245,18 @@ IMPORT_EXPORT_SKIP_ADMIN_LOG = True
br_formats.DATE_FORMAT = br_formats.SHORT_DATE_FORMAT br_formats.DATE_FORMAT = br_formats.SHORT_DATE_FORMAT
br_formats.DATETIME_FORMAT = br_formats.SHORT_DATETIME_FORMAT br_formats.DATETIME_FORMAT = br_formats.SHORT_DATETIME_FORMAT
# Django Material Admin settings # djbs-theme settings - Django Bootstrap Theme
# https://github.com/MaistrenkoAnton/django-material-admin#django-material-administration # https://github.com/interlegis/djbs-theme/?tab=readme-ov-file#customizing
MATERIAL_ADMIN_SITE = { DJBSTHEME_DEFAULTS = {
"HEADER": _("SIGI - Sistema de Informações do Interlegis"), "SEARCH_URL": None,
"TITLE": _("SIGI"), "SEARCH_PARAM": None,
"FAVICON": "img/favicon.ico", "MENU_FILE": BASE_DIR / "menu_conf.yaml",
"PROFILE_PICTURE": "img/interlegis.jpeg", # Admin site profile picture (path to static should be specified) "CHECK_AS_SWITCH": True,
"PROFILE_BG": "img/engitec.jpeg", # Admin site profile background (path to static should be specified) "FILTER_STYLE": djbs_constants.FILTER_STYLE_CLASSIC,
"LOGIN_LOGO": "img/interlegis.jpeg", # Admin site logo on login page (path to static should be specified) "FIELDSET_STYLE": djbs_constants.STYLE_CARD,
"LOGOUT_BG": "img/engitec.jpeg", # Admin site background on login/logout pages (path to static should be specified) "INLINESET_STYLE": djbs_constants.STYLE_CARD,
"SHOW_THEMES": False, # Show default admin themes button "BADGERIZE_FACETS": True,
"TRAY_REVERSE": False, # Hide object-tools and additional-submit-line by default
"NAVBAR_REVERSE": False, # Hide side navbar by default
} }
# tinyMCE rich text editor settings # tinyMCE rich text editor settings

Loading…
Cancel
Save