simplify edit blocs form

This commit is contained in:
2026-03-28 12:21:10 +01:00
parent cdf1d439f5
commit f5a0716085

View File

@@ -7,21 +7,17 @@ from os import remove, path
class MyBlocs: 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): def makeForm(bloc):
match bloc['type']: form = FormBloc()
case 'presentation' :
form = Accueil()
case 'text' :
form = Description()
case 'external_link':
form = Lien()
case 'gallery':
form = ImageForm()
case 'contact':
form = Contact()
case _:
form = None
return form return form
def imgForm(): def imgForm():
@@ -29,3 +25,5 @@ class MyBlocs:
def newImgForm(): def newImgForm():
return ImageUpload() return ImageUpload()