From b9f3fbfd7e436dfe641a3a3b4c9fe6296fc55549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Wed, 5 Oct 2016 21:29:15 +0200 Subject: [PATCH] track form: add suggestions for managers --- proposals/forms.py | 6 +++++- proposals/templates/proposals/track_form.html | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/proposals/forms.py b/proposals/forms.py index a0b96c7..eeda9da 100644 --- a/proposals/forms.py +++ b/proposals/forms.py @@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _ from django_select2.forms import Select2TagWidget -from accounts.models import Transport +from accounts.models import User, Transport from proposals.models import Conference, Event, Talk, Topic, Track STATUS_CHOICES = [ @@ -138,6 +138,10 @@ class TrackForm(forms.ModelForm): def __init__(self, *args, **kwargs): self.site = kwargs.pop('site') super().__init__(*args, **kwargs) + if 'instance' in kwargs: + reviewers = User.objects.filter(topic__track=kwargs['instance']) + if reviewers.exists(): + self.fields['managers'].help_text = 'Suggestion: ' + ', '.join([str(u) for u in reviewers.all()]) class Meta: model = Track diff --git a/proposals/templates/proposals/track_form.html b/proposals/templates/proposals/track_form.html index 21cbdcb..c5de1c0 100644 --- a/proposals/templates/proposals/track_form.html +++ b/proposals/templates/proposals/track_form.html @@ -2,7 +2,7 @@ {% load bootstrap3 i18n %} -{% block topictab %} class="active"{% endblock %} +{% block tracktab %} class="active"{% endblock %} {% block css %} {{ block.super }}