Compare commits

..

3 Commits

Author SHA1 Message Date
Ales (Shagi) Zabala Alava 976658a0cc Update spanish translations
continuous-integration/drone/push Build is passing Details
2021-03-23 18:00:02 +01:00
Ales (Shagi) Zabala Alava 8b23a92d2b multipart/form-data by default 2021-03-23 17:57:32 +01:00
Ales (Shagi) Zabala Alava bf3cf6f217 New templatetag for pagination 2021-03-02 16:16:55 +01:00
4 changed files with 83 additions and 3 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-08 14:15+0000\n" "POT-Creation-Date: 2021-03-23 16:58+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -175,6 +175,36 @@ msgstr "Objetos"
msgid "Login" msgid "Login"
msgstr "Login" msgstr "Login"
#: templates/gas/tags/pagination.html:9
msgid "Previous"
msgstr "Anterior"
#: templates/gas/tags/pagination.html:13
#, python-format
msgid ""
"\n"
" Page %(number)s of %(total)s\n"
" "
msgstr ""
"\n"
" Página %(number)s de %(total)s\n"
" "
#: templates/gas/tags/pagination.html:18
msgid "Next"
msgstr "Siguiente"
#: templates/gas/tags/pagination.html:23
#, python-format
msgid ""
"\n"
" From %(start)s to %(end)s of %(total_objects)s total items.\n"
" "
msgstr ""
"\n"
" De %(start)s a %(end)s de un total de %(total_objects)s items.\n"
" "
#: templates/gas/users/user_list.html:28 #: templates/gas/users/user_list.html:28
msgid "Edit" msgid "Edit"
msgstr "Editar" msgstr "Editar"
@ -189,5 +219,6 @@ msgid "Are you sure you want to delete {object}?"
msgstr "¿Seguro que quieres borrar {object}?" msgstr "¿Seguro que quieres borrar {object}?"
#: views.py:182 #: views.py:182
#, python-brace-format
msgid "{object} deleted." msgid "{object} deleted."
msgstr "{object} borrado" msgstr "{object} borrado"

View File

@ -4,7 +4,7 @@
{% load form_tags %} {% load form_tags %}
{% block content %} {% block content %}
<form action="." method="POST">{% csrf_token %} <form action="." method="POST" enctype="multipart/form-data">{% csrf_token %}
{% if is_popup %} {% if is_popup %}
<input type="hidden" name="_popup" value="1"> <input type="hidden" name="_popup" value="1">
{% endif %} {% endif %}

View File

@ -0,0 +1,28 @@
{% load i18n %}
{% load custom_gas_tags %}
{% if page %}
<nav class="pagination">
<ul>
{% if page.has_previous %}
<li>
<a href="?{% url_replace request page=page.previous_page_number %}">{% trans "Previous" %}</a>
</li>
{% endif %}
<li class="current">
{% blocktrans with number=page.number total=page.paginator.num_pages %}
Page {{ number }} of {{ total }}
{% endblocktrans %}
</li>
{% if page.has_next %}
<li><a href="?{% url_replace request page=page.next_page_number %}">{% trans "Next" %}</a></li>
{% endif %}
</ul>
<p>
{% blocktrans with start=page.start_index end=page.end_index total_objects=page.paginator.count %}
From {{ start }} to {{ end }} of {{ total_objects }} total items.
{% endblocktrans %}
</p>
</nav>
{% endif %}

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import datetime import datetime
import json
from urllib.parse import urlencode
from django import template from django import template
from django.utils.html import mark_safe from django.utils.html import mark_safe
@ -39,3 +40,23 @@ def display_boolean(value):
else: else:
render = '<i class="fas fa-times"></i>' render = '<i class="fas fa-times"></i>'
return mark_safe(render) return mark_safe(render)
@register.simple_tag
def url_replace(request, **kwargs):
query = request.GET.dict()
query.update(kwargs)
return urlencode(query)
@register.inclusion_tag("gas/tags/pagination.html")
def pagination(request, page):
return {
'request': request,
'page': page,
}
@register.filter
def to_json(data):
return mark_safe(json.dumps(data))