@tx.atomic
def remove_vote(obj, user):
 obj_type = apps.get_model('contenttypes', 'ContentType').objects.get_for_model(obj)
 with advisory_lock('vote-{}-{}'.format(obj_type.id, obj.id)):
  qs = Vote.objects.filter(content_type=obj_type, object_id=obj.id, user=user)
  if (not qs.exists()):
   return
 qs.delete()
 (votes, _) = Votes.objects.get_or_create(content_type=obj_type, object_id=obj.id)
 votes.count = (F('count') - 1)
 votes.save()

@ tx . atomic def remove_vote ( obj , user ) : obj_type = apps . get_model ( 'contenttypes' , 'ContentType' ) . objects . get_for_model ( obj ) with advisory_lock ( 'vote-{}-{}' . format ( obj_type . id , obj . id ) ) : qs = Vote . objects . filter ( content_type = obj_type , object_id = obj . id , user = user ) if ( not qs . exists ( ) ) : return qs . delete ( ) ( votes , _ ) = Votes . objects . get_or_create ( content_type = obj_type , object_id = obj . id ) votes . count = ( F ( 'count' ) - 1 ) votes . save ( )
remove an user vote from an object .