Compare commits

..

No commits in common. "28269a3a93900511fa7b7e840df63a5a5e864b6b" and "47f005fd82f47cb05d59660ba692c655696c5b81" have entirely different histories.

8 changed files with 32 additions and 79 deletions

View File

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

View File

@ -55,26 +55,3 @@ class UserForm(forms.ModelForm):
self.save_m2m() self.save_m2m()
return obj 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 "" 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: 2020-12-22 16:24+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"
@ -34,20 +34,12 @@ msgstr "Usuarios con acceso al panel de control."
msgid "Users with access to everithing inside control panel." msgid "Users with access to everithing inside control panel."
msgstr "Usuarios con acceso a todo el panel de control." msgstr "Usuarios con acceso a todo el panel de control."
#: gas/config.py:14 gas/users/views.py:31 gas/users/views.py:39 #: gas/config.py:14 gas/users/views.py:31 gas/users/views.py:38
#: gas/users/views.py:49 gas/users/views.py:60 gas/users/views.py:96 #: gas/users/views.py:48 gas/users/views.py:59 gas/users/views.py:95
#: gas/users/views.py:108 #: gas/users/views.py:107
msgid "Users" msgid "Users"
msgstr "Usuarios" 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 #: gas/users/forms.py:9 templates/gas/users/user_list.html:10
msgid "Username" msgid "Username"
msgstr "Usuario" msgstr "Usuario"
@ -60,61 +52,57 @@ msgstr "Activo"
msgid "Roles" msgid "Roles"
msgstr "Roles" msgstr "Roles"
#: gas/users/views.py:32 #: gas/users/views.py:33
msgid "Manage users and set roles."
msgstr "Gestionar usuarios y asignar roles."
#: gas/users/views.py:34
msgid "New user" msgid "New user"
msgstr "Nuevo usuario" msgstr "Nuevo usuario"
#: gas/users/views.py:44 #: gas/users/views.py:43
msgid "Create user" msgid "Create user"
msgstr "Crear usuario" msgstr "Crear usuario"
#: gas/users/views.py:45 #: gas/users/views.py:44
msgid "User created" msgid "User created"
msgstr "Usuario creado" msgstr "Usuario creado"
#: gas/users/views.py:50 #: gas/users/views.py:49
msgid "Create" msgid "Create"
msgstr "Crear" msgstr "Crear"
#: gas/users/views.py:55 #: gas/users/views.py:54
msgid "Update user" msgid "Update user"
msgstr "Actulizar usuario" msgstr "Actulizar usuario"
#: gas/users/views.py:56 #: gas/users/views.py:55
msgid "User updated" msgid "User updated"
msgstr "Usuario actualizado" msgstr "Usuario actualizado"
#: gas/users/views.py:62 #: gas/users/views.py:61
msgid "Update" msgid "Update"
msgstr "Actualizar" msgstr "Actualizar"
#: gas/users/views.py:69 #: gas/users/views.py:68
msgid "User password updated" msgid "User password updated"
msgstr "Contraseña de usuario actualizada" msgstr "Contraseña de usuario actualizada"
#: gas/users/views.py:76 #: gas/users/views.py:75
#, python-brace-format #, python-brace-format
msgid "Change {username} user password" msgid "Change {username} user password"
msgstr "Cambiar la contraseña del usuario {username}" msgstr "Cambiar la contraseña del usuario {username}"
#: gas/users/views.py:98 templates/gas/base.html:23 #: gas/users/views.py:97 templates/gas/base.html:23
#: templates/gas/users/user_list.html:29 #: templates/gas/users/user_list.html:29
msgid "Change password" msgid "Change password"
msgstr "Cambiar contraseña" msgstr "Cambiar contraseña"
#: gas/users/views.py:103 #: gas/users/views.py:102
msgid "Delete user" msgid "Delete user"
msgstr "Borrar usuario" msgstr "Borrar usuario"
#: gas/users/views.py:104 #: gas/users/views.py:103
msgid "User deleted" msgid "User deleted"
msgstr "Usuario borrado" msgstr "Usuario borrado"
#: gas/users/views.py:110 templates/gas/delete_confirmation.html:20 #: gas/users/views.py:109 templates/gas/delete_confirmation.html:20
#: templates/gas/users/user_list.html:30 #: templates/gas/users/user_list.html:30
msgid "Delete" msgid "Delete"
msgstr "Borrar" msgstr "Borrar"
@ -143,19 +131,19 @@ msgstr "Salir"
msgid "Home" msgid "Home"
msgstr "Inicio" msgstr "Inicio"
#: templates/gas/base_form.html:23 templates/gas/delete_confirmation.html:21 #: templates/gas/base_form.html:20 templates/gas/delete_confirmation.html:21
msgid "Cancel" msgid "Cancel"
msgstr "Cancelar" msgstr "Cancelar"
#: templates/gas/base_form.html:26 #: templates/gas/base_form.html:23
msgid "Save" msgid "Save"
msgstr "Guardar" msgstr "Guardar"
#: templates/gas/base_form.html:29 #: templates/gas/base_form.html:26
msgid "Save and continue" msgid "Save and continue"
msgstr "Guardar y continuar" msgstr "Guardar y continuar"
#: templates/gas/base_list.html:14 #: templates/gas/base_list.html:24
msgid "Filter" msgid "Filter"
msgstr "Filtrar" msgstr "Filtrar"
@ -171,7 +159,7 @@ msgstr "Resumen"
msgid "Objects" msgid "Objects"
msgstr "Objetos" msgstr "Objetos"
#: templates/gas/login.html:6 templates/gas/login.html:15 #: templates/gas/login.html:7 templates/gas/login.html:15
msgid "Login" msgid "Login"
msgstr "Login" msgstr "Login"
@ -179,15 +167,16 @@ msgstr "Login"
msgid "Edit" msgid "Edit"
msgstr "Editar" msgstr "Editar"
#: views.py:45 #: views.py:44
msgid "Operation successful." msgid "Operation successful."
msgstr "Operación realizada." msgstr "Operación realizada."
#: views.py:181 #: views.py:170
#, python-brace-format #, python-brace-format
msgid "Are you sure you want to delete {object}?" msgid "Are your sure you want to delete {object}?"
msgstr "¿Seguro que quieres borrar {object}?" msgstr "¿Seguro que quieres borrar {object}?"
#: views.py:182 #: views.py:171
msgid "{object} deleted." #, python-format
msgstr "{object} borrado" msgid "%(obj)s deleted."
msgstr ""

View File

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

View File

@ -22,11 +22,6 @@ def base_form_field(field, css=None, container_class='', add_another_url=None, f
elif isinstance(field.field, forms.DateField): elif isinstance(field.field, forms.DateField):
field.field.widget.input_type = 'date' 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 field_template is None:
if isinstance(field.field.widget, forms.CheckboxInput): if isinstance(field.field.widget, forms.CheckboxInput):
field_template = 'gas/tags/forms/checkbox.html' field_template = 'gas/tags/forms/checkbox.html'

View File

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

View File

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