Пример #1
0
 def validate_addons(self, value):
     if not self.instance:
         for addon_data in value:
             ItemAddOn.clean_categories(self.context['event'], None, self.instance, addon_data['addon_category'])
             ItemAddOn.clean_min_count(addon_data['min_count'])
             ItemAddOn.clean_max_count(addon_data['max_count'])
             ItemAddOn.clean_max_min_count(addon_data['max_count'], addon_data['min_count'])
     return value
Пример #2
0
 def validate_addons(self, value):
     if not self.instance:
         for addon_data in value:
             ItemAddOn.clean_categories(self.context['event'], None, self.instance, addon_data['addon_category'])
             ItemAddOn.clean_min_count(addon_data['min_count'])
             ItemAddOn.clean_max_count(addon_data['max_count'])
             ItemAddOn.clean_max_min_count(addon_data['max_count'], addon_data['min_count'])
     return value
Пример #3
0
 def validate_addons(self, value):
     if self.instance is not None:
         raise ValidationError(
             _('Updating add-ons via PATCH/PUT is not supported. Please use the dedicated'
               ' nested endpoint.'))
     else:
         for addon_data in value:
             ItemAddOn.clean_categories(self.context['event'], None,
                                        self.instance,
                                        addon_data['addon_category'])
             ItemAddOn.clean_min_count(addon_data['min_count'])
             ItemAddOn.clean_max_count(addon_data['max_count'])
             ItemAddOn.clean_max_min_count(addon_data['max_count'],
                                           addon_data['min_count'])
     return value
Пример #4
0
 def validate_max_count(self, value):
     ItemAddOn.clean_max_count(value)
     return value
Пример #5
0
 def validate_max_count(self, value):
     ItemAddOn.clean_max_count(value)
     return value