simplify edit blocs form
This commit is contained in:
@@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user