Esempio n. 1
0
    def validate_supplement_uuid(self, value):
        user = self.context["request"].user
        try:
            validate_model_uuid(uuid=value, model=Supplement, user=user)
        except ValidationError:
            # if it's an edit, don't allow someone to edit a log to a stack
            if self.instance:
                raise

            # we allow for supplement_stack_uuid to also be passed in here, a bit of a hack
            validate_model_uuid(uuid=value, model=SupplementStack, user=user)

        return value
Esempio n. 2
0
 def validate_supplement_uuid(self, value):
     user = self.context["request"].user
     validate_model_uuid(Supplement, uuid=value, user=user)
     return value
 def validate_stack_uuid(self, value):
     user = self.context["request"].user
     validate_model_uuid(uuid=value, model=SupplementStack, user=user)
     return value
Esempio n. 4
0
 def validate_measurement_uuid(self, value):
     validate_model_uuid(Measurement, uuid=value)
     return value
Esempio n. 5
0
 def validate_ingredient_uuid(self, value):
     user = self.context["request"].user
     validate_model_uuid(Ingredient, uuid=value, user=user)
     return value
 def validate_measurement_uuid(self, value):
     validate_model_uuid(uuid=value, model=Measurement)
     return value