1๐
โ
As suggested by @ExperimentsWithCode, I had to deliver s string of html with json. And I had to get the field id in the view and insert it into the url as follows:
def createtimesheet(request):
print "create timesheet view"
if request.method == "POST":
#Get all the data and do stuff
# now we can create the timesheet!
peach = TimeSheet(start_date=start_date_formatted, end_date=end_date_formatted, person_id=person)
peach.save()
#json response data for the link
response_data['linkstart'] = "<a href='/tande/"+str(peach.id)+"/person/timesheet/' class='class2'>"
response_data['linkend'] = "</a class='class2'>"
#other response data
return JsonResponse(response_data)
So I create the link in the view. Then I alter the html append as follows:
var html = '<tr><td>'+json.linkstart+json.startdate+json.linkend+'</td><td>'+json.enddate+'</td><td>'+json.status+'</td><</tr></br><p>'+json.error+'</p></br>';
๐คRuth Young
Source:stackexchange.com