모델 데이터 중 일부를 사용하여 목록을 만들지 만 올바르게 수행하지는 않습니다. 작동하지만 broswer에서 페이지를 새로 고침 할 때 reportResults가 추가됩니다. 요청간에 가비지 수집을 원했지만 분명히 나, 어떤 아이디어가 잘못 되었습니까?보기간에 django 목록이 삭제되지 않음
감사합니다, 이완
reportResults = [] #the list that doesn't get collected
def addReportResult(fix,description):
fix.description = description
reportResults.append(fix)
def unitHistory(request,unitid, syear, smonth, sday, shour, fyear, fmonth, fday, fhour, type=None):
waypoints = Fixes.objects.filter(name=(unitid))
waypoints = waypoints.filter(gpstime__range=(awareStartTime, awareEndTime)).order_by('gpstime')[:1000]
if waypoints:
for index in range(len(waypoints)):
...do stuff here selecting some waypoints and generating "description" text
addReportResult(waypointsindex,description) ##append the list with this, adding a text description
return render_to_response('unitHistory.html', {'fixes': reportResults})
나는 mod_wsgi을 사용한다고 가정하지만, 대부분의 웹 서버는 이런 식으로 행동하는 것을 알고있다. –
고맙습니다. 잘했습니다. 그리고 설명도 감사합니다. 관심사에서 나는 보통 camelCase를 선호한다, 거기 snake_case 또는 개인적인 특혜 사용에 이점? – user1333095