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

9
sigi/apps/espacos/forms.py

@ -1,7 +1,6 @@
import calendar
from django.utils import timezone
from django import forms
from material.admin.widgets import MaterialAdminDateWidget
from django.forms.widgets import CheckboxSelectMultiple
from django.utils.translation import gettext as _
from sigi.apps.espacos.models import Espaco, Reserva
@ -44,12 +43,8 @@ class UsoEspacoReportForm(forms.Form):
if s[0] <= timezone.localdate() <= s[-1]
][0]
data_inicio = forms.DateField(
label=_("Data início"), required=True, widget=MaterialAdminDateWidget
)
data_fim = forms.DateField(
label=_("Data fim"), required=True, widget=MaterialAdminDateWidget
)
data_inicio = forms.DateField(label=_("Data início"), required=True)
data_fim = forms.DateField(label=_("Data fim"), required=True)
virtual = forms.ChoiceField(
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.utils.translation import gettext as _
from material.admin.widgets import (
MaterialAdminTextareaWidget,
MaterialAdminDateWidget,
)
from sigi.apps.casas.models import Funcionario, Orgao
from sigi.apps.espacos.models import Espaco, Reserva
from sigi.apps.eventos.models import (
@ -124,16 +120,8 @@ class EventosPorUfForm(forms.Form):
("V", _("Virtual")),
("P", _("Presencial")),
)
data_inicio = forms.DateField(
required=True,
label=_("data de início"),
widget=MaterialAdminDateWidget,
)
data_fim = forms.DateField(
required=True,
label=_("data de término"),
widget=MaterialAdminDateWidget,
)
data_inicio = forms.DateField(required=True, label=_("data de início"))
data_fim = forms.DateField(required=True, label=_("data de término"))
categoria = forms.MultipleChoiceField(
required=False,
label=_("Categoria"),
@ -164,16 +152,8 @@ class SolicitacoesPorPeriodoForm(forms.Form):
(True, _("Virtual")),
(False, _("Presencial")),
)
data_inicio = forms.DateField(
required=True,
label=_("data de início"),
widget=MaterialAdminDateWidget,
)
data_fim = forms.DateField(
required=True,
label=_("data de término"),
widget=MaterialAdminDateWidget,
)
data_inicio = forms.DateField(required=True, label=_("data de início"))
data_fim = forms.DateField(required=True, label=_("data de término"))
tipos_evento = forms.ModelMultipleChoiceField(
required=False,
label=_("Tipos de evento"),
@ -208,7 +188,6 @@ class ConviteForm(forms.ModelForm):
class Meta:
model = Convite
fields = ["nomes_participantes"]
widgets = {"nomes_participantes": MaterialAdminTextareaWidget}
class CasaForm(forms.ModelForm):
@ -237,10 +216,6 @@ class FuncionarioForm(forms.ModelForm):
"email",
"redes_sociais",
]
widgets = {
"nota": MaterialAdminTextareaWidget,
"redes_sociais": MaterialAdminTextareaWidget,
}
class ParlamentarForm(forms.ModelForm):
@ -259,7 +234,5 @@ class ParlamentarForm(forms.ModelForm):
]
widgets = {
"nome_completo": forms.HiddenInput,
"redes_sociais": MaterialAdminTextareaWidget,
"observacoes": MaterialAdminTextareaWidget,
"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.safestring import mark_safe
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.eventos.models import TipoEvento
from sigi.apps.ocorrencias.models import Ocorrencia, Comentario, Anexo
@ -70,10 +69,7 @@ class ComentarioForm(forms.ModelForm):
"descricao",
"novo_status",
]
widgets = {
"ocorrencia": forms.HiddenInput(),
"descricao": MaterialAdminTextareaWidget(),
}
widgets = {"ocorrencia": forms.HiddenInput}
class OcorrenciaForm(forms.ModelForm):
@ -159,15 +155,12 @@ class PresidenteForm(forms.ModelForm):
"email",
"redes_sociais",
]
widgets = {
"redes_sociais": MaterialAdminTextareaWidget,
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields[
"parlamentar"
].queryset = self.instance.casa_legislativa.parlamentar_set.all()
self.fields["parlamentar"].queryset = (
self.instance.casa_legislativa.parlamentar_set.all()
)
class ContatoForm(forms.ModelForm):
@ -182,10 +175,6 @@ class ContatoForm(forms.ModelForm):
"email",
"redes_sociais",
]
widgets = {
"nota": MaterialAdminTextareaWidget,
"redes_sociais": MaterialAdminTextareaWidget,
}
class DocumentoForm(forms.ModelForm):
@ -208,7 +197,6 @@ class ComentarioForm(forms.ModelForm):
class Meta:
model = Comentario
fields = ["descricao"]
widgets = {"descricao": MaterialAdminTextareaWidget}
class ComentarioInternoForm(forms.ModelForm):

4
sigi/apps/parlamentares/forms.py

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

78
sigi/settings.py

@ -1,19 +1,20 @@
"""
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
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
https://docs.djangoproject.com/en/4.0/ref/settings/
https://docs.djangoproject.com/en/5.0/ref/settings/
"""
import environ
from pathlib import Path
from django.utils.translation import gettext_lazy as _
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'.
@ -41,6 +42,22 @@ DATA_UPLOAD_MAX_NUMBER_FIELDS = 3000
# Application definition
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.contatos",
"sigi.apps.convenios",
@ -53,22 +70,6 @@ INSTALLED_APPS = [
"sigi.apps.servicos",
"sigi.apps.servidores",
"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 = [
@ -107,7 +108,7 @@ DEFAULT_FROM_EMAIL = env(
SERVER_EMAIL = DEFAULT_FROM_EMAIL
# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
DATABASES = {
"default": env.db(),
@ -127,6 +128,7 @@ TEMPLATES = [
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"django.template.context_processors.media",
"djbs.context_processors.sets",
"sigi.apps.utils.context_processors.site_context",
"sigi.apps.home.context_processors.dashboard",
],
@ -139,7 +141,7 @@ FORM_RENDERER = "django.forms.renderers.TemplatesSetting"
WSGI_APPLICATION = "sigi.wsgi.application"
# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/
# https://docs.djangoproject.com/en/5.0/topics/i18n/
LANGUAGE_CODE = "pt-br"
@ -154,7 +156,7 @@ USE_TZ = True
USE_THOUSAND_SEPARATOR = True
# 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 = [
{
@ -214,7 +216,7 @@ LOGIN_REDIRECT_URL = "home_index"
# 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/"
STATICFILES_DIRS = [
@ -223,13 +225,13 @@ STATICFILES_DIRS = [
STATIC_ROOT = BASE_DIR / "../static/"
# 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_URL = "media/"
# 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"
@ -243,20 +245,18 @@ IMPORT_EXPORT_SKIP_ADMIN_LOG = True
br_formats.DATE_FORMAT = br_formats.SHORT_DATE_FORMAT
br_formats.DATETIME_FORMAT = br_formats.SHORT_DATETIME_FORMAT
# Django Material Admin settings
# https://github.com/MaistrenkoAnton/django-material-admin#django-material-administration
MATERIAL_ADMIN_SITE = {
"HEADER": _("SIGI - Sistema de Informações do Interlegis"),
"TITLE": _("SIGI"),
"FAVICON": "img/favicon.ico",
"PROFILE_PICTURE": "img/interlegis.jpeg", # Admin site profile picture (path to static should be specified)
"PROFILE_BG": "img/engitec.jpeg", # Admin site profile background (path to static should be specified)
"LOGIN_LOGO": "img/interlegis.jpeg", # Admin site logo on login page (path to static should be specified)
"LOGOUT_BG": "img/engitec.jpeg", # Admin site background on login/logout pages (path to static should be specified)
"SHOW_THEMES": False, # Show default admin themes button
"TRAY_REVERSE": False, # Hide object-tools and additional-submit-line by default
"NAVBAR_REVERSE": False, # Hide side navbar by default
# djbs-theme settings - Django Bootstrap Theme
# https://github.com/interlegis/djbs-theme/?tab=readme-ov-file#customizing
DJBSTHEME_DEFAULTS = {
"SEARCH_URL": None,
"SEARCH_PARAM": None,
"MENU_FILE": BASE_DIR / "menu_conf.yaml",
"CHECK_AS_SWITCH": True,
"FILTER_STYLE": djbs_constants.FILTER_STYLE_CLASSIC,
"FIELDSET_STYLE": djbs_constants.STYLE_CARD,
"INLINESET_STYLE": djbs_constants.STYLE_CARD,
"BADGERIZE_FACETS": True,
}
# tinyMCE rich text editor settings

Loading…
Cancel
Save