From 01bc21d1a4f5ae1c67c1a07962aae0b51b86914d Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 16 Jan 2024 14:00:59 +0100 Subject: [PATCH] add field type in form --- idhub/user/views.py | 4 ++-- idhub/views.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/idhub/user/views.py b/idhub/user/views.py index 50c241b..d715e0f 100644 --- a/idhub/user/views.py +++ b/idhub/user/views.py @@ -199,13 +199,13 @@ class DidRegisterView(MyWallet, CreateView): icon = 'bi bi-patch-check-fill' wallet = True model = DID - fields = ('label',) + fields = ('label', 'type') success_url = reverse_lazy('idhub:user_dids') object = None def form_valid(self, form): form.instance.user = self.request.user - form.instance.set_did(form.instance.type) + form.instance.set_did() form.save() messages.success(self.request, _('DID created successfully')) diff --git a/idhub/views.py b/idhub/views.py index b4fe08f..851011f 100644 --- a/idhub/views.py +++ b/idhub/views.py @@ -33,7 +33,9 @@ class LoginView(auth_views.LoginView): def serve_did(request, did_id): - document = get_object_or_404(DID, did=f'did:web:{settings.DOMAIN}:{did_id}').didweb_document + id_did = f'did:web:{settings.DOMAIN}:did-registry:{did_id}' + did = get_object_or_404(DID, did=id_did) + document = did.didweb_document retval = HttpResponse(document) retval.headers["Content-Type"] = "application/json" return retval