change home view
This commit is contained in:
parent
341339ca8b
commit
f02e4cd8a3
0
MUOR/MUOR/migrations/__init__.py
Normal file
0
MUOR/MUOR/migrations/__init__.py
Normal file
@ -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
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'crispy_forms',
|
||||
'MUOR'
|
||||
'MUOR',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -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')
|
||||
]
|
||||
|
@ -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")
|
||||
|
BIN
MUOR/db.sqlite3
BIN
MUOR/db.sqlite3
Binary file not shown.
Loading…
Reference in New Issue
Block a user