@login_required
def unflag(request, slug, app_label, model, object_id, template_name='flagging/unflag_confirm.html', success_template_name='flagging/unflag_success.html'):
 flag_type = get_object_or_404(FlagType, slug=slug)
 content_type = ContentType.objects.get(app_label=app_label, model=model)
 model = content_type.model_class()
 obj = model.objects.get(pk=object_id)
 if (request.method == 'POST'):
  flag = Flag.objects.get(flag_type=flag_type, content_type=content_type, object_id=obj.pk, user=request.user)
  flag.delete()
  if request.is_ajax():
   response = {'success': 'Success'}
   return HttpResponse(json.dumps(response), mimetype='application/json')
  if request.GET.get('next', None):
   return HttpResponseRedirect(request.GET['next'])
  template_name = success_template_name
 return render_to_response(template_name, {'object': obj, 'next': request.GET.get('next', None), 'flag_type': flag_type}, context_instance=RequestContext(request))

@ login_required def unflag ( request , slug , app_label , model , object_id , template_name = 'flagging/unflag_confirm.html' , success_template_name = 'flagging/unflag_success.html' ) : flag_type = get_object_or_404 ( FlagType , slug = slug ) content_type = ContentType . objects . get ( app_label = app_label , model = model ) model = content_type . model_class ( ) obj = model . objects . get ( pk = object_id ) if ( request . method == 'POST' ) : flag = Flag . objects . get ( flag_type = flag_type , content_type = content_type , object_id = obj . pk , user = request . user ) flag . delete ( ) if request . is_ajax ( ) : response = { 'success' : 'Success' } return HttpResponse ( json . dumps ( response ) , mimetype = 'application/json' ) if request . GET . get ( 'next' , None ) : return HttpResponseRedirect ( request . GET [ 'next' ] ) template_name = success_template_name return render_to_response ( template_name , { 'object' : obj , 'next' : request . GET . get ( 'next' , None ) , 'flag_type' : flag_type } , context_instance = RequestContext ( request ) )
unflag an available flag types object .