diff options
-rw-r--r-- | static/workshop_app/img/structure.png | bin | 0 -> 82690 bytes | |||
-rw-r--r-- | workshop_app/data/flowchart.pdf | bin | 27485 -> 68320 bytes | |||
-rw-r--r-- | workshop_app/static/workshop_app/img/structure.png | bin | 42547 -> 82690 bytes | |||
-rw-r--r-- | workshop_app/templates/workshop_app/activation.html | 2 | ||||
-rw-r--r-- | workshop_app/templates/workshop_app/my_workshops.html | 36 | ||||
-rw-r--r-- | workshop_app/templates/workshop_app/scheduled_workshops.html | 11 | ||||
-rw-r--r-- | workshop_app/tests/test_models.py | 33 | ||||
-rw-r--r-- | workshop_app/tests/test_views.py | 47 | ||||
-rw-r--r-- | workshop_app/views.py | 11 |
9 files changed, 111 insertions, 29 deletions
diff --git a/static/workshop_app/img/structure.png b/static/workshop_app/img/structure.png Binary files differnew file mode 100644 index 0000000..8aa366d --- /dev/null +++ b/static/workshop_app/img/structure.png diff --git a/workshop_app/data/flowchart.pdf b/workshop_app/data/flowchart.pdf Binary files differindex 35e6776..d216bfc 100644 --- a/workshop_app/data/flowchart.pdf +++ b/workshop_app/data/flowchart.pdf diff --git a/workshop_app/static/workshop_app/img/structure.png b/workshop_app/static/workshop_app/img/structure.png Binary files differindex 9c18785..8aa366d 100644 --- a/workshop_app/static/workshop_app/img/structure.png +++ b/workshop_app/static/workshop_app/img/structure.png diff --git a/workshop_app/templates/workshop_app/activation.html b/workshop_app/templates/workshop_app/activation.html index 29dd6ac..f9fc805 100644 --- a/workshop_app/templates/workshop_app/activation.html +++ b/workshop_app/templates/workshop_app/activation.html @@ -63,7 +63,7 @@ <div class="container"> <div class="jumbotron"> <h1>Activation Awaiting</h1> - <p>Please check your email to activate your account. The key expires in <strong>24hours</strong> from the date of registeration. You will be logged out automatically.</p> + <p>The Activation Link has been sent to your email. The link expires in <strong>24hours</strong> from the date of registration. You will be logged out automatically.</p> </div> </div> {% endif %} diff --git a/workshop_app/templates/workshop_app/my_workshops.html b/workshop_app/templates/workshop_app/my_workshops.html index 16eefec..c36485e 100644 --- a/workshop_app/templates/workshop_app/my_workshops.html +++ b/workshop_app/templates/workshop_app/my_workshops.html @@ -101,12 +101,12 @@ <tr> {% if workshop.status == 'Pending' and workshop.requested_workshop_instructor %} {% if request.user.profile.position == 'instructor' %} - <td>{{ workshop.requested_workshop_coordinator }}</td> + <td>{{ workshop.requested_workshop_coordinator.get_full_name }}</td> {% else %} - <td>{{ workshop.requested_workshop_instructor }}</td> + <td>{{ workshop.requested_workshop_instructor.get_full_name }}</td> {% endif %} <td>{{ workshop.requested_workshop_title }}</td> - <td>{{ workshop.requested_workshop_date }}</td> + <td>{{ workshop.requested_workshop_date | date }}</td> <td><span class = "label label-warning">{{ workshop.status }}</span></td> {% endif %} {% if request.user.profile.position == 'instructor' and workshop.status == 'Pending' and workshop.requested_workshop_instructor %} @@ -142,22 +142,22 @@ <tr> {% if workshop.status == 'ACCEPTED' and workshop.requested_workshop_title %} {% if request.user.profile.position == 'instructor' %} - <td>{{ workshop.requested_workshop_coordinator }}</td> + <td>{{ workshop.requested_workshop_coordinator.get_full_name }}</td> {% else %} - <td>{{ workshop.requested_workshop_instructor }}</td> + <td>{{ workshop.requested_workshop_instructor.get_full_name }}</td> {% endif %} - <td>{{ workshop.requested_workshop_title }}</td> - <td>{{ workshop.requested_workshop_date }}</td> + <td>{{ workshop.requested_workshop_title |capfirst }}</td> + <td>{{ workshop.requested_workshop_date | date }}</td> <td><span class = "label label-success">{{ workshop.status }}</span></td> {% endif %} {% if workshop.status == 'ACCEPTED' and workshop.condition_one %} {% if request.user.profile.position == 'instructor' %} - <td>{{ workshop.proposed_workshop_coordinator }}</td> + <td>{{ workshop.proposed_workshop_coordinator.get_full_name }}</td> {% else %} - <td>{{ workshop.proposed_workshop_instructor }}</td> + <td>{{ workshop.proposed_workshop_instructor.get_full_name }}</td> {% endif %} - <td>{{ workshop.proposed_workshop_title }}</td> - <td>{{ workshop.proposed_workshop_date }}</td> + <td>{{ workshop.proposed_workshop_title }}</td> + <td>{{ workshop.proposed_workshop_date | date }}</td> <td><span class = "label label-success">{{ workshop.status }}</span></td> {% endif %} </tr> @@ -191,10 +191,10 @@ <tr> {% if workshop.status == 'Pending' and workshop.condition_one %} {% if request.user.profile.position == 'instructor' %} - <td>{{ workshop.proposed_workshop_coordinator }}</td> + <td>{{ workshop.proposed_workshop_coordinator.get_full_name }}</td> {% endif %} - <td>{{ workshop.proposed_workshop_title }}</td> - <td>{{ workshop.proposed_workshop_date }}</td> + <td>{{ workshop.proposed_workshop_title }}</td> + <td>{{ workshop.proposed_workshop_date | date }}</td> <td><span class = "label label-warning">{{ workshop.status }}</span></td> {% if request.user.profile.position == 'instructor' and workshop.status == 'Pending' %} @@ -231,12 +231,12 @@ <tr> {% if workshop.status == 'DELETED' or workshop.status == 'REJECTED' %} {% if request.user.profile.position == 'instructor' %} - <td>{{ workshop.requested_workshop_coordinator }}</td> + <td>{{ workshop.requested_workshop_coordinator.get_full_name }}</td> {% else %} - <td>{{ workshop.requested_workshop_instructor }}</td> + <td>{{ workshop.requested_workshop_instructor.get_full_name }}</td> {% endif %} - <td>{{ workshop.requested_workshop_title }}</td> - <td>{{ workshop.requested_workshop_date }}</td> + <td>{{ workshop.requested_workshop_title | capfirst }}</td> + <td>{{ workshop.requested_workshop_date | date }}</td> <td><span class = "label label-danger">{{ workshop.status }}</span></td> {% endif %} diff --git a/workshop_app/templates/workshop_app/scheduled_workshops.html b/workshop_app/templates/workshop_app/scheduled_workshops.html index 7fcd2f7..8ebb2e6 100644 --- a/workshop_app/templates/workshop_app/scheduled_workshops.html +++ b/workshop_app/templates/workshop_app/scheduled_workshops.html @@ -31,6 +31,7 @@ <thead> <tr> <th>Coordinator Name</th> + <th>Institute Name</th> <th>Instructor Name</th> <th>Workshop Name</th> <th>Workshop Date</th> @@ -41,10 +42,10 @@ {% if workshop.status == 'ACCEPTED' %} <tbody> <tr> - - <td>{{ workshop.proposed_workshop_coordinator }}</td> - <td>{{ workshop.proposed_workshop_instructor }}</td> - <td>{{ workshop.proposed_workshop_title }}</td> + <td>{{ workshop.proposed_workshop_coordinator.get_full_name | capfirst }}</td> + <td>{{ workshop.proposed_workshop_coordinator.profile.institute | capfirst }}</td> + <td>{{ workshop.proposed_workshop_instructor.get_full_name }}</td> + <td>{{ workshop.proposed_workshop_title.workshoptype_name }}</td> <td>{{ workshop.proposed_workshop_date | date}}</td> </tr> </tbody> @@ -57,7 +58,7 @@ </div> {% endif %} </div> - } + {% endblock %}
\ No newline at end of file diff --git a/workshop_app/tests/test_models.py b/workshop_app/tests/test_models.py index bd037ec..0b33842 100644 --- a/workshop_app/tests/test_models.py +++ b/workshop_app/tests/test_models.py @@ -1,7 +1,8 @@ from django.test import TestCase from workshop_app.models import ( - Profile, User, Workshop, WorkshopType, - RequestedWorkshop, BookedWorkshop, ProposeWorkshopDate + Profile, User, Workshop, WorkshopType, + RequestedWorkshop, BookedWorkshop, ProposeWorkshopDate, + Testimonial ) from datetime import datetime @@ -187,3 +188,31 @@ class BookedWorkshopModelTest(TestCase): self.assertEqual(self.bwr.booked_workshop_requested.requested_workshop_title.workshoptype_name, 'ISCP' ) +class TestimonialModelTest(TestCase): + ''' + This class tests the Testimonial Model + ''' + + def setUp(self): + self.testimonial_one = Testimonial.objects.create( + name='ABC XYZ', + institute='VIDYA GHAR', + department='CS', + message='Lorem ipsum dolor sit amet, consectetur \ + tempor incididunt ut labore et dolore magna aliqua\ + quis nostrud exercitation ullamco laboris nisi ut \ + consequat. Duis aute irure dolor in reprehenderit in voluptat\ + cillum dolore eu fugiat nulla pariatur. Excepteur sint \ + proident, sunt in culpa qui officia deserunt mollit anim' + ) + + def test_testimonials_model(self): + self.assertEqual(self.testimonial_one.name, 'ABC XYZ') + self.assertEqual(self.testimonial_one.department, 'CS') + self.assertEqual(self.testimonial_one.institute, 'VIDYA GHAR') + self.assertEqual(self.testimonial_one.message, 'Lorem ipsum dolor sit amet, consectetur \ + tempor incididunt ut labore et dolore magna aliqua\ + quis nostrud exercitation ullamco laboris nisi ut \ + consequat. Duis aute irure dolor in reprehenderit in voluptat\ + cillum dolore eu fugiat nulla pariatur. Excepteur sint \ + proident, sunt in culpa qui officia deserunt mollit anim') diff --git a/workshop_app/tests/test_views.py b/workshop_app/tests/test_views.py index b37e416..5dbfff5 100644 --- a/workshop_app/tests/test_views.py +++ b/workshop_app/tests/test_views.py @@ -91,6 +91,21 @@ class TestProfile(TestCase): self.assertEqual(response.status_code, 200) # self.assertTemplateUsed(response, 'workshop_app/profile_updated.html') + def test_register_page(self): + self.client.get('/register/') + self.register_response = self.client.post('/register/', + data={ + 'username':'testuser', + 'email':'test@user.com', + 'password':'ABCD@123*', + 'confirm password':'ABCD@123*', + 'first name':'testor', + 'last name':'user', + 'phone number': 1234567890, + 'institute':'IIT', + 'department':(2)}) + + self.assertEqual(self.register_response.status_code,200) class TestWorkshopCreation(TestCase): def setUp(self): @@ -183,7 +198,8 @@ class TestWorkshopCreation(TestCase): 'proposed_workshop_date': '2017-06-06' }) self.proposed_workshop = ProposeWorkshopDate.objects.get(proposed_workshop_date='2017-06-06') - self.assertEqual(str(self.proposed_workshop.proposed_workshop_title),'ISCP 1days, 8hours a day') + self.assertEqual(str(self.proposed_workshop.proposed_workshop_title), + 'ISCP 1days, 8hours a day') self.client.logout() @@ -244,3 +260,32 @@ class TestWorkshopDashboard(TestCase): ) +class TestStaticPages(TestCase): + + def test_testimonials(self): + response = self.client.get('/testimonials/') + self.assertEqual(response.status_code, 200) + + def test_register(self): + response = self.client.get('/register/') + self.assertEqual(response.status_code, 200) + + def test_faq(self): + response = self.client.get('/faq/') + self.assertEqual(response.status_code, 200) + + def test_how_to_participate(self): + response = self.client.get('/how_to_participate/') + self.assertEqual(response.status_code, 200) + + def test_benefits(self): + response = self.client.get('/benefits/') + self.assertEqual(response.status_code, 200) + + def test_fileview(self): + response = self.client.get('/file_view/flowchart') + self.assertEqual(response.status_code, 200) + + def test_view_workshoptype_details(self): + response = self.client.get('/view_workshoptype_details/') + self.assertEqual(response.status_code, 200) diff --git a/workshop_app/views.py b/workshop_app/views.py index 7cf1c84..19b0d5f 100644 --- a/workshop_app/views.py +++ b/workshop_app/views.py @@ -514,7 +514,6 @@ def my_workshops(request): return HttpResponse("Workshop Deleted") elif client_data[-1] == 'APPROVED': - print(client_data) workshop_date = datetime.strptime( client_data[1], "%Y-%m-%d" ) @@ -890,9 +889,17 @@ def testimonials(request): @login_required def scheduled_workshops(request): user = request.user + today = datetime.now() + upto = datetime.now() + dt.timedelta(days=15) if is_instructor(user) and is_email_checked(user): try: - accepted_workshops = ProposeWorkshopDate.objects.all().order_by('-id')[:15] + accepted_workshops = ProposeWorkshopDate.objects.filter( + proposed_workshop_date__range=(today, upto) + ) + accepted_workshops = (sorted(accepted_workshops, + key=lambda x: datetime.strftime( + x.proposed_workshop_date, '%d-%m-%Y' + ))) except: accepted_workshops = None return render(request, 'workshop_app/scheduled_workshops.html', |