from django import forms

import re
from sicurezza.views import getSecurityLevelAll
from .models import *

from django import forms

class formFiltro(forms.Form):
  def __init__(self,*args,**kwargs):
    forms.Form.__init__(self,*args,**kwargs)

    self.fields['filtro'] = forms.CharField(required=True)
    self.fields['status'] = forms.ChoiceField(required=True,choices=self.listStatus)
    self.fields['destination'] = forms.CharField(required=True)
    self.fields['redirect'] = forms.CharField(required=False)
    self.fields['dinput'] = forms.BooleanField(required=False)
    self.fields['doutput'] = forms.BooleanField(required=False)
    self.fields['header'] = forms.BooleanField(required=False)
    self.fields['body'] = forms.BooleanField(required=False)
    self.fields['enabled'] =  forms.BooleanField(required=False)

  def listStatus(self):
    _livelli = []
    _livelli.append(('ok','ok'))
    _livelli.append(('reject','reject'))
    _livelli.append(('hold','hold'))
    _livelli.append(('pass','pass'))
    _livelli.append(('redirect','redirect'))
    _livelli.append(('dunno','dunno'))
    return _livelli
