summaryrefslogtreecommitdiff
path: root/workshop_app
diff options
context:
space:
mode:
authorpnshiralkar2020-05-09 00:36:07 +0530
committerpnshiralkar2020-05-09 00:36:07 +0530
commitbeee9d9478c40ec050c57d19766fa3e8de664452 (patch)
treeb7b552655b0d6b939c411d51672bd00cb51bf657 /workshop_app
parent0fcf9d662c4768729f5d11553cc07659bd7f97a7 (diff)
downloadworkshop_booking-beee9d9478c40ec050c57d19766fa3e8de664452.tar.gz
workshop_booking-beee9d9478c40ec050c57d19766fa3e8de664452.tar.bz2
workshop_booking-beee9d9478c40ec050c57d19766fa3e8de664452.zip
Removed inline styling, optimized query in instructor view, removed client_data variable in change_ws_date, optimized URL workshop_id regex
Diffstat (limited to 'workshop_app')
-rw-r--r--workshop_app/templates/workshop_app/workshop_status_coordinator.html17
-rw-r--r--workshop_app/templates/workshop_app/workshop_status_instructor.html13
-rw-r--r--workshop_app/urls.py8
-rw-r--r--workshop_app/views.py13
4 files changed, 29 insertions, 22 deletions
diff --git a/workshop_app/templates/workshop_app/workshop_status_coordinator.html b/workshop_app/templates/workshop_app/workshop_status_coordinator.html
index 07045de..00e28b3 100644
--- a/workshop_app/templates/workshop_app/workshop_status_coordinator.html
+++ b/workshop_app/templates/workshop_app/workshop_status_coordinator.html
@@ -4,25 +4,32 @@
My Workshops
{% endblock %}
+{% block extra-custom-scripts %}
+<style >
+ .table-heading{
+ color: #04a9cf;
+ }
+ </style>
+{% endblock %}
+
{% block content %}
{% if not workshops %}
<div class="container">
<div class="jumbotron">
<h1>Welcome {{ user.first_name }}</h1>
<p>Information Related to your workshops will be shown here, you can also
- propose a Workshop as per your available date in <strong>Workshops > Propose a Workshop
- tab</strong> .</p>
+ propose a Workshop as per your available date in <strong>Propose Workshop tab</strong> .</p>
</div>
</div>
{% else %}
- <h3 class="text-center" style="color:#2952a2;">The status of your workshops </h3>
+ <h3 class="text-center">The status of your workshops </h3>
<br>
<!-- Accepted View -->
<br>
<div class="container">
- <h3 class="text-center" style="color: #04a9cf;"><strong>Workshops Accepted</strong></h3>
+ <h3 class="text-center table-heading"><strong>Workshops Accepted</strong></h3>
<table class="table table-striped">
<thead>
<tr>
@@ -53,7 +60,7 @@
<br>
<div class="container">
- <h3 class="text-center" style="color: #04a9cf;"><strong>Workshops Proposed By Me</strong></h3>
+ <h3 class="text-center table-heading"><strong>Workshops Proposed By Me</strong></h3>
<table class="table table-striped">
<thead>
<tr>
diff --git a/workshop_app/templates/workshop_app/workshop_status_instructor.html b/workshop_app/templates/workshop_app/workshop_status_instructor.html
index 0a246b3..ef64a70 100644
--- a/workshop_app/templates/workshop_app/workshop_status_instructor.html
+++ b/workshop_app/templates/workshop_app/workshop_status_instructor.html
@@ -5,6 +5,11 @@
{% endblock %}
{% block extra-dependencies %}
+ <style >
+ .table-heading{
+ color: #04a9cf;
+ }
+ </style>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
@@ -27,13 +32,13 @@
</div>
</div>
{% else %}
- <h3 class="text-center" style="color:#2952a2;">The status of your workshops </h3>
+ <h3 class="text-center">The status of your workshops </h3>
<br>
<!-- Accepted View -->
<br>
<div class="container">
- <h3 align="center" style="color: #04a9cf;"><strong>Workshops Accepted</strong></h3>
+ <h3 align="center" class="table-heading"><strong>Workshops Accepted</strong></h3>
<table class="table table-striped">
<thead>
<tr>
@@ -57,7 +62,7 @@
<td>{{ workshop.date | date }}
{% if workshop.date > today %}
- <span class="material-icons datepicker" style="cursor:pointer;"
+ <span class="material-icons datepicker btn"
data-toggle="popinfo"
title="Note"
data-content="Click here to change date"
@@ -87,7 +92,7 @@
<!-- Proposed View -->
<br>
<div class="container">
- <h3 class="text-center" style="color: #04a9cf;"><strong>Workshops Proposed By Coordinators</strong>
+ <h3 class="text-center table-heading"><strong>Workshops Proposed By Coordinators</strong>
</h3>
<table class="table table-striped">
<thead>
diff --git a/workshop_app/urls.py b/workshop_app/urls.py
index d18b8a9..5faf3ab 100644
--- a/workshop_app/urls.py
+++ b/workshop_app/urls.py
@@ -27,10 +27,10 @@ urlpatterns = [
url(r'^edit_profile/$', views.edit_profile),
url(r'^workshop_status$', views.workshop_status_coordinator, name='workshop_status_coordinator'),
url(r'^dashboard$', views.workshop_status_instructor, name='workshop_status_instructor'),
- url(r'^accept_workshop/([1-9][0-9]*)$', views.accept_workshop, name='accept_workshop'),
- url(r'^change_workshop_date/([1-9][0-9]*)$', views.change_workshop_date, name='change_workshop_date'),
+ url(r'^accept_workshop/(?P<workshop_id>\d+)', views.accept_workshop, name='accept_workshop'),
+ url(r'^change_workshop_date/(?P<workshop_id>\d+)$', views.change_workshop_date, name='change_workshop_date'),
url(r'^propose_workshop/$', views.propose_workshop),
url(r'^workshop_types/$', views.workshop_type_list),
- url(r'^workshop_type_details/([1-9][0-9]*)$', views.workshop_type_details),
- url(r'^view_profile/([1-9][0-9]*)$', views.view_comment_profile, name='view_profile'),
+ url(r'^workshop_type_details/(?P<workshop_type_id>\d+)$', views.workshop_type_details),
+ url(r'^view_profile/(?P<workshop_type_id>\d+)$', views.view_comment_profile, name='view_profile'),
]
diff --git a/workshop_app/views.py b/workshop_app/views.py
index 2eba2e0..5b88d90 100644
--- a/workshop_app/views.py
+++ b/workshop_app/views.py
@@ -1,3 +1,4 @@
+from django.db.models import Q
from django.urls import reverse
try:
@@ -216,16 +217,11 @@ def workshop_status_instructor(request):
if not is_instructor(user):
return redirect(get_landing_page(user))
today = timezone.now().date()
- proposed_workshop = Workshop.objects.filter(
+ workshops = Workshop.objects.filter(Q(
instructor=user.id,
date__gte=today,
- ).order_by('-date')
-
- proposed_workshop_pending = Workshop.objects.filter(
- status=0
- ).order_by('-date')
+ ) | Q(status=0)).order_by('-date')
- workshops = list(proposed_workshop) + list(proposed_workshop_pending)
return render(request, 'workshop_app/workshop_status_instructor.html',
{"workshops": workshops,
"today": today})
@@ -271,8 +267,7 @@ def change_workshop_date(request, workshop_id):
if not is_instructor(user):
return redirect(get_landing_page(user))
if request.method == 'POST':
- client_data = request.POST
- new_workshop_date = datetime.strptime(client_data.get('new_date'), "%Y-%m-%d")
+ new_workshop_date = datetime.strptime(request.POST.get('new_date'), "%Y-%m-%d")
today = datetime.today()
if today <= new_workshop_date:
workshop = Workshop.objects.filter(id=workshop_id)