From 8c9d7932a15e7a7b5054c7f073b43ba6293a3d27 Mon Sep 17 00:00:00 2001 From: rimonsh Date: Wed, 17 May 2023 17:53:13 +0300 Subject: [PATCH] adding poll view to event page Signed-off-by: rimonsh --- event/templates/event/event_info.html | 1 + poll/views.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/event/templates/event/event_info.html b/event/templates/event/event_info.html index 21018ab..ae31f74 100644 --- a/event/templates/event/event_info.html +++ b/event/templates/event/event_info.html @@ -10,6 +10,7 @@

{{event.name}} Event

  • Starts At: {{event.start_time}}
  • Ends At: {{event.end_time}}
  • Participants : {{event.participants_num}}/{{event.max_participants}}
  • +
  • Poll : {{event.poll}}
  • {% endblock %} diff --git a/poll/views.py b/poll/views.py index fd0e044..5715c4c 100644 --- a/poll/views.py +++ b/poll/views.py @@ -1,3 +1,9 @@ # from django.shortcuts import render +from django.shortcuts import render +from .models import Poll -# Create your views here. + +def view_poll(request): + poll_id = request.GET["id"] + poll = Poll.manager.get(id=poll_id) + return render(request, 'event/event_info.html', {'poll': poll})