<commit_before>from django import forms
import service.models
from django.forms.util import ErrorList


class ServiceForm(forms.Form):
    name = forms.CharField(max_length=100, 
    	help_text=u'Enter a name for the service')
    description = forms.CharField(max_length=200,
    	help_text=u'Enter a description',
    	widget=forms.Textarea)
    command = forms.CharField(max_length=200,
    	help_text=u'Enter a command you would type to run it')
    file = forms.FileField()


class DivErrorList(ErrorList):
    def __unicode__(self):
        return self.as_divs()

    def as_divs(self):
        if not self:
            return u''
        return u'<div class="control-group error">%s</div>' % ''.join([u'<div class="error">%s</div>' % e for e in self])

class ServiceStartForm(forms.Form):
    serviceList = service.models.Service.objects.all()
    print serviceList.count()
    b = {}
    for aService in serviceList:
        b[aService.id] = aService.name
    c = b.items()
    print "Within the form, ", serviceList.count()
    serviceChoice = forms.ChoiceField(choices=c, widget=forms.Select())
    input_directory = forms.CharField(max_length=200)
    output_directory = forms.CharField(max_length=200)<commit_msg>For generation of Dynamic forms<commit_after>from django import forms
import service.models
from django.forms.util import ErrorList


class ServiceForm(forms.Form):
    name = forms.CharField(max_length=100,
                           help_text=u'Enter a name for the service')
    description = forms.CharField(max_length=200,
                                  help_text=u'Enter a description',
                                  widget=forms.Textarea)
    command = forms.CharField(max_length=200,
                              help_text=u'Enter a command you would type to run it')
    file = forms.FileField()


class DivErrorList(ErrorList):
    def __unicode__(self):
        return self.as_divs()

    def as_divs(self):
        if not self:
            return u''
        return u'<div class="control-group error">%s</div>' % ''.join([u'<div class="error">%s</div>' % e for e in self])


class ServiceStartForm(forms.Form):
    serviceList = service.models.Service.objects.all()
    print serviceList.count()
    b = {}
    for aService in serviceList:
        b[aService.id] = aService.name
    c = b.items()
    print "Within the form, ", serviceList.count()
    serviceChoice = forms.ChoiceField(choices=c, widget=forms.Select())
    input_directory = forms.CharField(max_length=200)
    output_directory = forms.CharField(max_length=200)

    def __init__(self, *args, **kwargs):
        super(ServiceStartForm, self).__init__(*args, **kwargs)
        serviceList = service.models.Service.objects.all()
        b = {}
        for aService in serviceList:
            b[aService.id] = aService.name
        c = b.items()
        self.fields["serviceChoice"].choices = c
{'fraction_non_alphanumeric': 0.11535812672176309, 'fraction_numerical': 0.010330578512396695, 'mean_word_length': 2.9416553595658073, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7102469', 'n_tokens_mistral': 900, 'n_tokens_neox': 862, 'n_words': 203}