Exemplo n.º 1
0
 class Meta:
     model = UserAddress
     fields = overridable('OSCARAPI_USERADDRESS_FIELDS', (
         'id', 'title', 'first_name', 'last_name', 'line1', 'line2',
         'line3', 'line4', 'state', 'postcode', 'search_text',
         'phone_number', 'notes', 'is_default_for_shipping',
         'is_default_for_billing', 'country', 'url'))
Exemplo n.º 2
0
 class Meta:
     model = ProductAttributeValue
     list_serializer_class = ProductAttributeValueListSerializer
     fields = overridable(
         "OSCARAPI_PRODUCT_ATTRIBUTE_VALUE_FIELDS",
         default=("name", "value", "code", "product"),
     )
Exemplo n.º 3
0
 class Meta:
     model = Order
     fields = overridable(
         "OSCARAPI_ORDER_FIELDS",
         default=(
             "number",
             "basket",
             "url",
             "lines",
             "owner",
             "billing_address",
             "currency",
             "total_incl_tax",
             "total_excl_tax",
             "shipping_incl_tax",
             "shipping_excl_tax",
             "shipping_address",
             "shipping_method",
             "shipping_code",
             "status",
             "guest_email",
             "date_placed",
             "payment_url",
             "offer_discounts",
             "voucher_discounts",
         ),
     )
Exemplo n.º 4
0
 class Meta:
     model = OrderLine
     fields = overridable('OSCAR_ORDERLINE_FIELD', default=[
         'attributes', 'url', 'product', 'stockrecord', 'quantity',
         'price_currency', 'price_excl_tax', 'price_incl_tax',
         'price_incl_tax_excl_discounts', 'price_excl_tax_excl_discounts',
         'order'])
Exemplo n.º 5
0
 class Meta(BaseProductSerializer.Meta):
     fields = overridable(
         'OSCARAPI_PRODUCTDETAIL_FIELDS',
         default=('url', 'upc', 'id', 'title', 'description', 'structure',
                  'date_created', 'date_updated', 'recommended_products',
                  'attributes', 'categories', 'product_class',
                  'stockrecords', 'images', 'price', 'availability',
                  'options', 'children'))
Exemplo n.º 6
0
 class Meta:
     model = Basket
     fields = overridable('OSCARAPI_BASKET_FIELDS', default=(
         'id', 'owner', 'status', 'lines',
         'url', 'total_excl_tax',
         'total_excl_tax_excl_discounts', 'total_incl_tax',
         'total_incl_tax_excl_discounts', 'total_tax', 'currency',
         'voucher_discounts', 'offer_discounts', 'is_tax_known'))
Exemplo n.º 7
0
 class Meta:
     model = User
     fields = overridable('OSCARAPI_USER_FIELDS',
                          default=(
                              User.USERNAME_FIELD,
                              'id',
                              'date_joined',
                          ))
Exemplo n.º 8
0
 class Meta:
     model = Line
     fields = overridable('OSCARAPI_BASKETLINE_FIELDS', default=(
         'url', 'product', 'quantity', 'attributes', 'price_currency',
         'price_excl_tax', 'price_incl_tax',
         'price_incl_tax_excl_discounts', 'price_excl_tax_excl_discounts',
         'is_tax_known', 'warning', 'basket', 'stockrecord', 'date_created'
     ))
Exemplo n.º 9
0
 class Meta:
     model = Order
     fields = overridable('OSCARAPI_ORDER_FIELD', default=(
         'number', 'basket', 'url', 'lines',
         'owner', 'billing_address', 'currency', 'total_incl_tax',
         'total_excl_tax', 'shipping_incl_tax', 'shipping_excl_tax',
         'shipping_address', 'shipping_method', 'shipping_code', 'status',
         'guest_email', 'date_placed', 'payment_url', 'offer_discounts',
         'voucher_discounts')
     )
Exemplo n.º 10
0
    def validate(self, attrs):
        user = authenticate(
            username=attrs['username'], password=attrs['password'])
        if user is None:
            raise serializers.ValidationError('invalid login')
        elif not user.is_active:
            raise serializers.ValidationError(
                'Can not log in as inactive user')
        elif user.is_staff and overridable(
                'OSCARAPI_BLOCK_ADMIN_API_ACCESS', True):
            raise serializers.ValidationError(
                'Staff users can not log in via the rest api')

        # set instance to the user so we can use this in the view
        self.instance = user
        return attrs
Exemplo n.º 11
0
 class Meta:
     model = OrderLine
     fields = overridable(
         "OSCARAPI_ORDERLINE_FIELDS",
         default=(
             "attributes",
             "url",
             "product",
             "stockrecord",
             "quantity",
             "price_currency",
             "price_excl_tax",
             "price_incl_tax",
             "price_incl_tax_excl_discounts",
             "price_excl_tax_excl_discounts",
             "order",
         ),
     )
Exemplo n.º 12
0
 class Meta:
     model = Line
     fields = overridable(
         "OSCARAPI_BASKETLINE_FIELDS",
         default=(
             "url",
             "product",
             "quantity",
             "attributes",
             "price_currency",
             "price_excl_tax",
             "price_incl_tax",
             "price_incl_tax_excl_discounts",
             "price_excl_tax_excl_discounts",
             "is_tax_known",
             "warning",
             "basket",
             "stockrecord",
             "date_created",
         ),
     )
Exemplo n.º 13
0
 class Meta:
     model = Basket
     fields = overridable(
         "OSCARAPI_BASKET_FIELDS",
         default=(
             "id",
             "owner",
             "status",
             "lines",
             "url",
             "total_excl_tax",
             "total_excl_tax_excl_discounts",
             "total_incl_tax",
             "total_incl_tax_excl_discounts",
             "total_tax",
             "currency",
             "voucher_discounts",
             "offer_discounts",
             "is_tax_known",
         ),
     )
Exemplo n.º 14
0
 class Meta(BaseProductSerializer.Meta):
     fields = overridable(
         'OSCARAPI_CHILDPRODUCTDETAIL_FIELDS',
         default=(
             'url',
             'upc',
             'id',
             'title',
             'structure',
             # 'parent', 'description', 'images', are not included by default, but
             # easily enabled by overriding OSCARAPI_CHILDPRODUCTDETAIL_FIELDS
             # in your settings file
             'date_created',
             'date_updated',
             'recommended_products',
             'attributes',
             'categories',
             'product_class',
             'stockrecords',
             'price',
             'availability',
             'options'))
Exemplo n.º 15
0
 class Meta(PublicProductSerializer.Meta):
     fields = overridable(
         "OSCARAPI_PRODUCTDETAIL_FIELDS",
         default=(
             "url",
             "upc",
             "id",
             "title",
             "description",
             "structure",
             "date_created",
             "date_updated",
             "recommended_products",
             "attributes",
             "categories",
             "product_class",
             "images",
             "price",
             "availability",
             "options",
             "children",
         ),
     )
Exemplo n.º 16
0
 class Meta(PublicProductSerializer.Meta):
     fields = overridable(
         "OSCARAPI_CHILDPRODUCTDETAIL_FIELDS",
         default=(
             "url",
             "upc",
             "id",
             "title",
             "structure",
             # 'parent', 'description', 'images', are not included by default, but
             # easily enabled by overriding OSCARAPI_CHILDPRODUCTDETAIL_FIELDS
             # in your settings file
             "date_created",
             "date_updated",
             "recommended_products",
             "attributes",
             "categories",
             "product_class",
             "price",
             "availability",
             "options",
         ),
     )
Exemplo n.º 17
0
 class Meta:
     model = UserAddress
     fields = overridable(
         "OSCARAPI_USERADDRESS_FIELDS",
         default=(
             "id",
             "title",
             "first_name",
             "last_name",
             "line1",
             "line2",
             "line3",
             "line4",
             "state",
             "postcode",
             "search_text",
             "phone_number",
             "notes",
             "is_default_for_shipping",
             "is_default_for_billing",
             "country",
             "url",
         ),
     )
Exemplo n.º 18
0
 class Meta:
     model = Product
     fields = overridable("OSCARAPI_RECOMMENDED_PRODUCT_FIELDS",
                          default=("url", ))
Exemplo n.º 19
0
 class Meta(BaseProductSerializer.Meta):
     fields = overridable('OSCARAPI_PRODUCT_FIELDS',
                          default=('url', 'id', 'upc', 'title'))
Exemplo n.º 20
0
 class Meta:
     model = Option
     fields = overridable("OSCARAPI_OPTION_FIELDS", default="__all__")
     list_serializer_class = UpdateForwardManyToManySerializer
Exemplo n.º 21
0
 class Meta:
     model = ProductAttributeValue
     fields = overridable('OSCARAPI_PRODUCT_ATTRIBUTE_VALUE_FIELDS',
                          default=('name', 'value', 'code'))
Exemplo n.º 22
0
 class Meta:
     model = Voucher
     fields = overridable(
         "OSCARAPI_VOUCHER_FIELDS",
         default=("name", "code", "start_datetime", "end_datetime"),
     )
Exemplo n.º 23
0
 class Meta:
     model = Voucher
     fields = overridable('OSCARAPI_VOUCHER_FIELDS', default=(
         'name', 'code', 'start_datetime', 'end_datetime'
     ))
Exemplo n.º 24
0
 class Meta:
     model = Option
     fields = overridable('OSCARAPI_OPTION_FIELDS',
                          default=('url', 'id', 'name', 'code', 'type'))
Exemplo n.º 25
0
 class Meta:
     model = Product
     fields = overridable('OSCARAPI_RECOMMENDED_PRODUCT_FIELDS',
                          default=('url', ))
Exemplo n.º 26
0
 class Meta(PublicProductSerializer.Meta):
     fields = overridable("OSCARAPI_PRODUCT_FIELDS",
                          default=("url", "id", "upc", "title"))
Exemplo n.º 27
0
 def get_initial_order_status(self, basket):
     return overridable('OSCARAPI_INITIAL_ORDER_STATUS', default='new')
Exemplo n.º 28
0
 class Meta:
     model = ProductAttribute
     fields = overridable('OSCARAPI_PRODUCT_ATTRIBUTE_FIELDS',
                          default=('name', 'productattributevalue_set'))
Exemplo n.º 29
0
 class Meta:
     model = User
     fields = overridable(
         "OSCARAPI_USER_FIELDS",
         default=(User.USERNAME_FIELD, "email", "date_joined"),
     )
Exemplo n.º 30
0
 class Meta:
     model = Surcharge
     fields = overridable(
         "OSCARAPI_SURCHARGE_FIELDS",
         default=("name", "code", "incl_tax", "excl_tax"),
     )