This commit is contained in:
Cayo Puigdefabregas 2023-10-31 17:07:43 +01:00
parent 898877709f
commit 734d7aab23
2 changed files with 5 additions and 11 deletions

View File

@ -53,11 +53,10 @@ class VerificableCredential(models.Model):
Definition of Verificable Credentials Definition of Verificable Credentials
""" """
class Status(models.IntegerChoices): class Status(models.IntegerChoices):
ENABLE = 1, _("Enable") ENABLED = 1, _("Enabled")
REQUIRED = 2, _("Required") REQUESTED = 2, _("Requested")
DENEGATED = 3, _("Denegated") ISSUED = 3, _("Issued")
ISSUED = 4, _("Issued") REVOKED = 4, _("Revoked")
REVOKED = 5, _("Revoked")
EXPIRED = 6, _("Expired") EXPIRED = 6, _("Expired")
id_string = models.CharField(max_length=250) id_string = models.CharField(max_length=250)
@ -69,7 +68,7 @@ class VerificableCredential(models.Model):
data = models.TextField() data = models.TextField()
status = models.PositiveSmallIntegerField( status = models.PositiveSmallIntegerField(
choices=Status.choices, choices=Status.choices,
default=Status.ENABLE default=Status.ENABLED
) )
user = models.ForeignKey( user = models.ForeignKey(
User, User,

View File

@ -13,11 +13,6 @@
{% if object.get_status == 'Issued' %} {% if object.get_status == 'Issued' %}
<a class="btn btn-yellow" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Revoke' %}</a> <a class="btn btn-yellow" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Revoke' %}</a>
<a class="btn btn-orange" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Delete' %}</a> <a class="btn btn-orange" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Delete' %}</a>
{% elif object.get_status == 'Required' %}
<a class="btn btn-yellow" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Accept' %}</a>
<a class="btn btn-orange" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Deny' %}</a>
{% elif object.get_status == 'Issued' %}
<a class="btn btn-yellow" href="{% url 'idhub:user_credential_json' object.id %}">{% trans 'Revoke' %}</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>