I am working on a custom project in web2py and I am facing one problems I can not edit submitted data anymore for some reason.
Controller
@auth.requires(auth.has_membership(group_id = 'admin') or auth.has_membership(group_id = 'project_manager')) def update():
# select project from table and save in variable projects
project_selected = db.projects(request.args(0, cast=int)) or redirect(URL('index'))
#db.post.projects_id.default = project_selected.id
# create form for projects table and initiate with selected project
form = SQLFORM(db.projects, project_selected)
# create form for activity table
form_activity = SQLFORM(db.activity)
if form_activity.process().accepted:
response.flash = T('Record Updated')
else:
response.flash = T('Please complete the form')
# select all activities for the selected project and save in variable
activities_project = db(db.activity.projects_id == project_selected.id).select(orderby=db.activity.id)
return dict(form=form, form_activity=form_activity, projects=project_selected, activities_project=activities_project)
strong text View
<br>
<div class="tab">
<button class="tablinks" onclick="tab(event, 'Overview')" id="defaultOpen">Overview</button>
<button class="tablinks" onclick="tab(event, 'Team')">Team</button>
<button class="tablinks" onclick="tab(event, 'Third Parties')">Third Parties</button>
<button class="tablinks" onclick="tab(event, 'Activity')">Activity</button>
<button class="tablinks" onclick="tab(event, 'Files')">Files</button>
</div>
{{=form.custom.begin}}
<div id="Overview" class="tabcontent">
<h3>General</h3>
<br>
<p>Project Name {{=form.custom.widget.project_name}}</p>
<p>Project Country {{=form.custom.widget.project_country}}</p>
<p>Equity Share{{=form.custom.widget.equity_share}}</p>
<p>Strategy Initiative{{=form.custom.widget.strategy_initiative}}</p>
<br>
<h3>Technical Data</h3>
<br>
<p>Project Technology {{=form.custom.widget.technology}}</p>
<p>Project Capacity {{=form.custom.widget.capacity_mw}}</p>
<!-- <p>Energy Generation (Zahl)tausender bereich</p> #Spaeter in DB anlegen
<p>Capex(Zahl)tausender bereich </p> -->
<!-- <p>Project Description</p> -->
<br>
<h3>Development</h3>
<br>
<p>Project Development Phase {{=form.custom.widget.project_devlopment_phase}}</p>
<p>Project Initiated {{=form.custom.widget.initiated}}</p>
<p>Project Expected COD {{=form.custom.widget.expected_cod}}</p>
<p>Project Status Description {{=form.custom.widget.status_description}}</p>
<p>Project Status {{=form.custom.widget.status}}</p>
</div>
<div id="Team" class="tabcontent">
<h3>Development</h3>
<p>BD Team{{=form.custom.widget.bd_team}}</p>
<p>BD Manager{{=form.custom.widget.bd_manager}}</p>
</div>
<div id="Third Parties" class="tabcontent">
<p>Off Taker Name,Land,Type ,E-Mail,Adresse,Plz{{=form.custom.widget.off_taker}}</p> DB erstellen seperat
<p>Partner=Name, Land, Type, E-Mail,Adresse,Plz</p> DB erstellen seperat
</div>
<div id="Activity" class="tabcontent">
{{if len(activities_project):}}
<h2>Activity </h2><br />
<p>
{{for activity in activities_project:}}
<p>{{=projects.project_name}} says <i>{{=activity.body}} Posted on {{=activity.created_on}} by {{=activity.created_by.first_name}}
{{=activity.created_by.last_name}}</i></p>
{{pass}}</p>
{{else:}}
<h2>No comments posted yet</h2>
{{pass}}
{{=form_activity}}
</div>
{{=form.custom.submit}}
{{=form.custom.end}}
<script>
function tab(evt, cityName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(cityName).style.display = "block";
evt.currentTarget.className += " active";
}
document.getElementById("defaultOpen").click();
</script>
I dont know what I am doing wrong to be honest it worked but now not anymore