From 8e59e5ad6ff598f71168ec1a832a17ef9c52b8a3 Mon Sep 17 00:00:00 2001
From: Akshen
Date: Thu, 1 Jun 2017 16:06:04 +0530
Subject: Changes URLS
- urls.py created in workshop_app
- activation status logic changed, view_profile added
---
.../templates/workshop_app/activation.html | 20 +++++++--
workshop_app/test_views.py | 8 ++--
workshop_app/urls.py | 47 ++++++++++++++++++++++
workshop_app/views.py | 6 +--
4 files changed, 71 insertions(+), 10 deletions(-)
create mode 100644 workshop_app/urls.py
(limited to 'workshop_app')
diff --git a/workshop_app/templates/workshop_app/activation.html b/workshop_app/templates/workshop_app/activation.html
index 1262e22..88bada9 100644
--- a/workshop_app/templates/workshop_app/activation.html
+++ b/workshop_app/templates/workshop_app/activation.html
@@ -21,11 +21,25 @@
{% endblock %}
{% block content %}
- {% if status %}
+ {% if status == '2' %}
-
{{ status }}
- {{ request.user.profile.activation_key }}
+
Your email is already verified, Please view your profile here
+
+
+
+ {% elif status == '1' %}
+
+
+
Your activation has expired please register again
+
+
+
+ {% elif status == '0' %}
+
+
+
Your account has been activated. Please view your profile here
+
{% else %}
diff --git a/workshop_app/test_views.py b/workshop_app/test_views.py
index ea34f89..ebf48c0 100644
--- a/workshop_app/test_views.py
+++ b/workshop_app/test_views.py
@@ -121,10 +121,10 @@ class TestWorkshopCreation(TestCase):
#Add user_one in instructor group and give required permissions
self.mod_group.user_set.add(self.user_one)
- self.per = (Permission.objects.all())
- self.user_one.user_permissions.add(self.per[44])
- self.user_one.user_permissions.add(self.per[43])
- self.user_one.user_permissions.add(self.per[42])
+ self.permission = (Permission.objects.all())
+ self.user_one.user_permissions.add(self.permission[44])
+ self.user_one.user_permissions.add(self.permission[43])
+ self.user_one.user_permissions.add(self.permission[42])
self.user_two = User.objects.create(
username='demo_user2',
diff --git a/workshop_app/urls.py b/workshop_app/urls.py
new file mode 100644
index 0000000..60da52e
--- /dev/null
+++ b/workshop_app/urls.py
@@ -0,0 +1,47 @@
+"""workshop_portal URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/1.10/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.conf.urls import url, include
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
+"""
+from django.conf.urls import url
+from django.contrib import admin
+from workshop_app import views
+import django
+
+js_info_dict = {
+ 'packages': ('recurrence', ),
+}
+
+
+urlpatterns = [
+ url(r'^$', views.index, name='index'),
+ url(r'^register/$', views.user_register),
+ url(r'^activate_user/(?P.+)$', views.activate_user),
+ url(r'^login/$', views.user_login),
+ url(r'^logout/$', views.user_logout),
+ url(r'^view_profile/$', views.view_profile),
+ url(r'^edit_profile/$', views.edit_profile),
+ url(r'^book/$', views.book),
+ url(r'^book_workshop/$', views.book_workshop),
+ url(r'^my_workshops/$', views.my_workshops),
+ url(r'^benefits/$', views.benefits),
+ url(r'^how_to_participate/$', views.how_to_participate),
+ url(r'^faq/$', views.faq),
+ url(r'^manage/$', views.manage),
+ url(r'^view_workshoptype_list/$', views.view_workshoptype_list),
+ url(r'^view_workshoptype_details/$', views.view_workshoptype_details),
+ url(r'^create_workshop/$', views.create_workshop),
+ url(r'^propose_workshop/$', views.propose_workshop),
+ url(r'^jsi18n/$', django.views.i18n.javascript_catalog, js_info_dict),
+
+]
diff --git a/workshop_app/views.py b/workshop_app/views.py
index 0557207..0efaf54 100644
--- a/workshop_app/views.py
+++ b/workshop_app/views.py
@@ -99,9 +99,9 @@ def activate_user(request, key):
return redirect('/register/')
if user.is_email_verified:
- status = "Your email is already verified"
+ status = "2"
elif timezone.now() > user.key_expiry_time:
- status = "Your activation has expired please register again"
+ status = "1"
Profile.objects.get(user_id=user.user_id).delete()
User.objects.get(id=user.user_id).delete()
return render(request, 'workshop_app/activation.html',
@@ -109,7 +109,7 @@ def activate_user(request, key):
elif key == user.activation_key:
user.is_email_verified = True
user.save()
- status = "Your account has been activated"
+ status = "0"
else:
logout(request)
return redirect('/logout/')
--
cgit