The address app provides core address models - it doesn’t provide any views or other functionality. Of the 5 abstract models, only 2 have a non-abstract version in oscar.apps.address.models - the others are used by the order app to provide shipping and billing address models.
- class oscar.apps.address.abstract_models.AbstractAddress(*args, **kwargs)¶
Superclass address object
This is subclassed and extended to provide models for user, shipping and billing addresses.
Return the non-empty components of the address, but merging the title, first_name and last_name into a single line.
Validate postcode given the country
Returns a hash of the address summary
- join_fields(fields, separator=u', ')¶
Join a sequence of fields using the specified separator
For populating an address model using the matching fields from this one.
This is used to convert a user address to a shipping address as part of the checkout process.
Name (including title)
- search_text = None¶
A field only used for searching addresses - this contains all the relevant fields. This is effectively a poor man’s Solr text field.
Returns a single string summary of the address, separating fields using commas.
- class oscar.apps.address.abstract_models.AbstractCountry(*args, **kwargs)¶
International Organization for Standardization (ISO) 3166-1 Country list.
Shorthand for the ISO 3166 code
- class oscar.apps.address.abstract_models.AbstractPartnerAddress(*args, **kwargs)¶
A partner can have one or more addresses. This can be useful e.g. when determining US tax which depends on the origin of the shipment.
- class oscar.apps.address.abstract_models.AbstractShippingAddress(*args, **kwargs)¶
A shipping address.
A shipping address should not be edited once the order has been placed - it should be read-only after that.
Return the order linked to this shipping address
- class oscar.apps.address.abstract_models.AbstractUserAddress(*args, **kwargs)¶
A user’s address. A user can have many of these and together they form an ‘address book’ of sorts for the user.
We use a separate model for shipping and billing (even though there will be some data duplication) because we don’t want shipping/billing addresses changed or deleted once an order has been placed. By having a separate model, we allow users the ability to add/edit/delete from their address book without affecting orders already placed.
- hash = None¶
A hash is kept to try and avoid duplicate addresses being added to the address book.
- is_default_for_billing = None¶
Whether this address should be the default for billing.
- is_default_for_shipping = None¶
Whether this address is the default for shipping
- num_orders = None¶
We keep track of the number of times an address has been used as a shipping address so we can show the most popular ones first at the checkout.
- save(*args, **kwargs)¶
Save a hash of the address fields