@login_required
@require_http_methods(['GET', 'POST'])
def edit_watch_list(request):
 watches = Watch.objects.filter(user=request.user).order_by('content_type')
 watch_list = []
 for w in watches:
  if (w.content_object is not None):
   if (w.content_type.name == 'question'):
    if (not w.content_object.is_archived):
     watch_list.append(w)
   else:
    watch_list.append(w)
 if (request.method == 'POST'):
  for w in watch_list:
   w.is_active = (('watch_%s' % w.id) in request.POST)
   w.save()
 return render(request, 'users/edit_watches.html', {'watch_list': watch_list})

@ login_required @ require_http_methods ( [ 'GET' , 'POST' ] ) def edit_watch_list ( request ) : watches = Watch . objects . filter ( user = request . user ) . order_by ( 'content_type' ) watch_list = [ ] for w in watches : if ( w . content_object is not None ) : if ( w . content_type . name == 'question' ) : if ( not w . content_object . is_archived ) : watch_list . append ( w ) else : watch_list . append ( w ) if ( request . method == 'POST' ) : for w in watch_list : w . is_active = ( ( 'watch_%s' % w . id ) in request . POST ) w . save ( ) return render ( request , 'users/edit_watches.html' , { 'watch_list' : watch_list } )
edit watch list .