def clean(self, *args, **kwargs):
        """
        Check if rating can be inserted for parent node or parent layer
        """
        if not self.pk:
            node = self.node
            layer = Layer.objects.get(pk=node.layer_id)
            if layer.participation_settings.rating_allowed is not True:
                raise ValidationError("Rating not allowed for this layer")
            if node.participation_settings.rating_allowed is not True:
                raise ValidationError("Rating not allowed for this node")
def clean ( self , * args , ** kwargs ) : if not self . pk : node = self . node layer = Layer . objects . get ( pk = node . layer_id ) if layer . participation_settings . rating_allowed is not True : raise ValidationError ( "Rating not allowed for this layer" ) if node . participation_settings . rating_allowed is not True : raise ValidationError ( "Rating not allowed for this node" )
Check if rating can be inserted for parent node or parent layer