diff --git a/MUOR/MUOR/migrations/__init__.py b/MUOR/MUOR/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/MUOR/MUOR/models.py b/MUOR/MUOR/models.py index 9f6575f19..b2dac4d70 100644 --- a/MUOR/MUOR/models.py +++ b/MUOR/MUOR/models.py @@ -1,6 +1,4 @@ -from django.contrib.auth.models import User from django.db import models -from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.models import AbstractUser diff --git a/MUOR/MUOR/settings.py b/MUOR/MUOR/settings.py index b234d5f5e..8af1353f3 100644 --- a/MUOR/MUOR/settings.py +++ b/MUOR/MUOR/settings.py @@ -37,7 +37,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'crispy_forms', - 'MUOR' + 'MUOR', ] MIDDLEWARE = [ diff --git a/MUOR/MUOR/urls.py b/MUOR/MUOR/urls.py index a02711f40..66476216a 100644 --- a/MUOR/MUOR/urls.py +++ b/MUOR/MUOR/urls.py @@ -25,7 +25,9 @@ urlpatterns = [ path('admin/', admin.site.urls), path('', include('django.contrib.auth.urls')), path('signup/', SignUpView.as_view(), name='signup'), - path('', TemplateView.as_view(template_name='home.html'), name='home'), - path('favicon.ico', RedirectView.as_view(url=staticfiles_storage.url('images/favicon.ico'))), - path('test/', views.test, name='test') + path('welcome/', TemplateView.as_view(template_name='home.html'), + name='home'), + path('favicon.ico', RedirectView.as_view( + url=staticfiles_storage.url('images/favicon.ico'))), + path('', views.home, name='home') ] diff --git a/MUOR/MUOR/views.py b/MUOR/MUOR/views.py index 68c4e39e8..e54ccfc31 100644 --- a/MUOR/MUOR/views.py +++ b/MUOR/MUOR/views.py @@ -1,13 +1,16 @@ +from django.contrib.auth import logout from django.contrib.auth.forms import UserCreationForm -from django.contrib.auth.models import User from django.http import JsonResponse +from django.shortcuts import redirect from django.urls import reverse_lazy from django.views import generic +from .models import Profile + class SignUpForm(UserCreationForm): class Meta: - model = User + model = Profile fields = ('username', 'email',) def save(self, commit=True): @@ -20,5 +23,8 @@ class SignUpView(generic.CreateView): template_name = 'registration/signup.html' -def test(request): - return JsonResponse(request.COOKIES) +def home(request): + if request.user.is_authenticated: + logout(request) + + return redirect("/welcome") diff --git a/MUOR/db.sqlite3 b/MUOR/db.sqlite3 index 09efcccb6..66b5fe754 100644 Binary files a/MUOR/db.sqlite3 and b/MUOR/db.sqlite3 differ