diff --git a/Django/communicado/pages/models.py b/Django/communicado/pages/models.py
index b7bc0e91..662ae1b2 100644
--- a/Django/communicado/pages/models.py
+++ b/Django/communicado/pages/models.py
@@ -58,14 +58,13 @@ class Events(models.Model):
capacity = models.IntegerField(null=True, blank=True)
category = models.CharField(max_length=50, null=True, blank=True)
artist = models.CharField(max_length=100, null=True, blank=True)
- isVerified = models.BooleanField(default=False)
- #isVerified=models.IntegerField(default=0)
- # IS_VERIFIED_CHOICES = (
- # (0, 'Not Checked'),
- # (1, 'Approved'),
- # (-1, 'Rejected'),
- # )
- # isVerified = models.IntegerField(choices=IS_VERIFIED_CHOICES, default=0)
+ #isVerified = models.BooleanField(default=False)
+ IS_VERIFIED_CHOICES = (
+ (0, 'Not Checked'),
+ (1, 'Approved'),
+ (-1, 'Rejected'),
+ )
+ isVerified = models.IntegerField(choices=IS_VERIFIED_CHOICES, default=0)
adminID = models.ForeignKey(Admin, on_delete=models.CASCADE, null=True, blank=True,db_column= "adminID")
eventOrganizerID = models.ForeignKey(EventOrganizer, on_delete=models.CASCADE, null=True, blank=True,db_column="eventOrganizerID")
diff --git a/Django/communicado/pages/templates/pages/eventaction.html b/Django/communicado/pages/templates/pages/eventaction.html
new file mode 100644
index 00000000..e2dc16a6
--- /dev/null
+++ b/Django/communicado/pages/templates/pages/eventaction.html
@@ -0,0 +1,221 @@
+{% load static %}
+
+
+
+
+
+ Edit Event - {{ event.name }}
+
+
+
+
+
+
Update Event
+
+
+
{{ event.name }} Details
+
+ {% if event.imageURL %}
+
+
+
{% endif %}
+
+ Name:
+ {{ event.name }}
+
+
+ Date and Time:
+ {{ event.eventDateTime }}
+
+
+ Location:
+ {{ event.location }}
+
+
+ Capacity:
+ {{ event.capacity }}
+
+
+ Category:
+ {{ event.category }}
+
+
+ Artist:
+ {{ event.artist }}
+
+
+ Price:
+ {{ event.price }}
+
+
+ Event ID:
+ {{ event.eventID }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Django/communicado/pages/templates/pages/pending.html b/Django/communicado/pages/templates/pages/pending.html
index f1ef3b76..bdecb218 100644
--- a/Django/communicado/pages/templates/pages/pending.html
+++ b/Django/communicado/pages/templates/pages/pending.html
@@ -1,9 +1,211 @@
+{% load static %}
-
+
+
+
Pending Events
+
- Pending Events
+
+
+
+
Pending Events
+ {% if pending %}
+
+ {% for event in pending %}
+
+
+
+
+
+
+
+
{{ event.name }}
+
{{ event.eventDateTime }}
+
Location: {{ event.location }}
+
+
Capacity: {{ event.capacity }}
+
+
Category: {{ event.category }}
+
+
Artist: {{ event.artist }}
+
+
Price: {{ event.price }}
+
Event ID: {{ event.eventID }}
+ {% comment %}
+
{% endcomment %}
+
Approve/Reject Event
+
+
+
+
+ {% endfor %}
+
+ {% else %}
+
No pending events
+ {% endif %}
+
+ {% comment %} {% endcomment %}
+
+
-
\ No newline at end of file
+
diff --git a/Django/communicado/pages/urls.py b/Django/communicado/pages/urls.py
index 671d6a05..588cc492 100644
--- a/Django/communicado/pages/urls.py
+++ b/Django/communicado/pages/urls.py
@@ -19,6 +19,9 @@
path('admin_actions', views.admin_actions, name='admin_actions'),
path('pending', views.pending, name='pending'),
path('rejected', views.rejected, name='rejected'),
+ path('eventaction/', views.eventaction, name='eventaction'),
+ path('approve_event/', views.approve_event, name='approve_event'),
+ path('reject_event/', views.reject_event, name='reject_event'),
]
diff --git a/Django/communicado/pages/views.py b/Django/communicado/pages/views.py
index f05c1401..99f66d34 100644
--- a/Django/communicado/pages/views.py
+++ b/Django/communicado/pages/views.py
@@ -62,7 +62,7 @@ def signup(request):
if role.__eq__('EventOrganizer'):
event_organizer = EventOrganizer(user=user, phoneNumber=phoneNumber)
event_organizer.save()
-
+
success_message = "User Account Created for: " + user.name
return render(request, 'pages/login.html', {'success_message': success_message})
@@ -301,12 +301,39 @@ def admin_actions(request):
return render (request,"pages/admin_actions.html",context)
def pending(request):
- userData = users.objects.all()
- context = {"userData": userData, }
- return render (request,"pages/pending.html",context)
+ pending = Events.objects.filter(isVerified=0)
+ # if request.method == 'POST':
+ # event_id = request.POST.get('event_id')
+ # action = request.POST.get('action')
+ # if action == 'approve':
+ # event = Events.objects.get(id=event_id)
+ # event.isVerified = 1
+ # event.save()
+
+ return render(request, 'pages/pending.html', {'pending': pending})
+
def rejected(request):
userData = users.objects.all()
context = {"rejected": userData, }
return render (request,"pages/rejected.html",context)
-
\ No newline at end of file
+def eventaction(request,event_ID):
+ # userData = users.objects.all()
+ # context = {"eventaction": userData, }
+ # return render (request,"pages/eventaction.html",context)
+
+ event = get_object_or_404(Events,eventID=event_ID)
+ return render(request, 'pages/eventaction.html', {'event': event})
+
+
+def approve_event(request, event_ID):
+ event = get_object_or_404(Events,eventID=event_ID)
+ event.isVerified = 1
+ event.save()
+ return redirect('pending')
+
+def reject_event(request, event_ID):
+ event = get_object_or_404(Events,eventID=event_ID)
+ event.isVerified = -1
+ event.save()
+ return redirect('pending')