Browse Source

Remove o botao de adicionar appconfig após a existencia deste

pull/663/head
Eduardo Calil 8 years ago
parent
commit
89ff84fdac
  1. 8
      sapl/base/templatetags/common_tags.py
  2. 49
      sapl/templates/base/appconfig_list.html

8
sapl/base/templatetags/common_tags.py

@ -118,3 +118,11 @@ def ultima_filiacao(value):
return ultima_filiacao.partido
else:
return None
@register.filter
def get_config_not_exists(user):
if not AppConfig.objects.all().exists():
return True
else:
return False

49
sapl/templates/base/appconfig_list.html

@ -0,0 +1,49 @@
{% extends "crud/list.html" %}
{% load i18n %}
{% load common_tags %}
<div class="actions btn-group pull-right" role="group">
{% if user|get_config_not_exists %}
<a href="{{ view.create_url }}" class="btn btn-default">
{% blocktrans with verbose_name=view.verbose_name %} Adicionar {{ verbose_name }} {% endblocktrans %}
</a>
{% endif %}
{% block more_buttons %}{% endblock more_buttons %}
</div>
<br/><br/>
{% block extra_content %} {% endblock %}
{% if not rows %}
<p>{{ NO_ENTRIES_MSG }}</p>
{% else %}
<table class="table table-striped 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|safe }}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% include "paginacao.html" %}
{% endblock %}
Loading…
Cancel
Save