add field type in form

This commit is contained in:
Cayo Puigdefabregas 2024-01-16 14:00:59 +01:00
parent 72a895a6de
commit 01bc21d1a4
2 changed files with 5 additions and 3 deletions

View File

@ -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'))

View File

@ -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