From fe098ad6219559c5e51e31ca66e7111043a61e9d Mon Sep 17 00:00:00 2001 From: Amit Upreti Date: Wed, 8 Mar 2023 15:41:43 -0500 Subject: [PATCH 01/24] use buttons to create/remove cohosts --- .../templates/events/event_entries.html | 65 ++++++++++--------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/physionet-django/events/templates/events/event_entries.html b/physionet-django/events/templates/events/event_entries.html index 3fc91e2ce1..d47e3df7fc 100644 --- a/physionet-django/events/templates/events/event_entries.html +++ b/physionet-django/events/templates/events/event_entries.html @@ -1,35 +1,38 @@ {% load participation_status %} + \ No newline at end of file From 6cbf5443e3ec05e94eaa97f3dcb75fd7b4bcace1 Mon Sep 17 00:00:00 2001 From: Amit Upreti Date: Wed, 8 Mar 2023 15:55:15 -0500 Subject: [PATCH 02/24] add view to manage cohost The view will be used by ajax request which will be sent from event_home.html. --- physionet-django/events/urls.py | 1 + physionet-django/events/views.py | 47 ++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/physionet-django/events/urls.py b/physionet-django/events/urls.py index 6feaeac384..3b19086667 100644 --- a/physionet-django/events/urls.py +++ b/physionet-django/events/urls.py @@ -6,6 +6,7 @@ urlpatterns = [ path('', views.event_home, name='event_home'), path('create/', views.create_event, name='create_event'), + path('manage_co_hosts/', views.manage_co_hosts, name='manage_co_hosts'), path('/', views.event_detail, name='event_detail'), path('/edit_event/', views.update_event, name='update_event'), path('/details/', views.get_event_details, name='get_event_details'), diff --git a/physionet-django/events/views.py b/physionet-django/events/views.py index 3c2f256560..8d87721d9c 100644 --- a/physionet-django/events/views.py +++ b/physionet-django/events/views.py @@ -310,3 +310,50 @@ def event_detail(request, event_slug): 'is_waitlisted': is_waitlisted, 'event_datasets': event_datasets, }) + + +@login_required +def manage_co_hosts(request): + """ + Manage co-hosts of an event + """ + user = request.user + + if request.method == 'POST' and request.is_ajax(): + participant_id = request.POST.get('participant_id') + + event_slug = request.POST.get('event_slug') + event = get_object_or_404(Event, slug=event_slug) + + if not event.host == user: + return JsonResponse({'error': 'You are not the host of this event'}, status=403) + + if event.end_date < datetime.now().date(): + return JsonResponse({'error': 'You cannot manage co-hosts of an event that has ended'}, status=403) + + if not event.participants.filter(id=participant_id).exists(): + return JsonResponse({'error': 'User is not a participant of this event'}, status=403) + + participant = event.participants.get(id=participant_id) + + if 'Remove cohost' in request.POST.get('submit'): + if not participant.is_cohost: + return JsonResponse({'error': 'User is not a cohost of this event'}, status=403) + participant.is_cohost = False + participant.save() + + # placeholder for notification to cohost that they have been removed and to host that they removed a cohost + + return JsonResponse({'success': 'Cohost removed successfully'}) + elif 'Make cohost' in request.POST.get('submit'): + if participant.is_cohost: + return JsonResponse({'error': 'User is already a cohost of this event'}, status=403) + participant.is_cohost = True + participant.save() + + # placeholder for notification to cohost that they have been added and to host that they added a cohost + + return JsonResponse({'success': 'Cohost added successfully'}) + + messages.error(request, 'Invalid request') + return redirect(event_home) From 006975129047a2b488a7496b5ff7124edfa8a59c Mon Sep 17 00:00:00 2001 From: Amit Upreti Date: Wed, 8 Mar 2023 16:39:41 -0500 Subject: [PATCH 03/24] implement the make cohost on templates Here, when event host clicks the `Make Cohost` or the `Remove Cohost` button, 1. we will immediately disable the button(so that host cant spam the button), it also acts like a feedback to host that the task is processing. 2. Then we send ajax request to our view 3. Depending on the response from view, a. If successfull, we will either change the button from `Make Cohost` to `Remove Cohost` or vice versa(depending on whether the host was trying to make cohost or remove cohost) b. If unsuccessfull, we will enable the button again to allow host to try again. --- .../templates/events/event_entries.html | 16 ++++++-- .../events/templates/events/event_home.html | 41 +++++++++++++++++++ 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/physionet-django/events/templates/events/event_entries.html b/physionet-django/events/templates/events/event_entries.html index d47e3df7fc..4339b1892b 100644 --- a/physionet-django/events/templates/events/event_entries.html +++ b/physionet-django/events/templates/events/event_entries.html @@ -22,11 +22,19 @@ {{ participant.user.is_credentialed }} {% if participant.is_cohost %} - +
+ {% csrf_token %} + + + +
{% else %} - +
+ {% csrf_token %} + + + +
{% endif %} diff --git a/physionet-django/events/templates/events/event_home.html b/physionet-django/events/templates/events/event_home.html index d921011cf8..f068d39a97 100644 --- a/physionet-django/events/templates/events/event_home.html +++ b/physionet-django/events/templates/events/event_home.html @@ -198,6 +198,47 @@ {% block local_js_bottom %} {% endblock %} From f543b353dbd1a1b71917d6ce680c5aae808cd1ba Mon Sep 17 00:00:00 2001 From: Amit Upreti Date: Wed, 8 Mar 2023 16:53:36 -0500 Subject: [PATCH 04/24] only allow to add cohost to active event --- physionet-django/events/models.py | 6 ++++++ physionet-django/events/templates/events/event_entries.html | 2 ++ 2 files changed, 8 insertions(+) diff --git a/physionet-django/events/models.py b/physionet-django/events/models.py index 0c253c58b6..44248d6505 100644 --- a/physionet-django/events/models.py +++ b/physionet-django/events/models.py @@ -59,6 +59,12 @@ def get_cohosts(self): """ return self.participants.filter(is_cohost=True) + def has_ended(self): + """ + Returns true if the event has ended. + """ + return self.end_date < timezone.now().date() + class EventParticipant(models.Model): """ diff --git a/physionet-django/events/templates/events/event_entries.html b/physionet-django/events/templates/events/event_entries.html index 4339b1892b..bb53c83de6 100644 --- a/physionet-django/events/templates/events/event_entries.html +++ b/physionet-django/events/templates/events/event_entries.html @@ -21,6 +21,7 @@ {{ participant.user.email }} {{ participant.user.is_credentialed }} + {% if not event.has_ended %} {% if participant.is_cohost %}
{% csrf_token %} @@ -36,6 +37,7 @@
{% endif %} + {% endif %} {% endfor %} From de11f3ea316997b8045776234f3c662eda8aeb20 Mon Sep 17 00:00:00 2001 From: Amit Upreti Date: Fri, 10 Mar 2023 14:31:55 -0500 Subject: [PATCH 05/24] send email to host,cohost Whenever a host adds or removes a cohost to the event, email notification are sent to a) host and b) the added/removed cohost --- .../event_cohost_cohost_status_change.html | 15 +++++++ .../event_host_cohost_status_change.html | 14 +++++++ physionet-django/events/views.py | 16 ++++++-- physionet-django/notification/utility.py | 39 +++++++++++++++++++ 4 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html create mode 100644 physionet-django/events/templates/events/email/event_host_cohost_status_change.html diff --git a/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html b/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html new file mode 100644 index 0000000000..03d9b0bc55 --- /dev/null +++ b/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html @@ -0,0 +1,15 @@ +{% load i18n %}{% autoescape off %}{% filter wordwrap:70 %} +Dear {{ name }}, +{% if status == 'Make cohost' %} +You have been added as Cohost to the Event : {{ event_title }}. + +You can now manage the event participants from your events dashboard. +{% elif status == 'Remove cohost' %} +Your Cohost access has been removed from the Event : {{ event_title }}. +{% endif %} +You can view further information about the event using the following link: +{{ url_prefix }}{{ event_url }} + +Regards +The {{ SITE_NAME }} Team +{% endfilter %}{% endautoescape %} diff --git a/physionet-django/events/templates/events/email/event_host_cohost_status_change.html b/physionet-django/events/templates/events/email/event_host_cohost_status_change.html new file mode 100644 index 0000000000..c22563e470 --- /dev/null +++ b/physionet-django/events/templates/events/email/event_host_cohost_status_change.html @@ -0,0 +1,14 @@ +{% load i18n %}{% autoescape off %}{% filter wordwrap:70 %} +Dear {{ host_name }}, +{% if status == 'Make cohost' %} +You have provided {{ cohost_name }} Cohost access to the Event : {{ event_title }}. +{% elif status == 'Remove cohost' %} +You have removed {{ cohost_name }}'s Cohost access from the Event : {{ event_title }}. +{% endif %} +If this was done by mistake, you can change the cohost status by visiting the events dashboard. + +{{ url_prefix }}/events/ + +Regards +The {{ SITE_NAME }} Team +{% endfilter %}{% endautoescape %} diff --git a/physionet-django/events/views.py b/physionet-django/events/views.py index 8d87721d9c..6c583ecf3b 100644 --- a/physionet-django/events/views.py +++ b/physionet-django/events/views.py @@ -341,8 +341,12 @@ def manage_co_hosts(request): return JsonResponse({'error': 'User is not a cohost of this event'}, status=403) participant.is_cohost = False participant.save() - - # placeholder for notification to cohost that they have been removed and to host that they removed a cohost + # notify the cohost that their cohost permission has been removed + notification.notify_event_cohost_cohost_status_change(request=request, cohost=participant.user, + event=event, status='Remove cohost') + # notify the host that they have removed a cohost + notification.notify_event_host_cohost_status_change(request=request, cohost=participant.user, event=event, + status='Remove cohost') return JsonResponse({'success': 'Cohost removed successfully'}) elif 'Make cohost' in request.POST.get('submit'): @@ -350,8 +354,12 @@ def manage_co_hosts(request): return JsonResponse({'error': 'User is already a cohost of this event'}, status=403) participant.is_cohost = True participant.save() - - # placeholder for notification to cohost that they have been added and to host that they added a cohost + # notify the cohost that they have been added as a cohost for the event + notification.notify_event_cohost_cohost_status_change(request=request, cohost=participant.user, + event=event, status='Make cohost') + # notify the host that they have added a cohost for the event + notification.notify_event_host_cohost_status_change(request=request, cohost=participant.user, event=event, + status='Make cohost') return JsonResponse({'success': 'Cohost added successfully'}) diff --git a/physionet-django/notification/utility.py b/physionet-django/notification/utility.py index 83697e2603..b4ae29c934 100644 --- a/physionet-django/notification/utility.py +++ b/physionet-django/notification/utility.py @@ -1006,6 +1006,45 @@ def notify_participant_event_decision(request, user, event, decision, comment_to send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [user.email], fail_silently=False) +def notify_event_cohost_cohost_status_change(request, cohost, event, status='Make cohost'): + """ + Send email to co-host about their cohost status change for the event. + """ + subject = f"{settings.SITE_NAME} Event Cohost Status Change" + context = { + 'name': cohost.get_full_name(), + 'domain': get_current_site(request), + 'url_prefix': get_url_prefix(request), + 'event_title': event.title, + 'event_url': reverse('event_detail', args=[event.slug]), + 'status': status, + 'SITE_NAME': settings.SITE_NAME, + } + body = loader.render_to_string('events/email/event_cohost_cohost_status_change.html', context) + # Not resend the email if there was an integrity error + send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [cohost.email], fail_silently=False) + + +def notify_event_host_cohost_status_change(request, cohost, event, status='Make cohost'): + """ + Send email to host about cohost status change for the event. + """ + subject = f"{settings.SITE_NAME} Event Cohost Status Change" + context = { + 'host_name': event.host.get_full_name(), + 'cohost_name': cohost.get_full_name(), + 'domain': get_current_site(request), + 'url_prefix': get_url_prefix(request), + 'event_title': event.title, + 'event_url': reverse('event_detail', args=[event.slug]), + 'status': status, + 'SITE_NAME': settings.SITE_NAME, + } + body = loader.render_to_string('events/email/event_host_cohost_status_change.html', context) + # Not resend the email if there was an integrity error + send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [cohost.email], fail_silently=False) + + def notify_event_participant_application(request, user, registered_user, event): """ Send email to host and co-host about new registration request on event. From 2be3b506c3e29114d8cf24143b4957f068909b19 Mon Sep 17 00:00:00 2001 From: rutvikrj26 Date: Wed, 11 Oct 2023 15:39:49 -0400 Subject: [PATCH 06/24] addressed comments - made the template more consistent & fixed the is_ajax depreceation issue --- .../event_cohost_cohost_status_change.html | 2 +- .../event_host_cohost_status_change.html | 3 +- .../templates/events/event_applications.html | 98 +++++++++++++------ physionet-django/events/views.py | 6 +- physionet-django/notification/utility.py | 9 +- 5 files changed, 76 insertions(+), 42 deletions(-) diff --git a/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html b/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html index 03d9b0bc55..fbc4a5be78 100644 --- a/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html +++ b/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html @@ -8,7 +8,7 @@ Your Cohost access has been removed from the Event : {{ event_title }}. {% endif %} You can view further information about the event using the following link: -{{ url_prefix }}{{ event_url }} +{{ event_url }} Regards The {{ SITE_NAME }} Team diff --git a/physionet-django/events/templates/events/email/event_host_cohost_status_change.html b/physionet-django/events/templates/events/email/event_host_cohost_status_change.html index c22563e470..dcaa1e4a1f 100644 --- a/physionet-django/events/templates/events/email/event_host_cohost_status_change.html +++ b/physionet-django/events/templates/events/email/event_host_cohost_status_change.html @@ -6,8 +6,7 @@ You have removed {{ cohost_name }}'s Cohost access from the Event : {{ event_title }}. {% endif %} If this was done by mistake, you can change the cohost status by visiting the events dashboard. - -{{ url_prefix }}/events/ +{{ event_url }} Regards The {{ SITE_NAME }} Team diff --git a/physionet-django/events/templates/events/event_applications.html b/physionet-django/events/templates/events/event_applications.html index 613e3d7ea5..94eff90d3d 100644 --- a/physionet-django/events/templates/events/event_applications.html +++ b/physionet-django/events/templates/events/event_applications.html @@ -2,35 +2,75 @@ + +
+ + + + + + + + + + + + {% for participant in event.participants.all %} + + + + + + + + {% endfor %} + +
UsernameFull nameEmailCredentialedCohost
{{ participant.user.username }}{{ participant.user.get_full_name }}{{ participant.user.email }}{{ participant.user.is_credentialed }} + {% if not event.has_ended %} +
+ {% csrf_token %} + + + {% if participant.is_cohost %} + + {% else %} + + {% endif %} +
+ {% endif %} +
+
\ No newline at end of file diff --git a/physionet-django/events/views.py b/physionet-django/events/views.py index 6c583ecf3b..0fd08ba4be 100644 --- a/physionet-django/events/views.py +++ b/physionet-django/events/views.py @@ -319,7 +319,7 @@ def manage_co_hosts(request): """ user = request.user - if request.method == 'POST' and request.is_ajax(): + if request.method == 'POST' and request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest': participant_id = request.POST.get('participant_id') event_slug = request.POST.get('event_slug') @@ -341,10 +341,8 @@ def manage_co_hosts(request): return JsonResponse({'error': 'User is not a cohost of this event'}, status=403) participant.is_cohost = False participant.save() - # notify the cohost that their cohost permission has been removed notification.notify_event_cohost_cohost_status_change(request=request, cohost=participant.user, event=event, status='Remove cohost') - # notify the host that they have removed a cohost notification.notify_event_host_cohost_status_change(request=request, cohost=participant.user, event=event, status='Remove cohost') @@ -354,10 +352,8 @@ def manage_co_hosts(request): return JsonResponse({'error': 'User is already a cohost of this event'}, status=403) participant.is_cohost = True participant.save() - # notify the cohost that they have been added as a cohost for the event notification.notify_event_cohost_cohost_status_change(request=request, cohost=participant.user, event=event, status='Make cohost') - # notify the host that they have added a cohost for the event notification.notify_event_host_cohost_status_change(request=request, cohost=participant.user, event=event, status='Make cohost') diff --git a/physionet-django/notification/utility.py b/physionet-django/notification/utility.py index b4ae29c934..c7ab68333c 100644 --- a/physionet-django/notification/utility.py +++ b/physionet-django/notification/utility.py @@ -3,6 +3,7 @@ """ from email.utils import formataddr from functools import cache +import re from urllib import parse from django.conf import settings @@ -1006,7 +1007,7 @@ def notify_participant_event_decision(request, user, event, decision, comment_to send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [user.email], fail_silently=False) -def notify_event_cohost_cohost_status_change(request, cohost, event, status='Make cohost'): +def notify_event_cohost_cohost_status_change(request, cohost, event, status): """ Send email to co-host about their cohost status change for the event. """ @@ -1014,9 +1015,8 @@ def notify_event_cohost_cohost_status_change(request, cohost, event, status='Mak context = { 'name': cohost.get_full_name(), 'domain': get_current_site(request), - 'url_prefix': get_url_prefix(request), 'event_title': event.title, - 'event_url': reverse('event_detail', args=[event.slug]), + 'event_url': request.build_absolute_uri(reverse('event_detail', args=[event.slug])), 'status': status, 'SITE_NAME': settings.SITE_NAME, } @@ -1034,9 +1034,8 @@ def notify_event_host_cohost_status_change(request, cohost, event, status='Make 'host_name': event.host.get_full_name(), 'cohost_name': cohost.get_full_name(), 'domain': get_current_site(request), - 'url_prefix': get_url_prefix(request), 'event_title': event.title, - 'event_url': reverse('event_detail', args=[event.slug]), + 'event_url': request.build_absolute_uri(reverse('event_detail', args=[event.slug])), 'status': status, 'SITE_NAME': settings.SITE_NAME, } From a5d1ef0b199e097910dd335a6daf3d75838a959d Mon Sep 17 00:00:00 2001 From: rutvikrj26 Date: Wed, 8 Nov 2023 16:21:20 -0500 Subject: [PATCH 07/24] Removed string based email triggers - now using boolean based on database status --- .../email/event_cohost_cohost_status_change.html | 6 +++--- .../events/email/event_host_cohost_status_change.html | 7 ++++--- physionet-django/events/views.py | 10 +++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html b/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html index fbc4a5be78..6e3a633534 100644 --- a/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html +++ b/physionet-django/events/templates/events/email/event_cohost_cohost_status_change.html @@ -1,10 +1,10 @@ {% load i18n %}{% autoescape off %}{% filter wordwrap:70 %} Dear {{ name }}, -{% if status == 'Make cohost' %} +{% if status == True %} You have been added as Cohost to the Event : {{ event_title }}. You can now manage the event participants from your events dashboard. -{% elif status == 'Remove cohost' %} +{% elif status == False %} Your Cohost access has been removed from the Event : {{ event_title }}. {% endif %} You can view further information about the event using the following link: @@ -12,4 +12,4 @@ Regards The {{ SITE_NAME }} Team -{% endfilter %}{% endautoescape %} +{% endfilter %}{% endautoescape %} \ No newline at end of file diff --git a/physionet-django/events/templates/events/email/event_host_cohost_status_change.html b/physionet-django/events/templates/events/email/event_host_cohost_status_change.html index dcaa1e4a1f..fcecfef1e4 100644 --- a/physionet-django/events/templates/events/email/event_host_cohost_status_change.html +++ b/physionet-django/events/templates/events/email/event_host_cohost_status_change.html @@ -1,8 +1,9 @@ {% load i18n %}{% autoescape off %}{% filter wordwrap:70 %} Dear {{ host_name }}, -{% if status == 'Make cohost' %} + +{% if status == True %} You have provided {{ cohost_name }} Cohost access to the Event : {{ event_title }}. -{% elif status == 'Remove cohost' %} +{% elif status == False %} You have removed {{ cohost_name }}'s Cohost access from the Event : {{ event_title }}. {% endif %} If this was done by mistake, you can change the cohost status by visiting the events dashboard. @@ -10,4 +11,4 @@ Regards The {{ SITE_NAME }} Team -{% endfilter %}{% endautoescape %} +{% endfilter %}{% endautoescape %} \ No newline at end of file diff --git a/physionet-django/events/views.py b/physionet-django/events/views.py index 0fd08ba4be..006a4900fb 100644 --- a/physionet-django/events/views.py +++ b/physionet-django/events/views.py @@ -319,7 +319,7 @@ def manage_co_hosts(request): """ user = request.user - if request.method == 'POST' and request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest': + if request.method == 'POST': participant_id = request.POST.get('participant_id') event_slug = request.POST.get('event_slug') @@ -342,9 +342,9 @@ def manage_co_hosts(request): participant.is_cohost = False participant.save() notification.notify_event_cohost_cohost_status_change(request=request, cohost=participant.user, - event=event, status='Remove cohost') + event=event, status=participant.is_cohost) notification.notify_event_host_cohost_status_change(request=request, cohost=participant.user, event=event, - status='Remove cohost') + status=participant.is_cohost) return JsonResponse({'success': 'Cohost removed successfully'}) elif 'Make cohost' in request.POST.get('submit'): @@ -353,9 +353,9 @@ def manage_co_hosts(request): participant.is_cohost = True participant.save() notification.notify_event_cohost_cohost_status_change(request=request, cohost=participant.user, - event=event, status='Make cohost') + event=event, status=participant.is_cohost) notification.notify_event_host_cohost_status_change(request=request, cohost=participant.user, event=event, - status='Make cohost') + status=participant.is_cohost) return JsonResponse({'success': 'Cohost added successfully'}) From 468b1b1255d7794fa9ffd7fdb21f621a9f76d319 Mon Sep 17 00:00:00 2001 From: rutvikrj26 Date: Wed, 8 Nov 2023 16:47:25 -0500 Subject: [PATCH 08/24] fixed multiple return statements with one error message --- physionet-django/events/views.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/physionet-django/events/views.py b/physionet-django/events/views.py index 006a4900fb..797110ac29 100644 --- a/physionet-django/events/views.py +++ b/physionet-django/events/views.py @@ -326,13 +326,11 @@ def manage_co_hosts(request): event = get_object_or_404(Event, slug=event_slug) if not event.host == user: - return JsonResponse({'error': 'You are not the host of this event'}, status=403) - + error_message = = 'You are not the host of this event' if event.end_date < datetime.now().date(): - return JsonResponse({'error': 'You cannot manage co-hosts of an event that has ended'}, status=403) - + error_message = 'You cannot manage co-hosts of an event that has ended' if not event.participants.filter(id=participant_id).exists(): - return JsonResponse({'error': 'User is not a participant of this event'}, status=403) + error_message = 'User is not a participant of this event' participant = event.participants.get(id=participant_id) @@ -360,4 +358,8 @@ def manage_co_hosts(request): return JsonResponse({'success': 'Cohost added successfully'}) messages.error(request, 'Invalid request') + + if error_message: + return JsonResponse({'error': error_message}, status=403) + return redirect(event_home) From 27cdb064c854854e5dde37805022860d2b977764 Mon Sep 17 00:00:00 2001 From: rutvikrj26 Date: Wed, 8 Nov 2023 17:02:28 -0500 Subject: [PATCH 09/24] fixed the double equal issue --- .../templates/events/event_applications.html | 36 ++++++++++++++ .../templates/events/event_entries.html | 48 ------------------- physionet-django/events/views.py | 2 +- 3 files changed, 37 insertions(+), 49 deletions(-) delete mode 100644 physionet-django/events/templates/events/event_entries.html diff --git a/physionet-django/events/templates/events/event_applications.html b/physionet-django/events/templates/events/event_applications.html index 94eff90d3d..6c8039a890 100644 --- a/physionet-django/events/templates/events/event_applications.html +++ b/physionet-django/events/templates/events/event_applications.html @@ -73,4 +73,40 @@ {% endfor %} + + + + + + + + + + + + + {% for participant in event.participants.all %} + + + + + + + + {% endfor %} + +
UsernameFull nameEmailCredentialedCohost
{{ participant.user.username }}{{ participant.user.get_full_name }}{{ participant.user.email }}{{ participant.user.is_credentialed }} + {% if not event.has_ended %} +
+ {% csrf_token %} + + + {% if participant.is_cohost %} + + {% else %} + + {% endif %} +
+ {% endif %} +
\ No newline at end of file diff --git a/physionet-django/events/templates/events/event_entries.html b/physionet-django/events/templates/events/event_entries.html deleted file mode 100644 index bb53c83de6..0000000000 --- a/physionet-django/events/templates/events/event_entries.html +++ /dev/null @@ -1,48 +0,0 @@ -{% load participation_status %} - \ No newline at end of file diff --git a/physionet-django/events/views.py b/physionet-django/events/views.py index 797110ac29..2da0e0ea9c 100644 --- a/physionet-django/events/views.py +++ b/physionet-django/events/views.py @@ -326,7 +326,7 @@ def manage_co_hosts(request): event = get_object_or_404(Event, slug=event_slug) if not event.host == user: - error_message = = 'You are not the host of this event' + error_message = 'You are not the host of this event' if event.end_date < datetime.now().date(): error_message = 'You cannot manage co-hosts of an event that has ended' if not event.participants.filter(id=participant_id).exists(): From 85245f2eacc36e8c9173cf9388b848c8d659ce26 Mon Sep 17 00:00:00 2001 From: rutvikrj26 Date: Wed, 15 Nov 2023 10:10:49 -0500 Subject: [PATCH 10/24] Fully working events functionality - serialized add/remove pending --- .../templates/console/event_management.html | 139 ++++--- .../templates/events/event_applications.html | 74 ---- .../events/templates/events/event_home.html | 344 ++++++++---------- physionet-django/events/views.py | 21 +- 4 files changed, 237 insertions(+), 341 deletions(-) diff --git a/physionet-django/console/templates/console/event_management.html b/physionet-django/console/templates/console/event_management.html index 4ba78e357a..31701cd17a 100644 --- a/physionet-django/console/templates/console/event_management.html +++ b/physionet-django/console/templates/console/event_management.html @@ -2,90 +2,85 @@ {% load static %} {% block title %}Event Management{% endblock %} {% block content %} -

{{ event.title }}

-
-
-
Event Details
-
-
-
Event Organizer:
- -
-
-
Category:
-
{{ event.category }}
-
-
-
Created on:
-
{{ event.added_datetime | date:"d M Y" }}
-
-
-
Start Date:
-
{{ event.start_date | date:"d M Y" }}
-
-
-
End Date:
-
{{ event.end_date | date:"d M Y" }}
+

{{ event.title }}

+
+
+
Event Details
+
+
+
Event Organizer:
+ -
-
Allowed Domains:
-
- {% if event.allowed_domains %} - {{ event.allowed_domains }} - {% else %} - {% endif %} -
+
+
+
Category:
+
{{ event.category }}
+
+
+
Created on:
+
{{ event.added_datetime | date:"d M Y" }}
+
+
+
Start Date:
+
{{ event.start_date | date:"d M Y" }}
+
+
+
End Date:
+
{{ event.end_date | date:"d M Y" }}
+
+
+
Allowed Domains:
+
+ {% if event.allowed_domains %} + {{ event.allowed_domains }} + {% else %} + {% endif %}
+
- {% for info in applicant_info %} -
-
{{ info.title }}
-
-
-
{{ info.count }}
-
- -
+ {% for info in applicant_info %} +
+
{{ info.title }}
+
+
+
{{ info.count }}
+
+
- {% endfor %} +
+ {% endfor %} -
-
Description:
-
{{ event.description }}
-
- +
+
Description:
+
{{ event.description }}
+
- {% include 'console/event_management_manage_dataset.html' %} +
+{% include 'console/event_management_manage_dataset.html' %} - {% for info in applicant_info %} -