Browse Source

Migração dos templates admin de todas as apps

stable/2.0
Breno Teixeira 11 years ago
parent
commit
8159642117
  1. 2
      sigi/apps/convenios/templates/convenios/change_list.html
  2. 16
      sigi/apps/diagnosticos/templates/admin/diagnosticos/diagnostico/change_form.html
  3. 19
      sigi/apps/diagnosticos/templates/admin/diagnosticos/diagnostico/change_list.html
  4. 19
      sigi/apps/metas/templates/admin/metas/planodiretor/change_list.html
  5. 14
      sigi/apps/parlamentares/templates/admin/parlamentares/parlamentar/change_form.html
  6. 13
      sigi/apps/parlamentares/templates/admin/parlamentares/parlamentar/change_list.html
  7. 1
      sigi/apps/servicos/admin.py
  8. 42
      sigi/apps/servicos/templates/admin/servicos/casaatendida/change_form.html
  9. 26
      sigi/apps/servicos/templates/admin/servicos/casaatendida/change_list.html
  10. 4
      sigi/apps/servicos/templates/admin/servicos/servico/change_list.html
  11. 10
      sigi/apps/servidores/admin.py
  12. 27
      sigi/apps/servidores/templates/admin/servidores/servidor/change_form.html
  13. 20
      sigi/apps/servidores/templates/admin/servidores/servidor/change_list.html

2
sigi/apps/convenios/templates/convenios/change_list.html

@ -26,7 +26,7 @@
<div id="toolbar"> <div id="toolbar">
<form id="changelist-search" action="" method="get"> <form id="changelist-search" action="" method="get">
<div><!-- DIV needed for valid HTML --> <div><!-- DIV needed for valid HTML -->
<label for="searchbar"><img src="/sigi/admin_media/img/admin/icon_searchbox.png" alt="Search" /></label> <label for="searchbar"><img src="/static/admin/img/icon_searchbox.png" alt="Search" /></label>
<input type="text" size="40" name="q" value="" id="searchbar" /> <input type="text" size="40" name="q" value="" id="searchbar" />
<label for="data_retorno_assinatura__gte">Conveniadas a partir de:</label> <label for="data_retorno_assinatura__gte">Conveniadas a partir de:</label>
<input type="text" size="10" name="data_retorno_assinatura__gte" value="" id="data_retorno_assinatura__gte" class="vDateField"/> <input type="text" size="10" name="data_retorno_assinatura__gte" value="" id="data_retorno_assinatura__gte" class="vDateField"/>

16
sigi/apps/diagnosticos/templates/admin/diagnosticos/diagnostico/change_form.html

@ -0,0 +1,16 @@
{% extends 'admin/change_form.html' %}
{% load i18n reporting_tags %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}css/admin/diagnosticos/diagnostico/change_form.css">
{% endblock %}
{% block object-tools %}
{% if change %}{% if not is_popup %}
<ul class="object-tools">
<li><a href="history/" class="historylink">{% trans "History" %}</a></li>
<li><a href="{{adminform.form.instance.get_absolute_url }}" class="viewsitelink">Ver em PDF</a></li>
</ul>
{% endif %}{% endif %}
{% endblock %}

19
sigi/apps/diagnosticos/templates/admin/diagnosticos/diagnostico/change_list.html

@ -0,0 +1,19 @@
{% extends "admin/change_list.html" %}
{% load i18n reporting_tags admin_list %}
{% block search %}
<div id="toolbar">
<form id="changelist-search" action="" method="get">
<div><!-- DIV needed for valid HTML -->
<label for="searchbar"><img src="{{ STATIC_URL }}admin/img/icon_searchbox.png" alt="Search" /></label>
<input type="text" size="40" name="q" value="" id="searchbar" />
<label for="data_visita_inicio__gte">Visitados a partir de:</label>
<input type="text" size="10" name="data_visita_inicio__gte" value="" id="data_visita_inicio__gte" class="vDateField"/>
<label for="data_visita_inicio__lte">até:</label>
<input type="text" size="10" name="data_visita_inicio__lte" value="" id="data_visita_inicio__lte" />
<input type="submit" value="Pesquisar" />
Datas podem ser: Um ano (aaaa), um mês (aaaa-mm) ou um dia (aaaa-mm-dd)
</div>
</form>
</div>
{% endblock %}

19
sigi/apps/metas/templates/admin/metas/planodiretor/change_list.html

@ -0,0 +1,19 @@
{% extends "admin/change_list.html" %}
{% load i18n reporting_tags admin_list %}
{% block search %}
<div id="toolbar">
<form id="changelist-search" action="" method="get">
<div><!-- DIV needed for valid HTML -->
<label for="searchbar"><img src="{{ STATIC_URL }}admin/img/icon_searchbox.png" alt="Search" /></label>
<input type="text" size="40" name="q" value="" id="searchbar" />
<label for="data_entrega__gte">Entregues a partir de:</label>
<input type="text" size="10" name="data_entrega__gte" value="" id="data_entrega__gte" class="vDateField"/>
<label for="data_entrega__lte">até:</label>
<input type="text" size="10" name="data_entrega__lte" value="" id="data_entrega__lte" />
<input type="submit" value="Pesquisar" />
Datas podem ser: Um ano (aaaa), um mês (aaaa-mm) ou um dia (aaaa-mm-dd)
</div>
</form>
</div>
{% endblock %}

14
sigi/apps/parlamentares/templates/admin/parlamentares/parlamentar/change_form.html

@ -0,0 +1,14 @@
{% extends "admin/change_form.html" %}
{% load i18n reporting_tags %}
{% block object-tools %}
{% if change %}{% if not is_popup %}
<ul class="object-tools">
<li><a href="report_complete/">Relatório</a></li>
<li><a href="labels/">Etiqueta</a></li>
<li><a href="labels_sem_presidente/">Etiqueta sem presidente</a></li>
<li><a href="history/" class="historylink">{% trans "History" %}</a></li>
{% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
</ul>
{% endif %}{% endif %}
{% endblock %}

13
sigi/apps/parlamentares/templates/admin/parlamentares/parlamentar/change_list.html

@ -0,0 +1,13 @@
{% extends "admin/change_list.html" %}
{% load admin_list i18n reporting_tags %}
{% block object-tools %}
<ul class="object-tools">
<li><a onclick="return showRelatedObjectLookupPopup(this);" href="carrinho/{{query_str}}">Carrinho / Exportar</a></li>
<li>
<a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">
{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
</a>
</li>
</ul>
{% endblock %}

1
sigi/apps/servicos/admin.py

@ -36,6 +36,7 @@ class ServicoFormAdmin(ModelForm):
id_casa = None id_casa = None
if id_casa: if id_casa:
print id_casa
casa = CasaAtendida.objects.get(pk=id_casa) casa = CasaAtendida.objects.get(pk=id_casa)
contatos = [(f.id, unicode(f)) for f in casa.funcionario_set.all()] contatos = [(f.id, unicode(f)) for f in casa.funcionario_set.all()]
self.fields['contato_tecnico'].choices = contatos self.fields['contato_tecnico'].choices = contatos

42
sigi/apps/servicos/templates/admin/servicos/casaatendida/change_form.html

@ -0,0 +1,42 @@
{% extends "admin/change_form.html" %}
{% load i18n admin_modify %}
{% block after_related_objects %}
{{ block.super }}
<div id="servico_list-group" class="inline-group">
<div class="tabular inline-related last-related">
<fieldset class="module">
<h2>Servicos</h2>
<table>
<thead>
<tr>
<th colspan="2">Tipo de serviço</th>
<th>Hospedagem no Interlegis?</th>
<th>Data de ativação</th>
<th>Data da última alteração</th>
<th>Data de desativação</th>
</tr>
</thead>
<tbody>
{% for srv in original.servico_set.all %}
<tr>
<td><p><a href="{% url 'admin:servicos_servico_change' srv.id %}">{{ srv.tipo_servico.sigla }}</a></p></td>
<td>{{ srv.tipo_servico }}</td>
<td><img alt="{{ srv.hospedagem_interlegis }}" src="{{ MEDIA_URL }}img/admin/icon-{{ srv.hospedagem_interlegis|yesno:'yes,no' }}.gif"></td>
<td>{{ srv.data_ativacao|date:'SHORT_DATE_FORMAT' }}</td>
<td>{{ srv.data_alteracao|date:'SHORT_DATE_FORMAT' }}</td>
<td>{{ srv.data_desativacao|date:'SHORT_DATE_FORMAT' }}</td>
</tr>
{% empty %}
<tr> <td colspan="6">Nenhum serviço cadastrado para esta Casa Legislativa</td> </tr>
{% endfor %}
<tr class="add-row">
<td colspan="6"><a href="{% url 'admin:servicos_servico_add' %}?id_casa={{ original.id }}">Adicionar outro Servico</a></td>
</tr>
</tbody>
</table>
</fieldset>
</div>
</div>
{% endblock %}

26
sigi/apps/servicos/templates/admin/servicos/casaatendida/change_list.html

@ -0,0 +1,26 @@
{% extends "admin/change_list.html" %}
{% load admin_list i18n admin_urls %}
{% block extrahead %}
{{ block.super }}
<script type="text/javascript">
function dismissRelatedLookupPopup(win, chosenId) {
win.close();
url = "{% url 'admin:servicos_casaatendida_changelist' %}" + chosenId;
// alert(url);
document.location.href = url;
}
</script>
{% endblock %}
{% block object-tools %}
<ul class="object-tools">
<li>
<a id="lookup_id_casa_legislativa" onclick="return showRelatedObjectLookupPopup(this);" href="{% url 'admin:casas_casalegislativa_changelist' %}?t=id&codigo_interlegis__exact=" class="addlink">
{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
</a>
</li>
</ul>
<input type="hidden" id="id_casa_legislativa" value="nenhum" onchange="alert('Eu mudei')"/>
{% endblock %}

4
sigi/apps/servicos/templates/admin/servicos/servico/change_list.html

@ -0,0 +1,4 @@
{% extends "admin/change_list.html" %}
{% block object-tools %}
{% endblock %}

10
sigi/apps/servidores/admin.py

@ -18,6 +18,7 @@ class FuncaoAdmin(admin.ModelAdmin):
'servidor__user__email', 'servidor__user__first_name', 'servidor__user__email', 'servidor__user__first_name',
'servidor__user__last_name', 'servidor__user__username') 'servidor__user__last_name', 'servidor__user__username')
class FeriasAdmin(admin.ModelAdmin): class FeriasAdmin(admin.ModelAdmin):
form = FeriasForm form = FeriasForm
list_display = ('servidor', 'inicio_ferias', 'fim_ferias') list_display = ('servidor', 'inicio_ferias', 'fim_ferias')
@ -27,9 +28,6 @@ class FeriasAdmin(admin.ModelAdmin):
'servidor__user__email', 'servidor__user__username') 'servidor__user__email', 'servidor__user__username')
from sigi.apps.utils.alphabetic_filter import AlphabeticFilter
class ServidorFilter(AlphabeticFilter): class ServidorFilter(AlphabeticFilter):
title = 'Nome do Servidor' title = 'Nome do Servidor'
parameter_name = 'servidor__nome_completo' parameter_name = 'servidor__nome_completo'
@ -92,6 +90,9 @@ class ServidorAdmin(admin.ModelAdmin):
return super(ServidorAdmin, self).lookup_allowed(lookup, value) or \ return super(ServidorAdmin, self).lookup_allowed(lookup, value) or \
lookup in ['user__is_active__exact'] lookup in ['user__is_active__exact']
def has_add_permission(self, request):
return False
def formfield_for_dbfield(self, db_field, **kwargs): def formfield_for_dbfield(self, db_field, **kwargs):
if db_field.name == 'foto': if db_field.name == 'foto':
request = kwargs.pop("request", None) request = kwargs.pop("request", None)
@ -99,9 +100,10 @@ class ServidorAdmin(admin.ModelAdmin):
return db_field.formfield(**kwargs) return db_field.formfield(**kwargs)
return super(ServidorAdmin,self).formfield_for_dbfield(db_field, **kwargs) return super(ServidorAdmin,self).formfield_for_dbfield(db_field, **kwargs)
admin.site.register(Servidor, ServidorAdmin) admin.site.register(Servidor, ServidorAdmin)
admin.site.register(Funcao, FuncaoAdmin) admin.site.register(Funcao, FuncaoAdmin)
admin.site.register(Ferias, FeriasAdmin) admin.site.register(Ferias, FeriasAdmin)
admin.site.register(Licenca, LicencaAdmin) admin.site.register(Licenca, LicencaAdmin)
admin.site.register(Servico) admin.site.register(Servico)
admin.site.register(Subsecretaria) admin.site.register(Subsecretaria)

27
sigi/apps/servidores/templates/admin/servidores/servidor/change_form.html

@ -0,0 +1,27 @@
{% extends 'admin/change_form.html' %}
{% block form_top %}
{% if adminform.form.instance.user %}
<fieldset class="module aligned">
<h2>Dados do servidor LDAP</h2>
<div class="form-row">
<div>
<label>Primeiro Nome:</label>
<p>{{adminform.form.instance.user.first_name}}</p>
</div>
</div>
<div class="form-row">
<div>
<label>Último Nome:</label>
<p>{{adminform.form.instance.user.last_name}}</p>
</div>
</div>
<div class="form-row">
<div>
<label>Email Principal:</label>
<p>{{adminform.form.instance.user.email}}</p>
</div>
</div>
</fieldset>
{% endif %}
{% endblock %}

20
sigi/apps/servidores/templates/admin/servidores/servidor/change_list.html

@ -0,0 +1,20 @@
{% extends 'admin/change_list.html' %}
{% load i18n reporting_tags %}
{% block object-tools %}
<ul class="object-tools">
<li>
<a href="/sigi/servidores/servidores_por_cargo.pdf" class="historylink">Relatório por cargo</a>
</li>
<li>
<a href="/sigi/servidores/servidores_por_funcao.pdf" class="historylink">Relatório por função</a>
</li>
{% if has_add_permission %}
<li>
<a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">
{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
</a>
</li>
{% endif %}
</ul>
{% endblock %}
Loading…
Cancel
Save