shoop.core.utils package¶
Submodules¶
shoop.core.utils.form_mixins module¶
-
class
shoop.core.utils.form_mixins.
ProtectedFieldsMixin
(**kwargs)[source]¶ Bases:
object
-
change_protect_field_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
clean_protected_fields
(cleaned_data)[source]¶ Ignore protected fields (they are set to
disabled
, so they will not be in the form data).As a side effect, this removes the fields from
changed_data
too.Parameters: cleaned_data (dict) – Cleaned data Returns: Cleaned data without protected field data Return type: dict
-
shoop.core.utils.maintenance module¶
shoop.core.utils.model_caching_descriptor module¶
shoop.core.utils.name_mixin module¶
shoop.core.utils.product_caching_object module¶
shoop.core.utils.query module¶
shoop.core.utils.slugs module¶
shoop.core.utils.tax_numbers module¶
-
shoop.core.utils.tax_numbers.
validate
(tax_number)[source]¶ Validate a tax number.
Parameters: tax_number (str) – Tax number to validate Returns: Type identifier of the tax number, if detected. Possible values for now are either “vat” or “unknown”. Return type: str Raise: ValidationError
if tax number type was detected, but it is somehow malformed.
shoop.core.utils.users module¶
shoop.core.utils.vat module¶
-
exception
shoop.core.utils.vat.
VatValidationError
(*args, **kwargs)[source]¶ Bases:
django.core.exceptions.ValidationError
-
code
= None¶
-
-
exception
shoop.core.utils.vat.
VatCannotIdentifyValidationError
(*args, **kwargs)[source]¶ Bases:
shoop.core.utils.vat.VatValidationError
-
code
= 'vat_cannot_identify'¶
-
-
exception
shoop.core.utils.vat.
VatInvalidValidationError
(*args, **kwargs)[source]¶ Bases:
shoop.core.utils.vat.VatValidationError
-
code
= 'vat_invalid'¶
-
-
shoop.core.utils.vat.
verify_vat
(vat_id, default_prefix='')[source]¶ Verify an EU VAT ID.
Returns a tuple (prefix, code_parts) – if both are truthy, the validation succeeded. If the prefix part is falsy, then the prefix was unknown and no validation was even attempted. If the prefix part is truthy, then it will contain the country prefix used for validation. The code_parts part can still be falsy, if the validation for the country’s VAT number pattern failed.
Parameters: Returns: Tuple of (prefix, code_parts)