simplify edit blocs form
This commit is contained in:
@@ -8,20 +8,16 @@ from os import remove, path
|
||||
|
||||
class MyBlocs:
|
||||
|
||||
def new(blocName, blocType):
|
||||
mybloc = None
|
||||
if blocType in MyBlocs.listTypeBlocs():
|
||||
mybloc=dict()
|
||||
mybloc['name'] = str(blocName)
|
||||
mybloc['type'] = str(blocType)
|
||||
return mybloc
|
||||
|
||||
def makeForm(bloc):
|
||||
match bloc['type']:
|
||||
case 'presentation' :
|
||||
form = Accueil()
|
||||
case 'text' :
|
||||
form = Description()
|
||||
case 'external_link':
|
||||
form = Lien()
|
||||
case 'gallery':
|
||||
form = ImageForm()
|
||||
case 'contact':
|
||||
form = Contact()
|
||||
case _:
|
||||
form = None
|
||||
form = FormBloc()
|
||||
return form
|
||||
|
||||
def imgForm():
|
||||
@@ -29,3 +25,5 @@ class MyBlocs:
|
||||
|
||||
def newImgForm():
|
||||
return ImageUpload()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user