I am trying to make a website where I can create Activities where you can register yourself (to make an appointment). I already finished the system that creates them, but I'm trying to make a page where a visitor can fill in his/her name (using a list, as which is part of the activity information in the JSON file). I already made this code:
@app.route('/deelnemen/<act>', methods=['POST','GET'])
def AddPcp(act):
if request.method=='GET':
return render_template('Main/Deelname.html', Data=Actdata, act=act)
if request.method=='POST':
visitors = []
if request.form['visitor']:
visitors.append(request.form['visitor'])
Actdata.data[act]={
"visitors":visitors
}
Actdata.save()
return render_template("Main/Startpage.html", Data=Actdata)
Hereby Data=Actdata
(json file). The website already creates the list visitors=[]
while adding an activity. This code worked until I realised that the earlier created variables (for the activities, such as time and day) were removed and the list can't hold more than 2 Items. My list is called visitor, and I really want to keep the other data and make lists which can hold more than 2 items. I tried to fix it, but nothing helped.
[formatted by admin]