From d282c65c9adac1f215c0ee0b00bf4d15dd25284a Mon Sep 17 00:00:00 2001 From: Praneeth Bhandaru Date: Sun, 13 Dec 2020 13:58:24 -0500 Subject: [PATCH] Final Commit --- site/config/settings.py | 2 +- site/config/urls.py | 3 +- site/frontend/urls.py | 2 +- site/frontend/views.py | 7 +- site/templates/frontend/classroomForm.html | 117 +++++++++++---------- site/templates/frontend/index.html | 6 +- site/templates/frontend/landing.html | 81 ++++++++++++++ 7 files changed, 155 insertions(+), 63 deletions(-) create mode 100644 site/templates/frontend/landing.html diff --git a/site/config/settings.py b/site/config/settings.py index 29b21645..24552885 100644 --- a/site/config/settings.py +++ b/site/config/settings.py @@ -150,5 +150,5 @@ STATICFILES_DIRS = [ BASE_DIR / "static", ] -LOGIN_REDIRECT_URL = "home" +LOGIN_REDIRECT_URL = "landing_page" LOGIN_URL = "login" diff --git a/site/config/urls.py b/site/config/urls.py index ef89456a..1fe7c1af 100644 --- a/site/config/urls.py +++ b/site/config/urls.py @@ -18,10 +18,11 @@ from django.urls import include, path from api import urls as api_urls from frontend import urls as frontend_urls +from frontend.views import landing_page urlpatterns = [ path("admin/", admin.site.urls), path("api/", include(api_urls)), - path("", include(frontend_urls)), + path("", landing_page, name='landing_page'), path("out/", include(frontend_urls)), ] diff --git a/site/frontend/urls.py b/site/frontend/urls.py index c58cb143..cea68171 100644 --- a/site/frontend/urls.py +++ b/site/frontend/urls.py @@ -33,7 +33,7 @@ urlpatterns = [ ), path("register/", register_view, name="register"), path("create_user/", register_view, name="create_user"), - path("", home_view, name="home"), + path("home/", home_view, name="home"), path("classes", class_form_view, name="classroom_form"), path("classes/", classroom_view, name="class"), path("classes//edit", classroom_edit_view, name="edit_class"), diff --git a/site/frontend/views.py b/site/frontend/views.py index 1410c087..2677928f 100644 --- a/site/frontend/views.py +++ b/site/frontend/views.py @@ -84,4 +84,9 @@ def classroom_edit_view(request, id): form = ClassroomForm(instance=classroom) - return render(request, 'frontend/editClassroom.html', {'form': form}) \ No newline at end of file + return render(request, 'frontend/editClassroom.html', {'form': form}) + +def landing_page(request): + if request.user or request.user.is_authenticated: + return redirect('home') + return render(request, 'frontend/landing.html') \ No newline at end of file diff --git a/site/templates/frontend/classroomForm.html b/site/templates/frontend/classroomForm.html index 3aa07eb1..1801ad04 100644 --- a/site/templates/frontend/classroomForm.html +++ b/site/templates/frontend/classroomForm.html @@ -8,78 +8,81 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + {% endblock head %} {% block content %} -