Browse Source

Closed issue #68

pull/98/head
LeandroRoberto 9 years ago
parent
commit
95572bb266
  1. 22
      compilacao/forms.py
  2. 47
      compilacao/migrations/0042_auto_20160110_1620.py
  3. 19
      compilacao/migrations/0043_auto_20160110_1733.py
  4. 12
      compilacao/models.py
  5. 5
      compilacao/views.py
  6. 2
      static/styles/app.scss
  7. 7
      templates/base.html
  8. 36
      templates/compilacao/publicacao_detail.html
  9. 2
      templates/compilacao/publicacao_list.html
  10. 14
      templates/compilacao/textoarticulado_detail.html

22
compilacao/forms.py

@ -364,6 +364,11 @@ class PublicacaoForm(ModelForm):
format='%d/%m/%Y'),
error_messages=error_messages
)
hora = forms.TimeField(
label=Publicacao._meta.get_field('hora').verbose_name,
required=False,
widget=forms.TextInput(
attrs={'class': 'hora_hms'}))
numero = forms.IntegerField(
label=Publicacao._meta.get_field(
'numero').verbose_name,
@ -392,6 +397,7 @@ class PublicacaoForm(ModelForm):
'veiculo_publicacao',
'url_externa',
'data',
'hora',
'numero',
'ano',
'edicao',
@ -402,24 +408,28 @@ class PublicacaoForm(ModelForm):
def __init__(self, *args, **kwargs):
row1 = to_row([
('tipo_publicacao', 3),
('data', 3),
('tipo_publicacao', 4),
('veiculo_publicacao', 6),
('ano', 2),
])
row2 = to_row([
('data', 4),
('hora', 4),
('numero', 2),
('edicao', 2),
])
row2 = to_row([
('veiculo_publicacao', 3),
row3 = to_row([
('pagina_inicio', 2),
('pagina_fim', 2),
('url_externa', 5),
('url_externa', 8),
])
self.helper = FormHelper()
self.helper.layout = FormLayout(
Fieldset(Publicacao._meta.verbose_name,
row1, row2, css_class="large-12"))
row1, row2, row3, css_class="large-12"))
super(PublicacaoForm, self).__init__(*args, **kwargs)
pass

47
compilacao/migrations/0042_auto_20160110_1620.py

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('compilacao', '0041_auto_20160109_1928'),
]
operations = [
migrations.AddField(
model_name='publicacao',
name='hora',
field=models.TimeField(default=datetime.datetime(
2016, 1, 10, 18, 20, 1, 151209, tzinfo=utc), verbose_name='Horário de Publicação'),
preserve_default=False,
),
migrations.AlterField(
model_name='publicacao',
name='ano',
field=models.PositiveIntegerField(
verbose_name='Ano', blank=True, null=True),
),
migrations.AlterField(
model_name='publicacao',
name='data',
field=models.DateField(verbose_name='Data de Publicação'),
),
migrations.AlterField(
model_name='publicacao',
name='edicao',
field=models.PositiveIntegerField(
verbose_name='Edição', blank=True, null=True),
),
migrations.AlterField(
model_name='publicacao',
name='numero',
field=models.PositiveIntegerField(
verbose_name='Número', blank=True, null=True),
),
]

19
compilacao/migrations/0043_auto_20160110_1733.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('compilacao', '0042_auto_20160110_1620'),
]
operations = [
migrations.AlterField(
model_name='publicacao',
name='hora',
field=models.TimeField(null=True, verbose_name='Horário de Publicação', blank=True),
),
]

12
compilacao/models.py

@ -420,7 +420,7 @@ class TipoPublicacao(models.Model):
verbose_name_plural = _('Tipos de Publicação')
def __str__(self):
return self.sigla + ' - ' + self.nome
return self.nome
class VeiculoPublicacao(models.Model):
@ -444,7 +444,9 @@ class Publicacao(TimestampedMixin):
tipo_publicacao = models.ForeignKey(
TipoPublicacao, verbose_name=_('Tipo de Publicação'))
data = models.DateTimeField(verbose_name=_('Data de Publicação'))
data = models.DateField(verbose_name=_('Data de Publicação'))
hora = models.TimeField(
blank=True, null=True, verbose_name=_('Horário de Publicação'))
numero = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_('Número'))
@ -469,10 +471,10 @@ class Publicacao(TimestampedMixin):
verbose_name_plural = _('Publicações')
def __str__(self):
return '%s\n%s: %s' % (
self.ta,
return _('%s realizada em %s \n %s') % (
self.tipo_publicacao,
defaultfilters.date(self.data, "d \d\e F \d\e Y"))
defaultfilters.date(self.data, "d \d\e F \d\e Y"),
self.ta)
class Dispositivo(BaseModel, TimestampedMixin):

5
compilacao/views.py

@ -1552,7 +1552,7 @@ class PublicacaoListView(ListView):
@property
def title(self):
return _('%s de %s' % (
return _('%s da %s' % (
self.model._meta.verbose_name_plural,
self.ta))
@ -1641,4 +1641,5 @@ class PublicacaoDeleteView(CompMixin, DeleteView):
'ta_id': self.kwargs['ta_id']})
def get_success_url(self):
return reverse_lazy('ta_pub_list')
return reverse_lazy('ta_pub_list',
kwargs={'ta_id': self.kwargs['ta_id']})

2
static/styles/app.scss

@ -175,7 +175,7 @@ position: relative;
display: table;
width: 100%;
height: 100%;
background-color: #fafafa;
background-color: #e9eaed;
color: #444444;
}

7
templates/base.html

@ -88,12 +88,12 @@
<li class="nav__sub-item"><a class="nav__sub-link" href="#">Relatórios</a></li> -->
</ul>
</li>
<!-- <li class="nav__item has-dropdown"><a class="nav__link">Normas Jurídicas</a>
<li class="nav__item has-dropdown"><a class="nav__link">{% trans 'Legislação'%}</a>
<ul class="nav__sub-nav dropdown">
<li class="nav__sub-item"><a class="nav__sub-link" href="#">Pesquisar</a></li>
<li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'normajuridica:list'%}">{% trans 'Normas Jurídicas'%}</a></li>
<li class="nav__sub-item"><a class="nav__sub-link" href="#">Índice de Assuntos</a></li>
</ul>
</li> -->
</li>
<li class="nav__item has-dropdown"><a class="nav__link">Sistema</a>
<ul class="nav__sub-nav dropdown">
<li class="nav__sub-item"><a class="nav__sub-link" href="/sistema">Tabelas Auxiliares</a></li>
@ -236,6 +236,7 @@
$('.rg').mask("0.000.000", {placeholder:"_.___.___"});
$('.titulo_eleitor').mask("0000.0000.0000.0000", {placeholder:"____.____.____.____"});
$('.hora').mask("00:00", {placeholder:"hh:mm"});
$('.hora_hms').mask("00:00:00", {placeholder:"hh:mm:ss"});
});
</script>

36
templates/compilacao/publicacao_detail.html

@ -19,24 +19,38 @@
<legend>{%trans 'Identificação Básica'%}</legend>
<div class="row">
<div class="columns large-3">
<div class="columns large-4">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'tipo_publicacao' %}</label>
<p>{{ object.tipo_publicacao}}</p>
</div>
</div>
<div class="columns large-3">
</div>
<div class="columns large-6">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'data' %}</label>
<p>{{ object.data}}</p>
<label>{% field_verbose_name object 'veiculo_publicacao' %}</label>
<p>{{ object.veiculo_publicacao}}</p>
</div>
</div>
</div>
<div class="columns large-2">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'ano' %}</label>
<p>{{ object.ano}}</p>
</div>
</div>
</div>
<div class="row">
<div class="columns large-4">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'data' %}</label>
<p>{{ object.data}}</p>
</div>
</div>
<div class="columns large-4">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'hora' %}</label>
<p>{{ object.hora|time:"H:i:s"}}</p>
</div>
</div>
<div class="columns large-2">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'numero' %}</label>
@ -51,12 +65,6 @@
</div>
</div>
<div class="row">
<div class="columns large-8">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'veiculo_publicacao' %}</label>
<p>{{ object.veiculo_publicacao}}</p>
</div>
</div>
<div class="columns large-2">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'pagina_inicio' %}</label>
@ -69,9 +77,7 @@
<p>{{ object.pagina_fim|default:''}}</p>
</div>
</div>
</div>
<div class="row">
<div class="columns large-12">
<div class="columns large-8">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'url_externa' %}</label>
<p>{{ object.url_externa|default:''}}</p>

2
templates/compilacao/publicacao_list.html

@ -21,6 +21,7 @@
<thead>
<tr>
<th>{% fieldclass_verbose_name 'Publicacao' 'data' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'hora' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'numero' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'ano' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'edicao' %}</th>
@ -32,6 +33,7 @@
{% for pub in object_list %}
<tr>
<td><a href="{% url 'ta_pub_detail' view.kwargs.ta_id pub.pk%}">{{ pub.data }}</a></td>
<td>{{ pub.hora|time:'H:i:s' }}</td>
<td>{{ pub.numero|default:'' }}</td>
<td>{{ pub.ano|default:'' }}</td>
<td>{{ pub.edicao|default:'' }}</td>

14
templates/compilacao/textoarticulado_detail.html

@ -19,19 +19,19 @@
</ul></li>
</ul>
{% endblock actions %}
<dl class="sub-nav left">
<ul class="button-group left">
{% block sections_nav %}
{% if object.content_object%}
<dd><a href="{% url object|urldetail_content_type object.content_object.pk %}" class="button secondary" title="{% trans 'Ir para '%}{{object.content_object}}">Início</a></dd>
<li><a href="{% url object|urldetail_content_type object.content_object.pk %}" class="tiny button secondary" title="{% trans 'Ir para '%}{{object.content_object}}">Início</a></li>
{%else%}
<dd><a href="{% url 'ta_detail' object.pk %}" class="button secondary">{% trans 'Início' %}</a></dd>
<li><a href="{% url 'ta_detail' object.pk %}" class="tiny button secondary">{% trans 'Início' %}</a></li>
{%endif%}
<dd><a href="{% url 'ta_pub_list' object.pk %}" class="button secondary">{% model_verbose_name_plural 'Publicacao' %}</a></dd>
<li><a href="{% url 'ta_pub_list' object.pk %}" class="tiny button secondary">{% model_verbose_name_plural 'Publicacao' %}</a></li>
<dd><a href="{% url 'ta_text' object.pk %}" class="button secondary">{% trans 'Texto' %}</a></dd>
<dd><a href="{% url 'ta_text_edit' object.pk %}" class="button secondary">{% trans 'Edição do Texto' %}</a></dd>
<li><a href="{% url 'ta_text' object.pk %}" class="tiny button secondary">{% trans 'Texto' %}</a></li>
<li><a href="{% url 'ta_text_edit' object.pk %}" class="tiny button secondary">{% trans 'Edição do Texto' %}</a></li>
{% endblock %}
</dl>
</ul>
</div>
{% block detail_content %} {# TODO replace fieldset for something semantically correct, but with similar visual grouping style #}

Loading…
Cancel
Save