def delete(request, season_id): season = Season.get_by_id(int(season_id)) if season is None: raise Http404 season.delete() rebuild_seasons() return redirect('../..')
def update_all_students_for_season(request): logging.info("update_all_students_for_season") logging.info(request.POST) season_id = request.POST['season_id'] season = Season.get_by_id(int(season_id)) if season is None: raise Http404 logging.info("season %s" % season) cdbsync.plan_cdb_put(season) courses = Course.list_season(str(season.key())) logging.info("all courses get") for c in courses: logging.info("course %s "%c.key()) taskqueue.add(url='/task/update_all_students_for_course/', params={'course_id':c.key().id()}) return HttpResponse('ok')
def edit(request, season_id): season = Season.get_by_id(int(season_id)) if season is None: raise Http404 if request.method == 'POST': form = SeasonForm(request.POST, instance=season) if form.is_valid(): logging.info('edit season before %s'% season) form.save(commit=False) logging.info('edit season after %s'% season) season.save() cdbsync.plan_cdb_put(season) rebuild_seasons() return redirect('../..') else: form = SeasonForm(instance=season) return render_to_response('admin/seasons_edit.html', RequestContext(request, {'form':form}))