From e9dd602366528888cb9649317ea54f8034e60b59 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 22 2015 08:49:23 +0000 Subject: Add a new form to add/change the status of an issue --- diff --git a/pagure/forms.py b/pagure/forms.py index ae43bc5..aeedf7f 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -72,6 +72,26 @@ class AddIssueTagForm(wtf.Form): ) +class StatusForm(wtf.Form): + ''' Form to add/change the status of an issue. ''' + status = wtforms.SelectField( + 'Status', + [wtforms.validators.Required()], + choices=[(item, item) for item in []] + ) + + def __init__(self, *args, **kwargs): + """ Calls the default constructor with the normal argument but + uses the list of collection provided to fill the choices of the + drop-down list. + """ + super(StatusForm, self).__init__(*args, **kwargs) + if 'status' in kwargs: + self.status.choices = [ + (status, status) for status in kwargs['status'] + ] + + class UpdateIssueForm(wtf.Form): ''' Form to add a comment to an issue. ''' tag = wtforms.TextField(