Merge branch 'main' into new_credentials

This commit is contained in:
Cayo Puigdefabregas 2024-01-12 20:09:33 +01:00
commit bf68d7e741
6 changed files with 12 additions and 9 deletions

Binary file not shown.

Binary file not shown.

View file

@ -80,7 +80,8 @@ class ImportForm(forms.Form):
if File_datas.objects.filter(file_name=self.file_name, success=True).exists():
raise ValidationError("This file already exists!")
df = pd.read_csv (data, delimiter="\t", quotechar='"', quoting=csv.QUOTE_ALL)
# df = pd.read_csv (data, delimiter="\t", quotechar='"', quoting=csv.QUOTE_ALL)
df = pd.read_excel(data)
data_pd = df.fillna('').to_dict()
if not data_pd:

View file

@ -542,8 +542,12 @@ class VerificableCredential(models.Model):
format = "%Y-%m-%dT%H:%M:%SZ"
issuance_date = self.issued_on.strftime(format)
url_id = "{}/credentials/{}".format(
settings.DOMAIN.strip("/"),
self.id
)
context = {
'vc_id': self.id,
'vc_id': url_id,
'issuer_did': self.issuer_did.did,
'subject_did': self.subject_did and self.subject_did.did or '',
'issuance_date': issuance_date,

View file

@ -4,8 +4,6 @@
{% block login_content %}
<form action="{% url 'idhub:login' %}" role="form" method="post">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}" />
<div id="div_id_username"
class="clearfix control-group {% if form.username.errors %}error{% endif %}">
<div class="form-group">

View file

@ -13,16 +13,16 @@ class LoginView(auth_views.LoginView):
}
def get(self, request, *args, **kwargs):
if request.GET.get('next'):
self.extra_context['success_url'] = request.GET.get('next')
self.extra_context['success_url'] = request.GET.get(
'next',
reverse_lazy('idhub:user_dashboard')
)
return super().get(request, *args, **kwargs)
def form_valid(self, form):
user = form.get_user()
if not user.is_anonymous and user.is_admin:
user_dashboard = reverse_lazy('idhub:user_dashboard')
admin_dashboard = reverse_lazy('idhub:admin_dashboard')
if self.extra_context['success_url'] == user_dashboard:
self.extra_context['success_url'] = admin_dashboard
auth_login(self.request, user)
return HttpResponseRedirect(self.extra_context['success_url'])