diff options
Diffstat (limited to 'workshop_app')
-rw-r--r-- | workshop_app/templates/workshop_app/activation.html | 20 | ||||
-rw-r--r-- | workshop_app/test_views.py | 8 | ||||
-rw-r--r-- | workshop_app/urls.py | 47 | ||||
-rw-r--r-- | workshop_app/views.py | 6 |
4 files changed, 71 insertions, 10 deletions
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' %} <div class="container"> <div class="jumbotron"> - <p>{{ status }}</p> - {{ request.user.profile.activation_key }} + <p> Your email is already verified, Please view your profile <a href="{{ URL_ROOT }}/view_profile/">here</a> </p> + + </div> + </div> + {% elif status == '1' %} + <div class="container"> + <div class="jumbotron"> + <p> Your activation has expired please register again</p> + + </div> + </div> + {% elif status == '0' %} + <div class="container"> + <div class="jumbotron"> + <p> Your account has been activated. Please view your profile <a href="{{ URL_ROOT }}/view_profile/">here</a> </p> + </div> </div> {% 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<key>.+)$', 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/') |