From f65e302a579c0929d6a1f7aef268f0ba8d6bbad6 Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Thu, 4 Nov 2021 15:10:33 -0300 Subject: [PATCH] Alterando campos do form de Eventos de Date para DateField --- .../migrations/0008_auto_20211104_1253.py | 26 +++++++++++++++++++ sigi/apps/eventos/models.py | 16 +++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 sigi/apps/eventos/migrations/0008_auto_20211104_1253.py diff --git a/sigi/apps/eventos/migrations/0008_auto_20211104_1253.py b/sigi/apps/eventos/migrations/0008_auto_20211104_1253.py new file mode 100644 index 0000000..2231f84 --- /dev/null +++ b/sigi/apps/eventos/migrations/0008_auto_20211104_1253.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('eventos', '0007_auto_20210417_0744'), + ] + + operations = [ + migrations.AlterField( + model_name='evento', + name='data_inicio', + field=models.DateTimeField(null=True, verbose_name='Data/hora do In\xedcio', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='evento', + name='data_termino', + field=models.DateTimeField(null=True, verbose_name='Data/hora do Termino', blank=True), + preserve_default=True, + ), + ] diff --git a/sigi/apps/eventos/models.py b/sigi/apps/eventos/models.py index 3fcb85f..964997c 100644 --- a/sigi/apps/eventos/models.py +++ b/sigi/apps/eventos/models.py @@ -1,8 +1,10 @@ # -*- coding: utf-8 -*- - +from datetime import datetime +import random from django.db import models from django.utils.functional import lazy from django.utils.translation import ugettext as _ +from django.contrib.contenttypes import generic from sigi.apps.casas.models import Orgao from sigi.apps.contatos.models import Municipio from sigi.apps.servidores.models import Servidor @@ -35,8 +37,16 @@ class Evento(models.Model): descricao = models.TextField(_(u"Descrição do evento")) virtual = models.BooleanField(_("Virtual"), default=False) solicitante = models.CharField(_(u"Solicitante"), max_length=100) - data_inicio = models.DateField(_(u"Data de início")) - data_termino = models.DateField(_(u"Data de término")) + data_inicio = models.DateTimeField( + _(u"Data/hora do Início"), + null=True, + blank=True + ) + data_termino = models.DateTimeField( + _(u"Data/hora do Termino"), + null=True, + blank=True + ) carga_horaria = models.PositiveIntegerField( _(u"carga horária"), default=0