add more translate texts
This commit is contained in:
parent
1d4596b267
commit
58474f8111
|
@ -1,5 +1,6 @@
|
|||
import django_tables2 as tables
|
||||
from django.utils.html import format_html
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from idhub.models import (
|
||||
Rol,
|
||||
|
@ -33,6 +34,7 @@ class ButtonColumn(tables.Column):
|
|||
|
||||
class UserTable(tables.Table):
|
||||
view_user = ButtonColumn(
|
||||
verbose_name=_("View"),
|
||||
linkify={
|
||||
"viewname": "idhub:admin_people",
|
||||
"args": [tables.A("pk")]
|
||||
|
@ -40,8 +42,8 @@ class UserTable(tables.Table):
|
|||
orderable=False
|
||||
)
|
||||
|
||||
membership = tables.Column(empty_values=())
|
||||
role = tables.Column(empty_values=())
|
||||
membership = tables.Column(verbose_name=_("Membership"), empty_values=())
|
||||
role = tables.Column(verbose_name=_("Role"), empty_values=())
|
||||
|
||||
def render_view_user(self):
|
||||
return format_html('<i class="bi bi-eye"></i>')
|
||||
|
@ -76,6 +78,7 @@ class UserTable(tables.Table):
|
|||
|
||||
class RolesTable(tables.Table):
|
||||
view_role = ButtonColumn(
|
||||
verbose_name=_("View"),
|
||||
linkify={
|
||||
"viewname": "idhub:admin_rol_edit",
|
||||
"args": [tables.A("pk")]
|
||||
|
@ -84,6 +87,7 @@ class RolesTable(tables.Table):
|
|||
)
|
||||
|
||||
delete_role = ButtonColumn(
|
||||
verbose_name=_("Delete"),
|
||||
linkify={
|
||||
"viewname": "idhub:admin_rol_del",
|
||||
"args": [tables.A("pk")]
|
||||
|
@ -107,6 +111,7 @@ class ServicesTable(tables.Table):
|
|||
domain = tables.Column(verbose_name="Service")
|
||||
role = tables.Column(empty_values=())
|
||||
edit_service = ButtonColumn(
|
||||
verbose_name=_("Edit"),
|
||||
linkify={
|
||||
"viewname": "idhub:admin_service_edit",
|
||||
"args": [tables.A("pk")]
|
||||
|
@ -115,6 +120,7 @@ class ServicesTable(tables.Table):
|
|||
)
|
||||
|
||||
delete_service = ButtonColumn(
|
||||
verbose_name=_("Delete"),
|
||||
linkify={
|
||||
"viewname": "idhub:admin_service_del",
|
||||
"args": [tables.A("pk")]
|
||||
|
@ -154,11 +160,12 @@ class DashboardTable(tables.Table):
|
|||
|
||||
|
||||
class CredentialTable(tables.Table):
|
||||
type = tables.Column(empty_values=())
|
||||
type = tables.Column(verbose_name=_("Type"), empty_values=())
|
||||
# Pending VerificableCredential description fix
|
||||
details = tables.Column(empty_values=(), orderable=False)
|
||||
issued_on = tables.Column(verbose_name="Issued")
|
||||
details = tables.Column(_("Details"), empty_values=(), orderable=False)
|
||||
issued_on = tables.Column(verbose_name=_("Issued"))
|
||||
view_credential = ButtonColumn(
|
||||
verbose_name=_("View"),
|
||||
linkify={
|
||||
"viewname": "idhub:admin_credential",
|
||||
"args": [tables.A("pk")]
|
||||
|
@ -187,7 +194,7 @@ class DIDTable(tables.Table):
|
|||
"args": [tables.A("pk")]
|
||||
},
|
||||
orderable=False,
|
||||
verbose_name="Edit DID"
|
||||
verbose_name="Edit"
|
||||
)
|
||||
delete_template_code = """<a class="text-danger"
|
||||
href="javascript:void()"
|
||||
|
@ -197,7 +204,7 @@ class DIDTable(tables.Table):
|
|||
><i class="bi bi-trash"></i></a>"""
|
||||
delete_did = tables.TemplateColumn(template_code=delete_template_code,
|
||||
orderable=False,
|
||||
verbose_name="Delete DID")
|
||||
verbose_name="Delete")
|
||||
|
||||
def render_edit_did(self):
|
||||
return format_html('<i class="bi bi-pencil-square"></i>')
|
||||
|
@ -209,15 +216,15 @@ class DIDTable(tables.Table):
|
|||
|
||||
|
||||
class DataTable(tables.Table):
|
||||
created_at = tables.Column(verbose_name="Date")
|
||||
file_name = tables.Column(verbose_name="File")
|
||||
created_at = tables.Column(verbose_name=_("Date"))
|
||||
file_name = tables.Column(verbose_name=_("File"))
|
||||
delete_template_code = """<a class="text-danger"
|
||||
href="{% url 'idhub:admin_import_del' record.id %}"
|
||||
title="Remove"
|
||||
><i class="bi bi-trash"></i></a>"""
|
||||
delete_data = tables.TemplateColumn(template_code=delete_template_code,
|
||||
orderable=False,
|
||||
verbose_name="Delete")
|
||||
verbose_name=_("Delete"))
|
||||
|
||||
class Meta:
|
||||
model = File_datas
|
||||
|
@ -227,6 +234,7 @@ class DataTable(tables.Table):
|
|||
|
||||
class TemplateTable(tables.Table):
|
||||
view_schema = ButtonColumn(
|
||||
verbose_name=_("View"),
|
||||
linkify={
|
||||
"viewname": "idhub:admin_schemas_download",
|
||||
"args": [tables.A("pk")]
|
||||
|
@ -241,10 +249,10 @@ class TemplateTable(tables.Table):
|
|||
><i class="bi bi-trash"></i></a>"""
|
||||
delete_schema = tables.TemplateColumn(template_code=delete_template_code,
|
||||
orderable=False,
|
||||
verbose_name="Delete schema")
|
||||
verbose_name=_("Delete"))
|
||||
|
||||
name = tables.Column()
|
||||
description = tables.Column()
|
||||
name = tables.Column(verbose_name=_("Name"))
|
||||
description = tables.Column(verbose_name=_("Description"))
|
||||
|
||||
def order_name(self, queryset, is_descending):
|
||||
queryset = Schemas.objects.order_by(
|
||||
|
|
|
@ -489,9 +489,9 @@ class Schemas(models.Model):
|
|||
type = models.CharField(max_length=250)
|
||||
file_schema = models.CharField(_('Schema'), max_length=250)
|
||||
data = models.TextField()
|
||||
created_at = models.DateTimeField(_("Created at"), auto_now=True)
|
||||
created_at = models.DateTimeField(_("Date"), auto_now=True)
|
||||
_name = models.TextField(_("Name"), null=True, db_column='name')
|
||||
_description = models.CharField(_("Descriptions"), max_length=250, null=True, db_column='description')
|
||||
_description = models.CharField(_("Description"), max_length=250, null=True, db_column='description')
|
||||
template_description = models.TextField(null=True)
|
||||
|
||||
@property
|
||||
|
@ -595,15 +595,16 @@ class VerificableCredential(models.Model):
|
|||
REVOKED = 3, _("Revoked")
|
||||
EXPIRED = 4, _("Expired")
|
||||
|
||||
type = models.CharField(max_length=250)
|
||||
type = models.CharField(_("Type"), max_length=250)
|
||||
id_string = models.CharField(max_length=250)
|
||||
verified = models.BooleanField()
|
||||
created_on = models.DateTimeField(auto_now=True)
|
||||
issued_on = models.DateTimeField(null=True)
|
||||
issued_on = models.DateTimeField(_("Issued on"), null=True)
|
||||
data = models.TextField()
|
||||
csv_data = models.TextField()
|
||||
hash = models.CharField(max_length=260)
|
||||
status = models.PositiveSmallIntegerField(
|
||||
_("Status"),
|
||||
choices=Status.choices,
|
||||
default=Status.ENABLED
|
||||
)
|
||||
|
@ -611,6 +612,7 @@ class VerificableCredential(models.Model):
|
|||
User,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='vcredentials',
|
||||
verbose_name=_("User")
|
||||
)
|
||||
subject_did = models.ForeignKey(
|
||||
DID,
|
||||
|
@ -779,9 +781,9 @@ class VCTemplate(models.Model):
|
|||
|
||||
|
||||
class File_datas(models.Model):
|
||||
file_name = models.CharField(max_length=250)
|
||||
success = models.BooleanField(default=True)
|
||||
created_at = models.DateTimeField(auto_now=True)
|
||||
file_name = models.CharField(_("File"), max_length=250)
|
||||
success = models.BooleanField(_("Success"), default=True)
|
||||
created_at = models.DateTimeField(_("Date"), auto_now=True)
|
||||
|
||||
|
||||
class Membership(models.Model):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from django.utils.html import format_html
|
||||
import django_tables2 as tables
|
||||
from idhub.models import Event, Membership, UserRol, DID, VerificableCredential
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
class ButtonColumn(tables.Column):
|
||||
|
@ -19,9 +20,9 @@ class ButtonColumn(tables.Column):
|
|||
|
||||
|
||||
class DashboardTable(tables.Table):
|
||||
type = tables.Column(verbose_name="Event")
|
||||
message = tables.Column(verbose_name="Description")
|
||||
created = tables.Column(verbose_name="Date")
|
||||
type = tables.Column(verbose_name=_("Event"))
|
||||
message = tables.Column(verbose_name=_("Description"))
|
||||
created = tables.Column(verbose_name=_("Date"))
|
||||
|
||||
class Meta:
|
||||
model = Event
|
||||
|
@ -31,8 +32,9 @@ class DashboardTable(tables.Table):
|
|||
|
||||
|
||||
class PersonalInfoTable(tables.Table):
|
||||
type = tables.Column(verbose_name="Membership")
|
||||
type = tables.Column(verbose_name=_("Membership"))
|
||||
credential = ButtonColumn(
|
||||
verbose_name=_("Credential"),
|
||||
# TODO: See where this should actually link
|
||||
linkify="idhub:user_credentials",
|
||||
orderable=False
|
||||
|
@ -48,9 +50,9 @@ class PersonalInfoTable(tables.Table):
|
|||
|
||||
|
||||
class RolesTable(tables.Table):
|
||||
name = tables.Column(verbose_name="Role", empty_values=())
|
||||
description = tables.Column(empty_values=())
|
||||
service = tables.Column()
|
||||
name = tables.Column(verbose_name=_("Role"), empty_values=())
|
||||
description = tables.Column(verbose_name=_("Description"), empty_values=())
|
||||
service = tables.Column(verbose_name=_("Service"))
|
||||
|
||||
def render_name(self, record):
|
||||
return record.service.get_roles()
|
||||
|
@ -89,9 +91,10 @@ class RolesTable(tables.Table):
|
|||
|
||||
|
||||
class DIDTable(tables.Table):
|
||||
created_at = tables.Column(verbose_name="Date")
|
||||
created_at = tables.Column(verbose_name=_("Date"))
|
||||
did = tables.Column(verbose_name="ID")
|
||||
edit = ButtonColumn(
|
||||
verbose_name=_("Edit"),
|
||||
linkify={
|
||||
"viewname": "idhub:user_dids_edit",
|
||||
"args": [tables.A("pk")]
|
||||
|
@ -104,8 +107,11 @@ class DIDTable(tables.Table):
|
|||
data-bs-target="#confirm-delete-{{ record.id }}"
|
||||
title="Remove"
|
||||
><i class="bi bi-trash"></i></a>"""
|
||||
delete = tables.TemplateColumn(template_code=delete_template_code,
|
||||
orderable=False)
|
||||
delete = tables.TemplateColumn(
|
||||
verbose_name=_("Delete"),
|
||||
template_code=delete_template_code,
|
||||
orderable=False
|
||||
)
|
||||
|
||||
def render_edit(self):
|
||||
return format_html('<i class="bi bi-pencil-square"></i>')
|
||||
|
@ -117,8 +123,9 @@ class DIDTable(tables.Table):
|
|||
|
||||
|
||||
class CredentialsTable(tables.Table):
|
||||
description = tables.Column(verbose_name="Details", empty_values=())
|
||||
description = tables.Column(verbose_name=_("Details"), empty_values=())
|
||||
view_credential = ButtonColumn(
|
||||
verbose_name=_("View"),
|
||||
linkify={
|
||||
"viewname": "idhub:user_credential",
|
||||
"args": [tables.A("pk")]
|
||||
|
|
|
@ -6,8 +6,8 @@ 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
|
||||
|
|
|
@ -45,8 +45,8 @@ class User(AbstractBaseUser):
|
|||
max_length=255,
|
||||
unique=True,
|
||||
)
|
||||
is_active = models.BooleanField(default=True)
|
||||
is_admin = models.BooleanField(default=False)
|
||||
is_active = models.BooleanField(_("is active"), default=True)
|
||||
is_admin = models.BooleanField(_("is admin"), default=False)
|
||||
first_name = models.CharField(_("First name"), max_length=255, blank=True, null=True)
|
||||
last_name = models.CharField(_("Last name"), max_length=255, blank=True, null=True)
|
||||
encrypted_sensitive_data = models.CharField(max_length=255)
|
||||
|
|
Loading…
Reference in a new issue