def add_like(obj, user):
 obj_type = apps.get_model('contenttypes', 'ContentType').objects.get_for_model(obj)
 with atomic():
  (like, created) = Like.objects.get_or_create(content_type=obj_type, object_id=obj.id, user=user)
  if (like.project is not None):
   like.project.refresh_totals()
 return like

def add_like ( obj , user ) : obj_type = apps . get_model ( 'contenttypes' , 'ContentType' ) . objects . get_for_model ( obj ) with atomic ( ) : ( like , created ) = Like . objects . get_or_create ( content_type = obj_type , object_id = obj . id , user = user ) if ( like . project is not None ) : like . project . refresh_totals ( ) return like
add a like to an object .