diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d8661d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +db.sqlite3 +__pycache__/ diff --git a/idhub/models.py b/idhub/models.py index 71a8362..88f6ec2 100644 --- a/idhub/models.py +++ b/idhub/models.py @@ -1,3 +1,28 @@ from django.db import models +from django.contrib.auth.models import User as DjangoUser -# Create your models here. + +class User(DjangoUser): + # Ya incluye "first_name", "last_name", "email", y "date_joined" heredando de la clase User de django. + # Falta ver que más información hay que añadir a nuestros usuarios, como los roles etc. + pass + + +class Event(models.Model): + # Para los "audit logs" que se requieren en las pantallas. + timestamp = models.DateTimeField() + kind = "PLACEHOLDER" + + +class DID(models.Model): + did_string = models.CharField(max_length=250) + # kind = "KEY|JWK|WEB|EBSI|CHEQD|IOTA" + + +class VerifiableCredential(models.Model): + id_string = models.CharField(max_length=250) + data = models.TextField() + verified = models.BooleanField() + created_on = models.DateTimeField() + did_issuer = models.ForeignKey(DID, on_delete=models.PROTECT) + did_subject = models.ForeignKey(DID, on_delete=models.PROTECT) diff --git a/idhub/urls.py b/idhub/urls.py new file mode 100644 index 0000000..f314005 --- /dev/null +++ b/idhub/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path("", views.index, name="index"), + path("user/", views.user, name="user") +] diff --git a/idhub/views.py b/idhub/views.py index 91ea44a..840c3a0 100644 --- a/idhub/views.py +++ b/idhub/views.py @@ -1,3 +1,15 @@ from django.shortcuts import render +from .models import User -# Create your views here. + +from django.shortcuts import redirect, render + +def index(request): + return redirect("/user") + + +def user(request): + uid = request.user + user = User.get(uid) + context = { userdata: user } + return render(request, "polls/user.html", context) \ No newline at end of file diff --git a/trustchain_idhub/settings.py b/trustchain_idhub/settings.py index 232dde7..9925b99 100644 --- a/trustchain_idhub/settings.py +++ b/trustchain_idhub/settings.py @@ -37,6 +37,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'idhub' ] MIDDLEWARE = [ diff --git a/trustchain_idhub/urls.py b/trustchain_idhub/urls.py index f30184d..3519a39 100644 --- a/trustchain_idhub/urls.py +++ b/trustchain_idhub/urls.py @@ -15,8 +15,9 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ - path('admin/', admin.site.urls), + path('django-admin/', admin.site.urls), + path('/', include("idhub.urls")) ]