summaryrefslogtreecommitdiff
path: root/workshop_portal
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-07-29 15:25:44 +0530
committerGitHub2020-07-29 15:25:44 +0530
commit11b63b322b85655e60fa26e248cae77ce96e1b9b (patch)
treefddcd12049106b796bbeb9391a2e05d62203fd8d /workshop_portal
parent85be587312615def9ae87c3cbf3f532af385d420 (diff)
parent8a67bbe45e51f33dc82f4492f8dcc318f0995256 (diff)
downloadworkshop_booking-11b63b322b85655e60fa26e248cae77ce96e1b9b.tar.gz
workshop_booking-11b63b322b85655e60fa26e248cae77ce96e1b9b.tar.bz2
workshop_booking-11b63b322b85655e60fa26e248cae77ce96e1b9b.zip
Merge pull request #154 from FOSSEE/fix_cms
Fix CMS app
Diffstat (limited to 'workshop_portal')
-rw-r--r--workshop_portal/settings.py8
-rw-r--r--workshop_portal/urls.py5
-rw-r--r--workshop_portal/views.py16
3 files changed, 26 insertions, 3 deletions
diff --git a/workshop_portal/settings.py b/workshop_portal/settings.py
index 2dfeb08..78f0358 100644
--- a/workshop_portal/settings.py
+++ b/workshop_portal/settings.py
@@ -49,6 +49,7 @@ INSTALLED_APPS = [
'workshop_app',
'statistics_app',
'teams',
+ 'cms',
]
MIDDLEWARE = [
@@ -131,7 +132,7 @@ USE_TZ = True
STATIC_URL = '/static/'
-STATIC_ROOT = os.path.join(BASE_DIR, "static/")
+STATIC_ROOT = 'workshop_app/static/'
LOGIN_URL = '/login/'
@@ -160,7 +161,10 @@ ADMIN_EMAIL = 'your admin email'
# Set True or False to view/hide
SHOW_WORKSHOP_STATS = True
-LOGIN_REDIRECT_URL = '/profile'
+# Create a CMS page as a home page and give the page title here
+HOME_PAGE_TITLE = "home-page-title"
+
+LOGIN_REDIRECT_URL = '/workshop/login'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_SAVE_EVERY_REQUEST = True
SESSION_COOKIE_AGE = 3600
diff --git a/workshop_portal/urls.py b/workshop_portal/urls.py
index 464b98c..8adddd8 100644
--- a/workshop_portal/urls.py
+++ b/workshop_portal/urls.py
@@ -15,10 +15,13 @@ Including another URLconf
"""
from django.conf.urls import url, include
from django.contrib import admin
+from workshop_portal import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
- url(r'^', include('workshop_app.urls')),
+ url(r'^$', views.index),
+ url(r'^workshop/', include('workshop_app.urls')),
url(r'^reset/', include('django.contrib.auth.urls')),
+ url(r'^page/', include('cms.urls')),
]
diff --git a/workshop_portal/views.py b/workshop_portal/views.py
new file mode 100644
index 0000000..e166039
--- /dev/null
+++ b/workshop_portal/views.py
@@ -0,0 +1,16 @@
+# Django Imports
+from django.shortcuts import redirect
+from django.urls import reverse
+from django.conf import settings
+
+# Local Imports
+from cms.models import Page
+
+
+def index(request):
+ page = Page.objects.filter(title=settings.HOME_PAGE_TITLE)
+ if page.exists():
+ redirect_url = reverse("cms:home", args=[page.first().permalink])
+ else:
+ redirect_url = reverse("workshop_app:index")
+ return redirect(redirect_url)