Browse Source

Fix formatting issues, changed cronometro & painel tables

pull/7/head
Edward Ribeiro 9 years ago
parent
commit
49dcab7920
  1. 20
      painel/migrations/0001_initial.py
  2. 62
      painel/migrations/0002_auto_20150908_1435.py
  3. 27
      painel/migrations/0002_auto_20150908_1818.py
  4. 27
      painel/migrations/0003_auto_20150908_1444.py
  5. 19
      painel/migrations/0003_cronometro_counter.py
  6. 45
      painel/migrations/0004_auto_20150908_1858.py
  7. 46
      painel/models.py
  8. 23
      painel/views.py
  9. 2
      sessao/views.py
  10. 26
      templates/painel/controller.html

20
painel/migrations/0001_initial.py

@ -13,20 +13,22 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Cronometro',
fields=[
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
('start', models.PositiveIntegerField()),
('reset', models.PositiveIntegerField()),
('stop', models.PositiveIntegerField()),
('tipo', models.CharField(choices=[('A', 'Aparte'), ('D', 'Discurso'), ('O', 'Ordem do dia')], max_length=1)),
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
('start', models.PositiveIntegerField(verbose_name='Iniciar cronômetro')),
('reset', models.PositiveIntegerField(verbose_name='Reiniciar cronômetro')),
('stop', models.PositiveIntegerField(verbose_name='Parar cronômetro')),
('data_painel', models.DateField(verbose_name='Data cronômetro')),
('tipo', models.CharField(max_length=1, choices=[('A', 'Aparte'), ('D', 'Discurso'), ('O', 'Ordem do dia')], verbose_name='Tipo Cronômetro')),
],
),
migrations.CreateModel(
name='Painel',
fields=[
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
('abrir', models.PositiveIntegerField()),
('fechar', models.PositiveIntegerField()),
('mostrar', models.CharField(choices=[('C', 'Completo'), ('P', 'Parlamentares'), ('V', 'Votação'), ('M', 'Mensagem')], max_length=1)),
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
('abrir', models.PositiveIntegerField(verbose_name='Abrir painel', default=0)),
('fechar', models.PositiveIntegerField(verbose_name='Fechar painel', default=1)),
('data_painel', models.DateField(verbose_name='Data painel')),
('mostrar', models.CharField(max_length=1, choices=[('C', 'Completo'), ('P', 'Parlamentares'), ('V', 'Votação'), ('M', 'Mensagem')], default='C')),
],
),
]

62
painel/migrations/0002_auto_20150908_1435.py

@ -1,62 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('painel', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='cronometro',
name='data',
field=models.DateField(null=True, verbose_name='Data cronômetro', auto_now_add=True),
),
migrations.AddField(
model_name='painel',
name='data_painel',
field=models.DateField(default=datetime.datetime(2015, 9, 8, 17, 35, 48, 279510, tzinfo=utc), verbose_name='Data painel', auto_now_add=True),
preserve_default=False,
),
migrations.AlterField(
model_name='cronometro',
name='reset',
field=models.PositiveIntegerField(verbose_name='Reiniciar cronômetro'),
),
migrations.AlterField(
model_name='cronometro',
name='start',
field=models.PositiveIntegerField(verbose_name='Iniciar cronômetro'),
),
migrations.AlterField(
model_name='cronometro',
name='stop',
field=models.PositiveIntegerField(verbose_name='Parar cronômetro'),
),
migrations.AlterField(
model_name='cronometro',
name='tipo',
field=models.CharField(choices=[('A', 'Aparte'), ('D', 'Discurso'), ('O', 'Ordem do dia')], verbose_name='Tipo Cronômetro', max_length=1),
),
migrations.AlterField(
model_name='painel',
name='abrir',
field=models.PositiveIntegerField(default=0, verbose_name='Abrir painel'),
),
migrations.AlterField(
model_name='painel',
name='fechar',
field=models.PositiveIntegerField(default=1, verbose_name='Fechar painel'),
),
migrations.AlterField(
model_name='painel',
name='mostrar',
field=models.CharField(default='C', choices=[('C', 'Completo'), ('P', 'Parlamentares'), ('V', 'Votação'), ('M', 'Mensagem')], max_length=1),
),
]

27
painel/migrations/0002_auto_20150908_1818.py

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('painel', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='painel',
name='abrir',
),
migrations.RemoveField(
model_name='painel',
name='fechar',
),
migrations.AddField(
model_name='painel',
name='aberto',
field=models.BooleanField(verbose_name='Abrir painel', default=False),
),
]

27
painel/migrations/0003_auto_20150908_1444.py

@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('painel', '0002_auto_20150908_1435'),
]
operations = [
migrations.AlterField(
model_name='cronometro',
name='data',
field=models.DateField(verbose_name='Data cronômetro', default=datetime.datetime(2015, 9, 8, 17, 44, 1, 708326, tzinfo=utc)),
preserve_default=False,
),
migrations.AlterField(
model_name='painel',
name='data_painel',
field=models.DateField(verbose_name='Data painel'),
),
]

19
painel/migrations/0003_cronometro_counter.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('painel', '0002_auto_20150908_1818'),
]
operations = [
migrations.AddField(
model_name='cronometro',
name='counter',
field=models.PositiveIntegerField(default=0),
),
]

45
painel/migrations/0004_auto_20150908_1858.py

@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('painel', '0003_cronometro_counter'),
]
operations = [
migrations.RemoveField(
model_name='cronometro',
name='counter',
),
migrations.RemoveField(
model_name='cronometro',
name='reset',
),
migrations.RemoveField(
model_name='cronometro',
name='start',
),
migrations.RemoveField(
model_name='cronometro',
name='stop',
),
migrations.AddField(
model_name='cronometro',
name='status',
field=models.CharField(max_length=1, verbose_name='Status do cronômetro', choices=[('I', 'Start'), ('R', 'Reset'), ('S', 'Stop')], default='S'),
),
migrations.AddField(
model_name='cronometro',
name='time',
field=models.FloatField(verbose_name='Start time', default=0),
),
migrations.AlterField(
model_name='cronometro',
name='data_painel',
field=models.DateField(verbose_name='Data do cronômetro'),
),
]

46
painel/models.py

@ -1,21 +1,6 @@
from django.db import models
class Cronometro(models.Model):
CRONOMETRO_TYPES = (
('A', 'Aparte'),
('D', 'Discurso'),
('O', 'Ordem do dia')
)
start = models.PositiveIntegerField(verbose_name='Iniciar cronômetro')
reset = models.PositiveIntegerField(verbose_name='Reiniciar cronômetro')
stop = models.PositiveIntegerField(verbose_name='Parar cronômetro')
data = models.DateField(verbose_name='Data cronômetro')
tipo = models.CharField(
max_length=1, choices=CRONOMETRO_TYPES, verbose_name='Tipo Cronômetro')
class Painel(models.Model):
PAINEL_TYPES = (
('C', 'Completo'),
@ -24,10 +9,31 @@ class Painel(models.Model):
('M', 'Mensagem'),
)
abrir = models.PositiveIntegerField(verbose_name='Abrir painel', default=0)
fechar = models.PositiveIntegerField(
verbose_name='Fechar painel', default=1)
aberto = models.BooleanField(verbose_name='Abrir painel', default=False)
data_painel = models.DateField(verbose_name='Data painel')
mostrar = models.CharField(max_length=1,
choices=PAINEL_TYPES,
default='C')
choices=PAINEL_TYPES, default='C')
class Cronometro(models.Model):
CRONOMETRO_TYPES = (
('A', 'Aparte'),
('D', 'Discurso'),
('O', 'Ordem do dia')
)
CRONOMETRO_STATUS = (
('I', 'Start'),
('R', 'Reset'),
('S', 'Stop'),
)
status = models.CharField(
max_length=1,
verbose_name='Status do cronômetro',
choices=CRONOMETRO_STATUS,
default='S')
time = models.FloatField(verbose_name='Start time', default=0)
data_painel = models.DateField(verbose_name='Data do cronômetro')
tipo = models.CharField(
max_length=1, choices=CRONOMETRO_TYPES, verbose_name='Tipo Cronômetro')

23
painel/views.py

@ -1,3 +1,5 @@
from datetime import date
from django.core import serializers
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
@ -8,28 +10,33 @@ from sessao.models import (OrdemDia, PresencaOrdemDia, RegistroVotacao,
SessaoPlenaria, SessaoPlenariaPresenca,
VotoParlamentar)
# UI views
# REST WS
def controlador_painel(request):
painel = Painel.objects.update_or_create(abrir=0, fechar=1, mostrar='C')[0]
painel_created = Painel.objects.get_or_create(data_painel=date.today())
painel = painel_created[0]
if request.method == 'POST':
if 'start-painel' in request.POST:
painel.abrir = 1
painel.fechar = 0
painel.aberto = True
painel.save()
elif 'stop-painel' in request.POST:
painel.abrir = 0
painel.fechar = 1
painel.aberto = False
painel.save()
elif 'save-painel' in request.POST:
painel.mostrar = request.POST['tipo_painel']
painel.save()
context = {'painel': painel}
print(painel.abrir)
context = {'painel': painel, 'PAINEL_TYPES': Painel.PAINEL_TYPES}
return render(request, 'painel/controller.html', context)
def cronometro_painel(request):
pass
def painel_view(request):
context = {'head_title': 'Painel Plenário',
'title': '3a. Sessao Ordinária do Município XYZ'}

2
sessao/views.py

@ -2,8 +2,10 @@ from django import forms
from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import FormMixin
from extra_views import InlineFormSetView
from parlamentares.models import Parlamentar
from sapl.crud import build_crud
from .models import (ExpedienteMateria, ExpedienteSessao, OrdemDia,
PresencaOrdemDia, RegistroVotacao, SessaoPlenaria,
SessaoPlenariaPresenca, TipoExpediente,

26
templates/painel/controller.html

@ -1,10 +1,24 @@
{% extends 'base.html' %}
{% load i18n %}
{% block base_content %}
<form method="post">
{% csrf_token %}
{{ painel.fechar }}<br/>
<input type="submit" name="start-painel" value="Abrir Painel">
<input type="submit" name="stop-painel" value="Fechar Painel">
</form>
STATUS:
{% if painel.aberto %}
ABERTO
{% else %}
FECHADO
{% endif %}
<br/>
<form method="post">
{% csrf_token %}
Tipo de painel: {{ painel.get_mostrar_display }}</br>
{% for id, value in PAINEL_TYPES %}
<input type="radio" name="tipo_painel" id="tipo_painel{{ forloop.counter }}" value="{{ id }}" {% if id == painel.mostrar %}checked="checked" {% endif %}>
<label for="tipo_painel{{ forloop.counter }}">{{ value }}</label><br />
{% endfor %}
</br>
<input type="submit" name="start-painel" value="Abrir Painel">
<input type="submit" name="stop-painel" value="Fechar Painel">
<input type="submit" name="save-painel" value="Salvar">
</form>
{% endblock %}

Loading…
Cancel
Save