def clean_price(self): price_value = self.cleaned_data.get('price') premium_type = self.cleaned_data.get('premium_type') if ((premium_type in amo.ADDON_PREMIUMS or premium_type == amo.ADDON_FREE_INAPP) and not price_value and not self.is_toggling()): raise_required() if not price_value and self.fields['price'].required is False: return None # Special case for a free app - in-app payments must be enabled. # Note: this isn't enforced for tier zero apps. if price_value == 'free': if self.cleaned_data.get('allow_inapp') != 'True': raise ValidationError(_('If app is Free, ' 'in-app payments must be enabled')) return price_value try: price = Price.objects.get(pk=price_value, active=True) except (ValueError, Price.DoesNotExist): raise ValidationError(_('Not a valid choice')) return price
def clean_price(self): if (self.cleaned_data.get('premium_type') in amo.ADDON_PREMIUMS and not self.cleaned_data['price']): raise_required() return self.cleaned_data['price']
def clean_support_email(self): # Note: this can't be FREES, because Free + Premium should have # a support email. if (not self.cleaned_data.get('premium_type') == amo.ADDON_FREE and not self.cleaned_data['support_email']): raise_required() return self.cleaned_data['support_email']
def clean_comment(self): # Comment field needed for duplicate, flag, moreinfo, and other reject # reason. action = self.cleaned_data.get('action') reject_reason = self.cleaned_data.get('reject_reason') comment = self.cleaned_data.get('comment') if (not comment and (action == rvw.ACTION_FLAG or action == rvw.ACTION_MOREINFO or (action == rvw.ACTION_REJECT and reject_reason == 0))): raise_required() return comment
def clean_price(self): price_id = self.cleaned_data['price'] if (self.cleaned_data.get('premium_type') in amo.ADDON_PREMIUMS and not price_id and not self.is_toggling()): raise_required() if not price_id and self.fields['price'].required is False: return None try: price = Price.objects.get(pk=price_id, active=True) except (ValueError, Price.DoesNotExist): raise ValidationError( self.fields['price'].error_messages['invalid_choice']) if (price and price.price == Decimal('0.00') and self.cleaned_data.get('allow_inapp') != 'True'): raise ValidationError(_('If app is Free, ' 'in-app payments must be enabled')) return price
def clean_body(self): body = self.cleaned_data.get('body', '') # Whitespace is not a review! if not body.strip(): raise_required() return body
def clean_price(self): if self.cleaned_data.get("premium_type") in amo.ADDON_PREMIUMS and not self.cleaned_data["price"]: raise_required() return self.cleaned_data["price"]
def clean_max_ver(self): if self.cleaned_data['enabled'] and not self.cleaned_data['max_ver']: raise_required() return self.cleaned_data['max_ver']
def clean_free(self): if self.cleaned_data["do_upsell"] and not self.cleaned_data["free"]: raise_required() return self.cleaned_data["free"]
def clean_max_ver(self): if self.cleaned_data["enabled"] and not self.cleaned_data["max_ver"]: raise_required() return self.cleaned_data["max_ver"]
def clean_free(self): if self.cleaned_data['do_upsell'] and not self.cleaned_data['free']: raise_required() return self.cleaned_data['free']
def clean_text(self): if self.cleaned_data['do_upsell'] and not self.cleaned_data['text']: raise_required() return self.cleaned_data['text']
def clean_text(self): if (self.cleaned_data['do_upsell'] and not self.cleaned_data['text']): raise_required() return self.cleaned_data['text']
def clean_free(self): if (self.cleaned_data['do_upsell'] and not self.cleaned_data['free']): raise_required() return self.cleaned_data['free']
def clean_reject_reason(self): reject_reason = self.cleaned_data.get("reject_reason", None) if self.cleaned_data.get("action") == rvw.ACTION_REJECT and reject_reason is None: raise_required() return reject_reason
def clean_reject_reason(self): reject_reason = self.cleaned_data.get('reject_reason', None) if (self.cleaned_data.get('action') == rvw.ACTION_REJECT and reject_reason is None): raise_required() return reject_reason
def clean_text(self): if self.cleaned_data["do_upsell"] and not self.cleaned_data["text"]: raise_required() return self.cleaned_data["text"]