From bd5f16da31c4b37193ae963b2ef4b3ed54fcedcc Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 22 2015 08:49:24 +0000 Subject: Add the NewTokenForm --- diff --git a/pagure/forms.py b/pagure/forms.py index aeedf7f..587668d 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -92,6 +92,26 @@ class StatusForm(wtf.Form): ] +class NewTokenForm(wtf.Form): + ''' Form to add/change the status of an issue. ''' + acls = wtforms.SelectMultipleField( + 'ACLs', + [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(NewTokenForm, self).__init__(*args, **kwargs) + if 'acls' in kwargs: + self.acls.choices = [ + (acl.name, acl.name) for acl in kwargs['acls'] + ] + + class UpdateIssueForm(wtf.Form): ''' Form to add a comment to an issue. ''' tag = wtforms.TextField(