fix translate

This commit is contained in:
Cayo Puigdefabregas 2023-12-14 17:15:22 +01:00
parent a66d9d1b91
commit 9ae75b00ab
8 changed files with 21 additions and 21 deletions

View File

@ -19,9 +19,9 @@ from idhub_auth.models import User
class ImportForm(forms.Form):
did = forms.ChoiceField(choices=[])
schema = forms.ChoiceField(choices=[])
file_import = forms.FileField()
did = forms.ChoiceField(label=_("Did"), choices=[])
schema = forms.ChoiceField(label=_("Schema"), choices=[])
file_import = forms.FileField(label=_("File import"))
def __init__(self, *args, **kwargs):
self._schema = None

View File

@ -19,10 +19,6 @@ class RolesTable(tables.Table):
class DashboardTable(tables.Table):
type = tables.Column(verbose_name=_("Event"))
message = tables.Column(verbose_name=_("Description"))
created = tables.Column(verbose_name=_("Date"))
class Meta:
model = Event
template_name = "idhub/custom_table.html"

View File

@ -46,9 +46,10 @@ class Event(models.Model):
EV_USR_DEACTIVATED_BY_ADMIN = 29, "User deactivated"
EV_USR_ACTIVATED_BY_ADMIN = 30, "User activated"
created = models.DateTimeField(auto_now=True)
message = models.CharField(max_length=350)
created = models.DateTimeField(_("Date"), auto_now=True)
message = models.CharField(_("Description"), max_length=350)
type = models.PositiveSmallIntegerField(
_("Event"),
choices=Types.choices,
)
user = models.ForeignKey(
@ -403,7 +404,7 @@ class Event(models.Model):
class DID(models.Model):
created_at = models.DateTimeField(auto_now=True)
label = models.CharField(max_length=50)
label = models.CharField(_("Label"), max_length=50)
did = models.CharField(max_length=250)
# In JWK format. Must be stored as-is and passed whole to library functions.
# Example key material:

View File

@ -24,7 +24,7 @@
<td>{{ rol.name }}</td>
<td>{{ rol.description|default:""}}</td>
<td><a href="{% url 'idhub:admin_rol_edit' rol.id %}" title="{% trans 'Edit' %}"><i class="bi bi-pencil-square"></i></a></td>
<td><a href="{% url 'idhub:admin_rol_del' rol.id %}" title="{% trans 'Delete' %}"><i class="bi bi-trash"></i></a></td>
<td><a class="text-danger" href="{% url 'idhub:admin_rol_del' rol.id %}" title="{% trans 'Delete' %}"><i class="bi bi-trash"></i></a></td>
</tr>
{% endfor %}
</tbody>

View File

@ -26,7 +26,7 @@
<td>{{ service.description }}</td>
<td>{{ service.get_roles }}</td>
<td><a href="{% url 'idhub:admin_service_edit' service.id %}" title="{% trans 'Edit' %}"><i class="bi bi-pencil-square"></i></a></td>
<td><a href="{% url 'idhub:admin_service_del' service.id %}" title="{% trans 'Delete' %}"><i class="bi bi-trash"></i></a></td>
<td><a class="text-danger" href="{% url 'idhub:admin_service_del' service.id %}" title="{% trans 'Delete' %}"><i class="bi bi-trash"></i></a></td>
</tr>
{% endfor %}
</tbody>

View File

@ -21,7 +21,7 @@
<div class="card-body">
<div class="row border-bottom">
<div class="col-3">
First Name:
{% trans "First name" %}:
</div>
<div class="col-9 text-secondary">
{{ object.first_name|default:'' }}
@ -29,7 +29,7 @@
</div>
<div class="row border-bottom mt-3">
<div class="col-3">
Last Name:
{% trans "Last name" %}:
</div>
<div class="col-9 text-secondary">
{{ object.last_name|default:'' }}
@ -37,7 +37,7 @@
</div>
<div class="row mt-3">
<div class="col-3">
Email:
{% trans "Email address" %}:
</div>
<div class="col-9 text-secondary">
{{ object.email }}

View File

@ -52,7 +52,7 @@
<td>{{ membership.start_date|default:'' }}</td>
<td>{{ membership.end_date|default:'' }}</td>
<td><a href="{% url 'idhub:admin_people_membership_edit' membership.id %}" title="{% trans 'Edit' %}"><i class="bi bi-pencil-square"></i></a></td>
<td><a href="{% url 'idhub:admin_people_membership_del' membership.id %}" title="{% trans 'Delete' %}"><i class="bi bi-trash"></i></a></td>
<td><a class="text-danger" href="{% url 'idhub:admin_people_membership_del' membership.id %}" title="{% trans 'Delete' %}"><i class="bi bi-trash"></i></a></td>
</tr>
{% endfor %}
</tbody>
@ -84,7 +84,7 @@
<td>{{ rol.service.description }}</td>
<td>{{ rol.service.domain }}</td>
<td><a href="{% url 'idhub:admin_people_rol_edit' rol.id %}" title="{% trans 'Edit' %}"><i class="bi bi-pencil-square"></i></a></td>
<td><a href="{% url 'idhub:admin_people_rol_del' rol.id %}" title="{% trans 'Delete' %}"><i class="bi bi-trash"></i></a></td>
<td><a class="text-danger" href="{% url 'idhub:admin_people_rol_del' rol.id %}" title="{% trans 'Delete' %}"><i class="bi bi-trash"></i></a></td>
</tr>
{% endfor %}
</tbody>

View File

@ -6,17 +6,20 @@ from idhub_auth.models import User
class ProfileForm(forms.ModelForm):
first_name = forms.CharField(required=True)
last_name = forms.CharField(required=True)
first_name = forms.CharField(label=_("First name"), required=True)
last_name = forms.CharField(label=_("Last name"), required=True)
class Meta:
model = User
fields = ['first_name', 'last_name', 'email']
labels = {
'email': _('Email address'),
}
def clean_first_name(self):
first_name = super().clean()['first_name']
match = r'^[a-zA-ZäöüßÄÖÜáéíóúàèìòùÀÈÌÒÙÁÉÍÓÚßñÑçÇ\s\'-]+'
if not re.match(match, first_name):
if not re.fullmatch(match, first_name):
txt = _("The string must contain only characters and spaces")
raise forms.ValidationError(txt)
@ -25,7 +28,7 @@ class ProfileForm(forms.ModelForm):
def clean_last_name(self):
last_name = super().clean()['last_name']
match = r'^[a-zA-ZäöüßÄÖÜáéíóúàèìòùÀÈÌÒÙÁÉÍÓÚßñÑçÇ\s\'-]+'
if not re.match(match, last_name):
if not re.fullmatch(match, last_name):
txt = _("The string must contain only characters and spaces")
raise forms.ValidationError(txt)