From ff212d6e1518f6bdb55a13fee2209bb83419a3d1 Mon Sep 17 00:00:00 2001 From: Daoud Clarke Date: Sun, 29 Oct 2023 14:22:25 +0000 Subject: [PATCH] Add template for results; remove some unused code --- mwmbl/templates/results.html | 16 ++++++++++++++++ mwmbl/urls.py | 8 +------- mwmbl/views.py | 19 +------------------ 3 files changed, 18 insertions(+), 25 deletions(-) create mode 100644 mwmbl/templates/results.html diff --git a/mwmbl/templates/results.html b/mwmbl/templates/results.html new file mode 100644 index 0000000..ddaac9f --- /dev/null +++ b/mwmbl/templates/results.html @@ -0,0 +1,16 @@ +{% for result in results %} +
+
+ + + +
+ +
+{% end for %} diff --git a/mwmbl/urls.py b/mwmbl/urls.py index b416085..0666890 100644 --- a/mwmbl/urls.py +++ b/mwmbl/urls.py @@ -15,12 +15,10 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.contrib.auth import login, logout -from django.template.defaulttags import url from django.urls import path, include from mwmbl.api import api_original as api, api_v1 -from mwmbl.views import signup, profile +from mwmbl.views import profile urlpatterns = [ path('admin/', admin.site.urls), @@ -28,9 +26,5 @@ urlpatterns = [ path('api/v1/', api_v1.urls), path('accounts/', include('allauth.urls')), - # path("accounts/", include("django.contrib.auth.urls")), - # path('accounts/new/', signup, name='signup'), path('accounts/profile/', profile, name='profile'), - # path('login/', login, {'template_name': 'login.html'}, name='login'), - # path('logout/', logout, {'next_page': 'login'}, name='logout'), ] diff --git a/mwmbl/views.py b/mwmbl/views.py index 0ae3ba8..2eac576 100644 --- a/mwmbl/views.py +++ b/mwmbl/views.py @@ -1,22 +1,5 @@ -from django.contrib.auth import authenticate, login from django.contrib.auth.decorators import login_required -from django.contrib.auth.forms import UserCreationForm -from django.shortcuts import redirect, render - - -def signup(request): - if request.method == 'POST': - form = UserCreationForm(request.POST) - if form.is_valid(): - form.save() - username = form.cleaned_data.get('username') - raw_password = form.cleaned_data.get('password1') - user = authenticate(username=username, password=raw_password) - login(request, user) - return redirect('/') - else: - form = UserCreationForm() - return render(request, 'signup.html', {'form': form}) +from django.shortcuts import render @login_required