Skip to content

Commit

Permalink
Merge pull request #168 from samitnuk/feature/serializers-consistency…
Browse files Browse the repository at this point in the history
…-improvements

Improve consistency in serializers
  • Loading branch information
Martijn Jacobs committed Jun 12, 2019
2 parents 53e1026 + adc08e4 commit 3136a65
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions oscarapi/serializers/checkout.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import warnings

from django.db import IntegrityError
from rest_framework.response import Response

from django.conf import settings
from django.urls import reverse, NoReverseMatch
Expand Down Expand Up @@ -141,11 +140,11 @@ class OrderLineSerializer(OscarHyperlinkedModelSerializer):

class Meta:
model = OrderLine
fields = overridable('OSCAR_ORDERLINE_FIELD', default=[
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'])
'order'))


class OrderOfferDiscountSerializer(OfferDiscountSerializer):
Expand Down Expand Up @@ -196,7 +195,7 @@ def get_payment_url(self, obj):

class Meta:
model = Order
fields = overridable('OSCARAPI_ORDER_FIELD', default=(
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',
Expand Down Expand Up @@ -363,7 +362,7 @@ def update(self, instance, validated_data):

class Meta:
model = UserAddress
fields = overridable('OSCARAPI_USERADDRESS_FIELDS', (
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',
Expand Down
2 changes: 1 addition & 1 deletion oscarapi/serializers/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def field_length(fieldname):
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = overridable('OSCARAPI_USER_FIELDS', (
fields = overridable('OSCARAPI_USER_FIELDS', default=(
User.USERNAME_FIELD, 'id', 'date_joined',))


Expand Down

0 comments on commit 3136a65

Please sign in to comment.