@@ -19,14 +19,17 @@ def saveFile(file,project_name):
1919
2020class ProjectsForm (forms .ModelForm ):
2121 working_dir = forms .CharField (label = "Working Directory" ,widget = forms .TextInput (attrs = {'class' :'form-control' ,'size' :30 }))
22- repo_type = forms .ChoiceField (choices = repo_type ,label = "Repo Type" )
23- update_style = forms .ChoiceField (choices = update_style ,label = "Update Style" )
22+ repo_type = forms .ChoiceField (choices = repo_type ,label = "Repo Type" , widget = forms . Select ( attrs = { "class" : "form-control" }) )
23+ update_style = forms .ChoiceField (choices = update_style ,label = "Update Style" , widget = forms . Select ( attrs = { "class" : "form-control" }) )
2424 cfile = forms .FileField (label = "Config File" )
2525 name = forms .CharField (label = 'Project Name' ,widget = forms .TextInput (attrs = {'class' :'form-control' ,'size' :30 }))
2626 repo_link = forms .CharField (label = 'Repo Link' ,widget = forms .TextInput (attrs = {'class' :'form-control' ,'size' :30 }))
2727 repo = forms .CharField (label = 'Repo' ,widget = forms .TextInput (attrs = {'class' :'form-control' ,'size' :30 }))
2828 deployment_link = forms .CharField (label = 'Deployment Link' ,widget = forms .TextInput (attrs = {'class' :'form-control' ,'size' :30 }))
29- emailUsers = forms .CharField (label = 'Users emails' ,help_text = "comma seprated list of emails of users to notify when new version deployed" ,widget = forms .TextInput (attrs = {'class' :'form-control' ,'size' :30 }))
29+ emailUsers = forms .CharField (required = False ,label = 'Users emails' ,help_text = "comma seprated list of emails of users to notify when new version deployed" ,widget = forms .TextInput (attrs = {'class' :'form-control' ,'size' :30 }))
30+ default_server = forms .ModelChoiceField (queryset = models .Server .objects .all (),empty_label = "Select" ,widget = forms .Select (attrs = {"class" :"form-control" }),label = "Default Server" )
31+ sshKey = forms .ModelChoiceField (queryset = models .SSHKey .objects .all (), empty_label = "Select" ,label = "SSH Key" ,widget = forms .Select (attrs = {"class" : "form-control" }))
32+ default_branch = forms .CharField (label = 'Default Branch' , widget = forms .TextInput (attrs = {'class' : 'form-control' , 'size' : 30 }))
3033
3134 def __init__ (self , * args , ** kwargs ):
3235 super (ProjectsForm , self ).__init__ (* args , ** kwargs )
@@ -45,6 +48,7 @@ def save(self,files,name):
4548 P .default_server = self .cleaned_data ["default_server" ]
4649 P .update_style = self .cleaned_data ["update_style" ]
4750 P .emailUsers = self .cleaned_data ["emailUsers" ]
51+ P .default_branch = self .cleaned_data ["default_branch" ]
4852
4953 print "Files is " ,files
5054 f = files .get ('cfile' ,'' )
@@ -53,7 +57,7 @@ def save(self,files,name):
5357 P .save ()
5458 class Meta :
5559 model = models .Project
56- fields = ("name" ,"repo" ,"repo_link" ,"working_dir" ,"update_style" ,"default_server" ,"repo_type" ,"sshKey" ,"deployment_link" ,"cfile" ,"emailUsers" )
60+ fields = ("name" ,"repo" ,"repo_link" ,"working_dir" ,"update_style" ,"default_branch" , " default_server" ,"repo_type" ,"sshKey" ,"deployment_link" ,"cfile" ,"emailUsers" )
5761
5862class ServerForm (forms .ModelForm ):
5963 ip = forms .CharField (widget = forms .TextInput (attrs = {'class' :'form-control' ,'size' :30 }),label = "Hostname/IP" )
@@ -81,6 +85,6 @@ class Meta:
8185 fields = ('name' ,'key' )
8286
8387class CloneForm (forms .Form ):
84- server = forms .ModelChoiceField (queryset = models .Server .objects .all (),label = "Server" ,required = True )
88+ server = forms .ModelChoiceField (queryset = models .Server .objects .all (),label = "Server" ,required = True , widget = forms . Select ( attrs = { "class" : "form-control" }) )
8589
8690
0 commit comments