Compare commits

..

3 Commits

Author SHA1 Message Date
Ales (Shagi) Zabala Alava 28269a3a93 Bump version: 0.4
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2021-01-11 17:57:39 +01:00
Ales (Shagi) Zabala Alava 525dcbf3bb Helper function to use SplitDateTimeField for datetimes 2021-01-11 16:15:57 +01:00
Ales (Shagi) Zabala Alava 3fd269474a Update spanish translation 2021-01-08 15:17:29 +01:00
8 changed files with 79 additions and 32 deletions

View File

@ -1,6 +1,15 @@
Changelog
=========
0.4
---
* Helper function to use SplitDateTimeField for datetimes
* Update spanish translation
0.3
---
* Allow extending GAS media files
* Allow actions in every view
* Enhance support for inline formsets

View File

@ -55,3 +55,26 @@ class UserForm(forms.ModelForm):
self.save_m2m()
return obj
def split_datetime_field(form, field_name):
old_field = form.fields[field_name]
new_field = forms.SplitDateTimeField(
label=old_field.label,
label_suffix=old_field.label_suffix,
required=old_field.required,
help_text=old_field.help_text,
initial=old_field.initial,
validators=old_field.validators,
localize=old_field.localize,
disabled=old_field.disabled,
input_date_formats=("%Y-%m-%d",),
input_time_formats=("%H:%M", "%H:%M:%S"),
widget=forms.SplitDateTimeWidget(
date_format='%Y-%m-%d',
time_format='%H:%M:%S',
time_attrs={'placeholder': '00:00'},
),
)
new_field.widget.widgets[0].input_type = 'date'
form.fields[field_name] = new_field

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-12-22 16:24+0000\n"
"POT-Creation-Date: 2021-01-08 14:15+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -34,12 +34,20 @@ msgstr "Usuarios con acceso al panel de control."
msgid "Users with access to everithing inside control panel."
msgstr "Usuarios con acceso a todo el panel de control."
#: gas/config.py:14 gas/users/views.py:31 gas/users/views.py:38
#: gas/users/views.py:48 gas/users/views.py:59 gas/users/views.py:95
#: gas/users/views.py:107
#: gas/config.py:14 gas/users/views.py:31 gas/users/views.py:39
#: gas/users/views.py:49 gas/users/views.py:60 gas/users/views.py:96
#: gas/users/views.py:108
msgid "Users"
msgstr "Usuarios"
#: gas/core/views.py:21
msgid "Change your password"
msgstr "Cambiar tu contraseña"
#: gas/core/views.py:22
msgid "Password changed."
msgstr "Contraseña cambiada."
#: gas/users/forms.py:9 templates/gas/users/user_list.html:10
msgid "Username"
msgstr "Usuario"
@ -52,57 +60,61 @@ msgstr "Activo"
msgid "Roles"
msgstr "Roles"
#: gas/users/views.py:33
#: gas/users/views.py:32
msgid "Manage users and set roles."
msgstr "Gestionar usuarios y asignar roles."
#: gas/users/views.py:34
msgid "New user"
msgstr "Nuevo usuario"
#: gas/users/views.py:43
#: gas/users/views.py:44
msgid "Create user"
msgstr "Crear usuario"
#: gas/users/views.py:44
#: gas/users/views.py:45
msgid "User created"
msgstr "Usuario creado"
#: gas/users/views.py:49
#: gas/users/views.py:50
msgid "Create"
msgstr "Crear"
#: gas/users/views.py:54
#: gas/users/views.py:55
msgid "Update user"
msgstr "Actulizar usuario"
#: gas/users/views.py:55
#: gas/users/views.py:56
msgid "User updated"
msgstr "Usuario actualizado"
#: gas/users/views.py:61
#: gas/users/views.py:62
msgid "Update"
msgstr "Actualizar"
#: gas/users/views.py:68
#: gas/users/views.py:69
msgid "User password updated"
msgstr "Contraseña de usuario actualizada"
#: gas/users/views.py:75
#: gas/users/views.py:76
#, python-brace-format
msgid "Change {username} user password"
msgstr "Cambiar la contraseña del usuario {username}"
#: gas/users/views.py:97 templates/gas/base.html:23
#: gas/users/views.py:98 templates/gas/base.html:23
#: templates/gas/users/user_list.html:29
msgid "Change password"
msgstr "Cambiar contraseña"
#: gas/users/views.py:102
#: gas/users/views.py:103
msgid "Delete user"
msgstr "Borrar usuario"
#: gas/users/views.py:103
#: gas/users/views.py:104
msgid "User deleted"
msgstr "Usuario borrado"
#: gas/users/views.py:109 templates/gas/delete_confirmation.html:20
#: gas/users/views.py:110 templates/gas/delete_confirmation.html:20
#: templates/gas/users/user_list.html:30
msgid "Delete"
msgstr "Borrar"
@ -131,19 +143,19 @@ msgstr "Salir"
msgid "Home"
msgstr "Inicio"
#: templates/gas/base_form.html:20 templates/gas/delete_confirmation.html:21
#: templates/gas/base_form.html:23 templates/gas/delete_confirmation.html:21
msgid "Cancel"
msgstr "Cancelar"
#: templates/gas/base_form.html:23
#: templates/gas/base_form.html:26
msgid "Save"
msgstr "Guardar"
#: templates/gas/base_form.html:26
#: templates/gas/base_form.html:29
msgid "Save and continue"
msgstr "Guardar y continuar"
#: templates/gas/base_list.html:24
#: templates/gas/base_list.html:14
msgid "Filter"
msgstr "Filtrar"
@ -159,7 +171,7 @@ msgstr "Resumen"
msgid "Objects"
msgstr "Objetos"
#: templates/gas/login.html:7 templates/gas/login.html:15
#: templates/gas/login.html:6 templates/gas/login.html:15
msgid "Login"
msgstr "Login"
@ -167,16 +179,15 @@ msgstr "Login"
msgid "Edit"
msgstr "Editar"
#: views.py:44
#: views.py:45
msgid "Operation successful."
msgstr "Operación realizada."
#: views.py:170
#: views.py:181
#, python-brace-format
msgid "Are your sure you want to delete {object}?"
msgid "Are you sure you want to delete {object}?"
msgstr "¿Seguro que quieres borrar {object}?"
#: views.py:171
#, python-format
msgid "%(obj)s deleted."
msgstr ""
#: views.py:182
msgid "{object} deleted."
msgstr "{object} borrado"

View File

@ -5,7 +5,6 @@
{% if field.errors %} has-error{% endif %}
">
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
{% add_widget_attrs field placeholder=field.label %}
{{ field }}
{% if add_another_url %}

View File

@ -22,6 +22,11 @@ def base_form_field(field, css=None, container_class='', add_another_url=None, f
elif isinstance(field.field, forms.DateField):
field.field.widget.input_type = 'date'
if isinstance(field.field, forms.SplitDateTimeField):
field.field.widget.widgets[1].attrs['placeholder'] = '00:00:00'
else:
field.field.widget.attrs['placeholder'] = field.label
if field_template is None:
if isinstance(field.field.widget, forms.CheckboxInput):
field_template = 'gas/tags/forms/checkbox.html'

View File

@ -178,7 +178,7 @@ class GASUpdateView(GASMixin, UpdateView):
class GASDeleteView(GASMixin, DeleteView):
template_name = "gas/delete_confirmation.html"
confirmation_text = _("Are your sure you want to delete {object}?")
confirmation_text = _("Are you sure you want to delete {object}?")
deleted_text = _("{object} deleted.")
def get_confirmation_text(self):

View File

@ -1,6 +1,6 @@
[metadata]
name = django-gas
version = 0.3
version = 0.4
description = An alternative to django admin
long_description = file: readme.md, changelog.md
long_description_content_type = text/markdown