Browse Source

Issue #68 in progress

pull/98/head
LeandroRoberto 9 years ago
parent
commit
ad6f59236e
  1. 141
      compilacao/forms.py
  2. 39
      compilacao/migrations/0041_auto_20160109_1928.py
  3. 22
      compilacao/models.py
  4. 13
      compilacao/urls.py
  5. 2
      compilacao/utils.py
  6. 125
      compilacao/views.py
  7. 38
      templates/compilacao/detail.html
  8. 82
      templates/compilacao/list.html
  9. 85
      templates/compilacao/publicacao_detail.html
  10. 81
      templates/compilacao/publicacao_list.html
  11. 2
      templates/compilacao/textoarticulado_detail.html
  12. 2
      templates/compilacao/textoarticulado_list.html

141
compilacao/forms.py

@ -10,7 +10,8 @@ from django.utils.translation import ugettext_lazy as _
from compilacao.models import (PARTICIPACAO_SOCIAL_CHOICES, Dispositivo, Nota, from compilacao.models import (PARTICIPACAO_SOCIAL_CHOICES, Dispositivo, Nota,
TextoArticulado, TipoNota, TipoTextoArticulado, TextoArticulado, TipoNota, TipoTextoArticulado,
TipoVide, Vide) TipoVide, Vide, TipoPublicacao,
VeiculoPublicacao, Publicacao)
from compilacao.utils import YES_NO_CHOICES, FormLayout, to_column, to_row from compilacao.utils import YES_NO_CHOICES, FormLayout, to_column, to_row
@ -19,7 +20,7 @@ class UpLoadImportFileForm(forms.Form):
required=True, required=True,
label=_('Arquivo formato ODF para Importanção')) label=_('Arquivo formato ODF para Importanção'))
nota_error_messages = { error_messages = {
'required': _('Este campo é obrigatório'), 'required': _('Este campo é obrigatório'),
'invalid': _('URL inválida.') 'invalid': _('URL inválida.')
} }
@ -30,11 +31,16 @@ ta_error_messages = {
class TipoTaForm(ModelForm): class TipoTaForm(ModelForm):
sigla = forms.CharField(label='Sigla') sigla = forms.CharField(
descricao = forms.CharField(label='Descrição') label=TipoTextoArticulado._meta.get_field(
'sigla').verbose_name)
descricao = forms.CharField(
label=TipoTextoArticulado._meta.get_field(
'descricao').verbose_name)
participacao_social = forms.NullBooleanField( participacao_social = forms.NullBooleanField(
label=_('Participação Social'), label=TipoTextoArticulado._meta.get_field(
'participacao_social').verbose_name,
widget=forms.Select(choices=YES_NO_CHOICES), widget=forms.Select(choices=YES_NO_CHOICES),
required=True) required=True)
@ -64,15 +70,22 @@ class TipoTaForm(ModelForm):
class TaForm(ModelForm): class TaForm(ModelForm):
tipo_ta = forms.ModelChoiceField( tipo_ta = forms.ModelChoiceField(
label=_('Tipo do Texto Articulado'), label=TipoTextoArticulado._meta.verbose_name,
queryset=TipoTextoArticulado.objects.all(), queryset=TipoTextoArticulado.objects.all(),
required=True, required=True,
empty_label=None) empty_label=None)
numero = forms.IntegerField(label=_('Número'), required=True) numero = forms.IntegerField(
ano = forms.IntegerField(label=_('Ano'), required=True) label=TextoArticulado._meta.get_field(
'numero').verbose_name,
required=True)
ano = forms.IntegerField(
label=TextoArticulado._meta.get_field(
'ano').verbose_name,
required=True)
data = forms.DateField( data = forms.DateField(
label=_('Data'), label=TextoArticulado._meta.get_field(
'data').verbose_name,
input_formats=['%d/%m/%Y'], input_formats=['%d/%m/%Y'],
required=True, required=True,
widget=forms.DateInput( widget=forms.DateInput(
@ -89,7 +102,8 @@ class TaForm(ModelForm):
error_messages=ta_error_messages, error_messages=ta_error_messages,
required=False) required=False)
participacao_social = forms.NullBooleanField( participacao_social = forms.NullBooleanField(
label=_('Participação Social'), label=TextoArticulado._meta.get_field(
'participacao_social').verbose_name,
widget=forms.Select(choices=PARTICIPACAO_SOCIAL_CHOICES), widget=forms.Select(choices=PARTICIPACAO_SOCIAL_CHOICES),
required=False) required=False)
@ -117,9 +131,11 @@ class TaForm(ModelForm):
self.helper = FormHelper() self.helper = FormHelper()
self.helper.layout = FormLayout( self.helper.layout = FormLayout(
Fieldset(_('Identificação Básica'), row1, css_class="large-12"), Fieldset(_('Identificação Básica'), row1, css_class="large-12"),
Fieldset(_('Ementa'), Column('ementa'), css_class="large-12"), Fieldset(TextoArticulado._meta.get_field(
'ementa').verbose_name, Column('ementa'), css_class="large-12"),
Fieldset( Fieldset(
_('Observações'), Column('observacao'), css_class="large-12"), TextoArticulado._meta.get_field(
'observacao').verbose_name, Column('observacao'), css_class="large-12"),
) )
@ -143,11 +159,11 @@ class NotaForm(ModelForm):
texto = forms.CharField( texto = forms.CharField(
label='', label='',
widget=forms.Textarea, widget=forms.Textarea,
error_messages=nota_error_messages) error_messages=error_messages)
url_externa = forms.URLField( url_externa = forms.URLField(
label='', label='',
required=False, required=False,
error_messages=nota_error_messages) error_messages=error_messages)
publicidade = forms.ChoiceField( publicidade = forms.ChoiceField(
required=True, required=True,
label=_('Publicidade'), label=_('Publicidade'),
@ -166,7 +182,7 @@ class NotaForm(ModelForm):
required=True, required=True,
widget=forms.DateInput( widget=forms.DateInput(
format='%d/%m/%Y'), format='%d/%m/%Y'),
error_messages=nota_error_messages error_messages=error_messages
) )
efetividade = forms.DateField( efetividade = forms.DateField(
label=_('Efetividade'), label=_('Efetividade'),
@ -174,7 +190,7 @@ class NotaForm(ModelForm):
required=True, required=True,
widget=forms.DateInput( widget=forms.DateInput(
format='%d/%m/%Y'), format='%d/%m/%Y'),
error_messages=nota_error_messages) error_messages=error_messages)
dispositivo = forms.ModelChoiceField(queryset=Dispositivo.objects.all(), dispositivo = forms.ModelChoiceField(queryset=Dispositivo.objects.all(),
widget=forms.HiddenInput()) widget=forms.HiddenInput())
pk = forms.IntegerField(widget=forms.HiddenInput(), pk = forms.IntegerField(widget=forms.HiddenInput(),
@ -210,7 +226,7 @@ class NotaForm(ModelForm):
('publicidade', 3), ('publicidade', 3),
('publicacao', 3), ('publicacao', 3),
('efetividade', 3), ('efetividade', 3),
(Button('submit', 'Salvar', (Button('submit', _('Salvar'),
css_class='button primary radius'), 3) css_class='button primary radius'), 3)
]) ])
@ -235,7 +251,7 @@ class VideForm(ModelForm):
widget=forms.HiddenInput()) widget=forms.HiddenInput())
tipo_ta = forms.ModelChoiceField( tipo_ta = forms.ModelChoiceField(
label='Tipo do Texto Articulado', label=_('Tipo do Texto Articulado'),
queryset=TipoTextoArticulado.objects.all(), queryset=TipoTextoArticulado.objects.all(),
required=False) required=False)
num_ta = forms.IntegerField( num_ta = forms.IntegerField(
@ -248,10 +264,10 @@ class VideForm(ModelForm):
widget=forms.Textarea, widget=forms.Textarea,
required=False) required=False)
tipo = forms.ModelChoiceField( tipo = forms.ModelChoiceField(
label=_('Tipo do Vide'), label=TipoVide._meta.verbose_name,
queryset=TipoVide.objects.all(), queryset=TipoVide.objects.all(),
required=True, required=True,
error_messages=nota_error_messages) error_messages=error_messages)
busca_dispositivo = forms.CharField( busca_dispositivo = forms.CharField(
label=_('Buscar Dispositivo a Referenciar'), label=_('Buscar Dispositivo a Referenciar'),
@ -269,7 +285,7 @@ class VideForm(ModelForm):
error_messages = { error_messages = {
NON_FIELD_ERRORS: { NON_FIELD_ERRORS: {
'unique_together': 'unique_together':
"Ja existe um Vide deste tipo para o Dispositivo Referido ", _("Ja existe um Vide deste tipo para o Dispositivo Referido "),
} }
} }
@ -324,3 +340,86 @@ class VideForm(ModelForm):
) )
super(VideForm, self).__init__(*args, **kwargs) super(VideForm, self).__init__(*args, **kwargs)
class PublicacaoForm(ModelForm):
tipo_publicacao = forms.ModelChoiceField(
label=TipoPublicacao._meta.verbose_name,
queryset=TipoPublicacao.objects.all())
veiculo_publicacao = forms.ModelChoiceField(
label=VeiculoPublicacao._meta.verbose_name,
queryset=VeiculoPublicacao.objects.all())
url_externa = forms.CharField(
label=Publicacao._meta.get_field('url_externa').verbose_name,
required=False)
data = forms.DateField(
label=Publicacao._meta.get_field('data').verbose_name,
input_formats=['%d/%m/%Y'],
required=True,
widget=forms.DateInput(
format='%d/%m/%Y'),
error_messages=error_messages
)
numero = forms.IntegerField(
label=Publicacao._meta.get_field(
'numero').verbose_name,
required=False)
ano = forms.IntegerField(
label=Publicacao._meta.get_field(
'ano').verbose_name)
edicao = forms.IntegerField(
label=Publicacao._meta.get_field(
'edicao').verbose_name,
required=False)
pagina_inicio = forms.IntegerField(
label=Publicacao._meta.get_field(
'pagina_inicio').verbose_name,
required=False)
pagina_fim = forms.IntegerField(
label=Publicacao._meta.get_field(
'pagina_fim').verbose_name,
required=False)
ta = forms.ModelChoiceField(queryset=TextoArticulado.objects.all(),
widget=forms.HiddenInput())
class Meta:
model = Publicacao
fields = ['tipo_publicacao',
'veiculo_publicacao',
'url_externa',
'data',
'numero',
'ano',
'edicao',
'pagina_inicio',
'pagina_fim',
'ta']
def __init__(self, *args, **kwargs):
row1 = to_row([
('tipo_publicacao', 3),
('data', 3),
('ano', 2),
('numero', 2),
('edicao', 2),
])
row2 = to_row([
('veiculo_publicacao', 3),
('pagina_inicio', 2),
('pagina_fim', 2),
('url_externa', 5),
])
self.helper = FormHelper()
self.helper.layout = FormLayout(
Fieldset(Publicacao._meta.verbose_name,
row1, row2, css_class="large-12"))
super(PublicacaoForm, self).__init__(*args, **kwargs)
pass

39
compilacao/migrations/0041_auto_20160109_1928.py

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('compilacao', '0040_auto_20160106_1956'),
]
operations = [
migrations.RenameField(
model_name='publicacao',
old_name='publicacao',
new_name='data',
),
migrations.AddField(
model_name='publicacao',
name='ano',
field=models.PositiveIntegerField(null=True, verbose_name='Pg. Início', blank=True),
),
migrations.AddField(
model_name='publicacao',
name='edicao',
field=models.PositiveIntegerField(null=True, verbose_name='Pg. Início', blank=True),
),
migrations.AddField(
model_name='publicacao',
name='numero',
field=models.PositiveIntegerField(null=True, verbose_name='Pg. Início', blank=True),
),
migrations.AddField(
model_name='publicacao',
name='url_externa',
field=models.CharField(max_length=1024, verbose_name='Link para Versão Eletrônica', blank=True),
),
]

22
compilacao/models.py

@ -443,7 +443,22 @@ class Publicacao(TimestampedMixin):
VeiculoPublicacao, verbose_name=_('Veículo de Publicação')) VeiculoPublicacao, verbose_name=_('Veículo de Publicação'))
tipo_publicacao = models.ForeignKey( tipo_publicacao = models.ForeignKey(
TipoPublicacao, verbose_name=_('Tipo de Publicação')) TipoPublicacao, verbose_name=_('Tipo de Publicação'))
publicacao = models.DateTimeField(verbose_name=_('Data de Publicação'))
data = models.DateTimeField(verbose_name=_('Data de Publicação'))
numero = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_('Número'))
ano = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_('Ano'))
edicao = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_('Edição'))
url_externa = models.CharField(
max_length=1024,
blank=True,
verbose_name=_('Link para Versão Eletrônica'))
pagina_inicio = models.PositiveIntegerField( pagina_inicio = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_('Pg. Início')) blank=True, null=True, verbose_name=_('Pg. Início'))
pagina_fim = models.PositiveIntegerField( pagina_fim = models.PositiveIntegerField(
@ -454,7 +469,10 @@ class Publicacao(TimestampedMixin):
verbose_name_plural = _('Publicações') verbose_name_plural = _('Publicações')
def __str__(self): def __str__(self):
return '%s: %s' % (self.veiculo_publicacao, self.publicacao) return '%s\n%s: %s' % (
self.ta,
self.tipo_publicacao,
defaultfilters.date(self.data, "d \d\e F \d\e Y"))
class Dispositivo(BaseModel, TimestampedMixin): class Dispositivo(BaseModel, TimestampedMixin):

13
compilacao/urls.py

@ -61,6 +61,19 @@ urlpatterns_compilacao = [
views.DispositivoSearchFragmentFormView.as_view(), views.DispositivoSearchFragmentFormView.as_view(),
name='search_dispositivo'), name='search_dispositivo'),
url(r'^(?P<ta_id>[0-9]+)/publicacao$',
views.PublicacaoListView.as_view(), name='ta_pub_list'),
url(r'^(?P<ta_id>[0-9]+)/publicacao/create$',
views.PublicacaoCreateView.as_view(), name='ta_pub_create'),
url(r'^(?P<ta_id>[0-9]+)/publicacao/(?P<pk>[0-9]+)$',
views.PublicacaoDetailView.as_view(), name='ta_pub_detail'),
url(r'^(?P<ta_id>[0-9]+)/publicacao/(?P<pk>[0-9]+)/edit$',
views.PublicacaoUpdateView.as_view(), name='ta_pub_edit'),
url(r'^(?P<ta_id>[0-9]+)/publicacao/(?P<pk>[0-9]+)/delete$',
views.PublicacaoDeleteView.as_view(), name='ta_pub_delete'),
url(r'^config/tipo-textoarticulado$', url(r'^config/tipo-textoarticulado$',
views.TipoTaListView.as_view(), name='tipo_ta_list'), views.TipoTaListView.as_view(), name='tipo_ta_list'),
url(r'^config/tipo-textoarticulado/create$', url(r'^config/tipo-textoarticulado/create$',

2
compilacao/utils.py

@ -194,7 +194,7 @@ def build_crud(model, help_path, layout):
def get_template_names(self): def get_template_names(self):
names = super(BaseMixin, self).get_template_names() names = super(BaseMixin, self).get_template_names()
names.append("crud/%s.html" % names.append("compilacao/%s.html" %
self.template_name_suffix.lstrip('_')) self.template_name_suffix.lstrip('_'))
return names return names

125
compilacao/views.py

@ -1,6 +1,6 @@
import sys
from collections import OrderedDict from collections import OrderedDict
from datetime import datetime, timedelta from datetime import datetime, timedelta
import sys
from braces.views import FormMessagesMixin from braces.views import FormMessagesMixin
from django import forms from django import forms
@ -21,13 +21,15 @@ from django.views.generic.edit import CreateView, DeleteView, UpdateView
from django.views.generic.list import ListView from django.views.generic.list import ListView
from compilacao import utils from compilacao import utils
from compilacao.forms import NotaForm, TaForm, TipoTaForm, VideForm from compilacao.forms import NotaForm, TaForm, TipoTaForm, VideForm,\
PublicacaoForm
from compilacao.models import (Dispositivo, Nota, from compilacao.models import (Dispositivo, Nota,
PerfilEstruturalTextoArticulado, PerfilEstruturalTextoArticulado,
TextoArticulado, TipoDispositivo, TipoNota, TextoArticulado, TipoDispositivo, TipoNota,
TipoPublicacao, TipoTextoArticulado, TipoVide, TipoPublicacao, TipoTextoArticulado, TipoVide,
VeiculoPublicacao, Vide) VeiculoPublicacao, Vide, Publicacao)
from compilacao.utils import build_crud from compilacao.utils import build_crud, NO_ENTRIES_MSG
DISPOSITIVO_SELECT_RELATED = ( DISPOSITIVO_SELECT_RELATED = (
'tipo_dispositivo', 'tipo_dispositivo',
@ -160,19 +162,25 @@ class CompMixin(object):
@property @property
def title(self): def title(self):
return self.get_object() try:
return self.get_object()
except:
return self.object
class TipoTaListView(ListView): class TipoTaListView(ListView):
model = TipoTextoArticulado model = TipoTextoArticulado
paginate_by = 10 paginate_by = 10
verbose_name = model._meta.verbose_name verbose_name = model._meta.verbose_name
create_url = reverse_lazy('tipo_ta_create')
@property @property
def title(self): def title(self):
return self.model._meta.verbose_name_plural return self.model._meta.verbose_name_plural
@property
def create_url(self):
return reverse_lazy('tipo_ta_create')
class TipoTaCreateView(FormMessagesMixin, CreateView): class TipoTaCreateView(FormMessagesMixin, CreateView):
model = TipoTextoArticulado model = TipoTextoArticulado
@ -239,12 +247,15 @@ class TaListView(ListView):
model = TextoArticulado model = TextoArticulado
paginate_by = 10 paginate_by = 10
verbose_name = model._meta.verbose_name verbose_name = model._meta.verbose_name
create_url = reverse_lazy('ta_create')
@property @property
def title(self): def title(self):
return self.model._meta.verbose_name_plural return self.model._meta.verbose_name_plural
@property
def create_url(self):
return reverse_lazy('ta_create')
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(TaListView, self).get_context_data(**kwargs) context = super(TaListView, self).get_context_data(**kwargs)
paginator = context['paginator'] paginator = context['paginator']
@ -316,7 +327,7 @@ class TaDeleteView(CompMixin, DeleteView):
return reverse_lazy('ta_list') return reverse_lazy('ta_list')
class TextView(ListView): class TextView(ListView, CompMixin):
template_name = 'compilacao/text_list.html' template_name = 'compilacao/text_list.html'
flag_alteradora = -1 flag_alteradora = -1
@ -1533,3 +1544,101 @@ class DispositivoSearchFragmentFormView(ListView):
except Exception as e: except Exception as e:
print(e) print(e)
class PublicacaoListView(ListView):
model = Publicacao
verbose_name = model._meta.verbose_name
@property
def title(self):
return _('%s de %s' % (
self.model._meta.verbose_name_plural,
self.ta))
@property
def ta(self):
ta = TextoArticulado.objects.get(pk=self.kwargs['ta_id'])
return ta
@property
def create_url(self):
return reverse_lazy(
'ta_pub_create',
kwargs={'ta_id': self.kwargs['ta_id']})
def get_queryset(self):
pubs = Publicacao.objects.filter(ta_id=self.kwargs['ta_id'])
return pubs
def get_context_data(self, **kwargs):
context = super(PublicacaoListView, self).get_context_data(**kwargs)
context['NO_ENTRIES_MSG'] = NO_ENTRIES_MSG
return context
class PublicacaoCreateView(FormMessagesMixin, CreateView):
model = Publicacao
form_class = PublicacaoForm
template_name = "compilacao/form.html"
form_valid_message = _('Registro criado com sucesso!')
form_invalid_message = _('O registro não foi criado.')
def get_success_url(self):
return reverse_lazy(
'ta_pub_detail',
kwargs={
'pk': self.object.id,
'ta_id': self.kwargs['ta_id']})
@property
def cancel_url(self):
return reverse_lazy(
'ta_pub_list',
kwargs={'ta_id': self.kwargs['ta_id']})
def get_initial(self):
return {'ta': self.kwargs['ta_id']}
class PublicacaoDetailView(CompMixin, DetailView):
model = Publicacao
class PublicacaoUpdateView(CompMixin, UpdateView):
model = Publicacao
form_class = PublicacaoForm
template_name = "compilacao/form.html"
def get(self, request, *args, **kwargs):
self.object = self.get_object()
form = self.get_form()
# if self.object and self.object.content_object:
# form.fields['tipo_ta'].required = False
# form.fields['tipo_ta'].widget.attrs['disabled'] = 'disabled'
return self.render_to_response(self.get_context_data(form=form))
def get_success_url(self):
return reverse_lazy('ta_pub_detail',
kwargs={
'pk': self.object.id,
'ta_id': self.kwargs['ta_id']})
@property
def cancel_url(self):
return self.get_success_url()
class PublicacaoDeleteView(CompMixin, DeleteView):
model = Publicacao
template_name = "compilacao/confirm_delete.html"
@property
def detail_url(self):
return reverse_lazy('ta_pub_detail',
kwargs={
'pk': self.object.id,
'ta_id': self.kwargs['ta_id']})
def get_success_url(self):
return reverse_lazy('ta_pub_list')

38
templates/compilacao/detail.html

@ -0,0 +1,38 @@
{% extends "base.html" %}
{% load i18n %}
{% block base_content %}
{# FIXME is this the best markup to use? #}
<div class="clearfix">
{% block actions %}
<dl class="sub-nav right">
<dd><a href="{{ view.update_url }}" class="button">{% trans 'Editar' %}</a></dd>
<dd><a href="{{ view.delete_url }}" class="button alert">{% trans 'Excluir' %}</a></dd>
</dl>
{% endblock actions %}
{% block sections_nav %}{% endblock %}
</div>
{% block detail_content %}
{# TODO replace fieldset for something semantically correct, but with similar visual grouping style #}
{% for fieldset in view.fieldsets %}
<fieldset>
<legend>{{ fieldset.legend }}</legend>
{% for row in fieldset.rows %}
<div class="row">
{% for column in row %}
<div class="columns large-{{ column.span }}">
<div id="div_id_{{ column.id }}" class="holder">
<label>{{ column.verbose_name }}</label> {# TODO replace labels, probably (are they correct here?) #}
<p>{{ column.text }}</p>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</fieldset>
{% endfor %}
{% endblock detail_content %}
{% endblock base_content %}

82
templates/compilacao/list.html

@ -0,0 +1,82 @@
{% extends "base.html" %}
{% load i18n %}
{% block base_content %}
{# FIXME is this the best markup to use? #}
<dl class="sub-nav">
<dd><a href="{{ view.create_url }}">
{% blocktrans with verbose_name=view.verbose_name %} Adicionar {{ verbose_name }} {% endblocktrans %}
</a></dd>
{% block more_buttons %}
{% endblock more_buttons %}
</dl>
{% if not rows %}
<p>{{ NO_ENTRIES_MSG }}</p>
{% else %}
<table class="table table-hover">
<thead>
<tr>
{% for name in headers %}
<th>{{ name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for value_list in rows %}
<tr>
{% for value, href in value_list %}
<td>
{% if href %}
<a href="{{ href }}">{{ value }}</a>
{% else %}
{{ value }}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% if is_paginated %}
<div class="pagination-centered">
<ul class="pagination" role="menubar" aria-label="Pagination">
{% if page_obj.has_previous %}
<li>
<a href="?page={{ page_obj.previous_page_number }}">
<span class="arrow">&laquo;</span>
</a>
</li>
{% else %}
<li class="arrow unavailable" aria-disabled="true"><a href="">&laquo;</a></li>
{% endif %}
{% for page in page_range %}
{% if page %}
<li {% if page == page_obj.number %}class="current"{% endif %}>
<a href="?page={{ page }}">{{ page }}</a>
</li>
{% else %}
<li class="unavailable" aria-disabled="true"><a href="">&hellip;</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li>
<a href="?page={{ page_obj.next_page_number }}">
<span class="arrow">&raquo;</span>
</a>
</li>
{% else %}
<li class="arrow unavailable" aria-disabled="true"><a href="">&raquo;</a></li>
{% endif %}
</ul>
</div>
{% endif %}
{% endblock %}

85
templates/compilacao/publicacao_detail.html

@ -0,0 +1,85 @@
{% extends "base.html" %} {% load i18n %} {% load compilacao_filters %}
{% block base_content %} {# FIXME is this the best markup to use? #}
<div class="clearfix">
{% block actions %}
<ul class="button-group right">
<li><a href="{% url 'ta_pub_edit' object.ta.pk object.pk %}" class="button tiny">{% trans 'Editar' %}</a></li>
<li><a href="{% url 'ta_pub_delete' object.ta.pk object.pk %}" class="button alert tiny">{% trans 'Excluir' %}</a></li>
</ul>
{% endblock actions %}
<dl class="sub-nav left">
{% block sections_nav %}
{% endblock %}
</dl>
</div>
{% block detail_content %} {# TODO replace fieldset for something semantically correct, but with similar visual grouping style #}
<fieldset>
<legend>{%trans 'Identificação Básica'%}</legend>
<div class="row">
<div class="columns large-3">
<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 id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'data' %}</label>
<p>{{ object.data}}</p>
</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 class="columns large-2">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'numero' %}</label>
<p>{{ object.numero|default:''}}</p>
</div>
</div>
<div class="columns large-2">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'edicao' %}</label>
<p>{{ object.edicao|default:''}}</p>
</div>
</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>
<p>{{ object.pagina_inicio|default:''}}</p>
</div>
</div>
<div class="columns large-2">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'pagina_fim' %}</label>
<p>{{ object.pagina_fim|default:''}}</p>
</div>
</div>
</div>
<div class="row">
<div class="columns large-12">
<div id="div_id_tipo" class="holder">
<label>{% field_verbose_name object 'url_externa' %}</label>
<p>{{ object.url_externa|default:''}}</p>
</div>
</div>
</div>
</fieldset>
{% endblock detail_content %}
{% endblock base_content %}

81
templates/compilacao/publicacao_list.html

@ -0,0 +1,81 @@
{% extends "base.html" %}
{% load i18n %}
{% load compilacao_filters %}
{% block base_content %}
<dl class="sub-nav">
<dd><a href="{{ view.create_url }}">
{% trans 'Adicionar'%} {%model_verbose_name 'Publicacao'%}
</a></dd>
{% block more_buttons %}
<dd><a href="{% url 'ta_text' view.kwargs|lookup:'ta_id' %}">{% trans 'Voltar' %}</a></dd>
{% endblock more_buttons %}
</dl>
{% if not object_list %}
<p>{{ NO_ENTRIES_MSG }}</p>
{% else %}
<table class="table">
<thead>
<tr>
<th>{% fieldclass_verbose_name 'Publicacao' 'data' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'numero' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'ano' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'edicao' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'veiculo_publicacao' %}</th>
<th>{% fieldclass_verbose_name 'Publicacao' 'tipo_publicacao' %}</th>
</tr>
</thead>
<tbody>
{% 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.numero|default:'' }}</td>
<td>{{ pub.ano|default:'' }}</td>
<td>{{ pub.edicao|default:'' }}</td>
<td>{{ pub.veiculo_publicacao }}</td>
<td>{{ pub.tipo_publicacao}}</td>
</tr>
{% endfor %}
</tbody>
</table>
{%endif%}
{% if is_paginated %}
<div class="pagination-centered">
<ul class="pagination" role="menubar" aria-label="Pagination">
{% if page_obj.has_previous %}
<li>
<a href="?page={{ page_obj.previous_page_number }}">
<span class="arrow">&laquo;</span>
</a>
</li>
{% else %}
<li class="arrow unavailable" aria-disabled="true"><a href="">&laquo;</a></li>
{% endif %}
{% for page in page_range %}
{% if page %}
<li {% if page == page_obj.number %}class="current"{% endif %}>
<a href="?page={{ page }}">{{ page }}</a>
</li>
{% else %}
<li class="unavailable" aria-disabled="true"><a href="">&hellip;</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li>
<a href="?page={{ page_obj.next_page_number }}">
<span class="arrow">&raquo;</span>
</a>
</li>
{% else %}
<li class="arrow unavailable" aria-disabled="true"><a href="">&raquo;</a></li>
{% endif %}
</ul>
</div>
{% endif %}
{% endblock %}

2
templates/compilacao/textoarticulado_detail.html

@ -26,7 +26,7 @@
{%else%} {%else%}
<dd><a href="{% url 'ta_detail' object.pk %}" class="button secondary">{% trans 'Início' %}</a></dd> <dd><a href="{% url 'ta_detail' object.pk %}" class="button secondary">{% trans 'Início' %}</a></dd>
{%endif%} {%endif%}
<dd><a href="#" class="button secondary">{% model_verbose_name_plural 'Publicacao' %}</a></dd> <dd><a href="{% url 'ta_pub_list' object.pk %}" class="button secondary">{% model_verbose_name_plural 'Publicacao' %}</a></dd>
<dd><a href="{% url 'ta_text' object.pk %}" class="button secondary">{% trans 'Texto' %}</a></dd> <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> <dd><a href="{% url 'ta_text_edit' object.pk %}" class="button secondary">{% trans 'Edição do Texto' %}</a></dd>

2
templates/compilacao/textoarticulado_list.html

@ -20,7 +20,7 @@
<dl class="sub-nav"> <dl class="sub-nav">
<dd><a href="{{ view.create_url }}"> <dd><a href="{{ view.create_url }}">
{% blocktrans with verbose_name=view.verbose_name %} Adicionar {{ verbose_name }} {% endblocktrans %} {% trans 'Adicionar'%} {%model_verbose_name 'TextoArticulado'%}
</a></dd> </a></dd>

Loading…
Cancel
Save