mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2025-06-29 08:35:44 +08:00
Clean up docker-compose and run Black formatter over entire codebase
This commit is contained in:
parent
6c232b3e89
commit
069aba80b1
60 changed files with 1946 additions and 1485 deletions
|
@ -7,38 +7,46 @@ class SimpleStripePriceSerializer(serializers.ModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = StripePrice
|
||||
fields = ['price', 'currency', 'prorated']
|
||||
fields = ["price", "currency", "prorated"]
|
||||
|
||||
|
||||
class SubscriptionPlanSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = SubscriptionPlan
|
||||
fields = ['id', 'name', 'description',
|
||||
'annual_price', 'monthly_price', 'group_exclusive']
|
||||
fields = [
|
||||
"id",
|
||||
"name",
|
||||
"description",
|
||||
"annual_price",
|
||||
"monthly_price",
|
||||
"group_exclusive",
|
||||
]
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
representation['annual_price'] = SimpleStripePriceSerializer(
|
||||
instance.annual_price, many=False).data
|
||||
representation['monthly_price'] = SimpleStripePriceSerializer(
|
||||
instance.monthly_price, many=False).data
|
||||
representation["annual_price"] = SimpleStripePriceSerializer(
|
||||
instance.annual_price, many=False
|
||||
).data
|
||||
representation["monthly_price"] = SimpleStripePriceSerializer(
|
||||
instance.monthly_price, many=False
|
||||
).data
|
||||
return representation
|
||||
|
||||
|
||||
class UserSubscriptionSerializer(serializers.ModelSerializer):
|
||||
date = serializers.DateTimeField(
|
||||
format="%m-%d-%Y %I:%M %p", read_only=True)
|
||||
date = serializers.DateTimeField(format="%m-%d-%Y %I:%M %p", read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = UserSubscription
|
||||
fields = ['id', 'user', 'user_group', 'subscription',
|
||||
'date', 'valid', 'annual']
|
||||
fields = ["id", "user", "user_group", "subscription", "date", "valid", "annual"]
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
representation['user'] = SimpleCustomUserSerializer(
|
||||
instance.user, many=False).data
|
||||
representation['subscription'] = SubscriptionPlanSerializer(
|
||||
instance.subscription, many=False).data
|
||||
representation["user"] = SimpleCustomUserSerializer(
|
||||
instance.user, many=False
|
||||
).data
|
||||
representation["subscription"] = SubscriptionPlanSerializer(
|
||||
instance.subscription, many=False
|
||||
).data
|
||||
return representation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue