Beispiel #1
0
 class Meta:
     model = UserAddress
     fields = overridable(
         'IZIAPI_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'))
Beispiel #2
0
 class Meta:
     model = Basket
     fields = overridable(
         'IZIAPI_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'))
Beispiel #3
0
 class Meta(BaseProductSerializer.Meta):
     fields = overridable(
         'IZIAPI_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'))
Beispiel #4
0
 class Meta:
     model = Line
     fields = overridable(
         'IZIAPI_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'))
Beispiel #5
0
 class Meta:
     model = OrderLine
     fields = overridable('IZI_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'
                          ])
Beispiel #6
0
 class Meta:
     model = Order
     fields = overridable('IZIAPI_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'))
Beispiel #7
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(
                'IZIAPI_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
Beispiel #8
0
 class Meta(BaseProductSerializer.Meta):
     fields = overridable(
         'IZIAPI_CHILDPRODUCTDETAIL_FIELDS',
         default=(
             'url',
             'upc',
             'id',
             'title',
             'structure',
             # 'parent', 'description', 'images', are not included by default, but
             # easily enabled by overriding IZIAPI_CHILDPRODUCTDETAIL_FIELDS
             # in your settings file
             'date_created',
             'date_updated',
             'recommended_products',
             'attributes',
             'categories',
             'product_class',
             'stockrecords',
             'price',
             'availability',
             'options'))
Beispiel #9
0
 def get_initial_order_status(self, basket):
     return overridable('IZIAPI_INITIAL_ORDER_STATUS', default='new')
Beispiel #10
0
 class Meta:
     model = Product
     fields = overridable('IZIAPI_RECOMMENDED_PRODUCT_FIELDS',
                          default=('url', ))
Beispiel #11
0
 class Meta:
     model = ProductAttribute
     fields = overridable('IZIAPI_PRODUCT_ATTRIBUTE_FIELDS',
                          default=('name', 'productattributevalue_set'))
Beispiel #12
0
 class Meta:
     model = ProductAttributeValue
     fields = overridable('IZIAPI_PRODUCT_ATTRIBUTE_VALUE_FIELDS',
                          default=('name', 'value', 'code'))
Beispiel #13
0
 class Meta:
     model = Option
     fields = overridable('IZIAPI_OPTION_FIELDS',
                          default=('url', 'id', 'name', 'code', 'type'))
Beispiel #14
0
 class Meta(BaseProductSerializer.Meta):
     fields = overridable('IZIAPI_PRODUCT_FIELDS',
                          default=('url', 'id', 'upc', 'title'))
Beispiel #15
0
 class Meta:
     model = Voucher
     fields = overridable('IZIAPI_VOUCHER_FIELDS',
                          default=('name', 'code', 'start_datetime',
                                   'end_datetime'))
Beispiel #16
0
 class Meta:
     model = User
     fields = overridable('IZIAPI_USER_FIELDS', (
         User.USERNAME_FIELD, 'id', 'date_joined',))