def has_object_permission(self, request, view, obj):
    if (request.method in SAFE_METHODS):
        return True
    if request.user.is_authenticated():
        if hasattr(obj, 'user'):
            return (request.user == obj.user)
        else:
            artist = Artists.objects.get(user=request.user)
            return (artist == obj.artist)
def has_object_permission(self, request, view, obj):
    if (request.method in SAFE_METHODS):
        return True
    if request.user.is_authenticated():
        if hasattr(obj, 'user'):
            return (request.user == obj.user)
        else:
            artist = Artists.objects.get(user=request.user)
            return (artist == obj.artist)