From bc939c46118c4bf6fee79e63a3f9d7130292e909 Mon Sep 17 00:00:00 2001 From: Anmol Date: Tue, 12 Apr 2022 01:09:33 +0530 Subject: [PATCH] added aadhar card number, renting modes & delivery options --- kex/booking/api/serializers.py | 3 +++ .../migrations/0003_booking_renting_mode.py | 18 ++++++++++++++++++ kex/booking/models.py | 6 ++++++ kex/equipment/api/serializers.py | 2 ++ .../0006_equipment_delivery_choice.py | 18 ++++++++++++++++++ kex/equipment/models.py | 5 +++++ kex/users/api/serializers.py | 2 ++ .../0006_user_aadhaar_card_number.py | 18 ++++++++++++++++++ kex/users/models.py | 4 ++++ 9 files changed, 76 insertions(+) create mode 100644 kex/booking/migrations/0003_booking_renting_mode.py create mode 100644 kex/equipment/migrations/0006_equipment_delivery_choice.py create mode 100644 kex/users/migrations/0006_user_aadhaar_card_number.py diff --git a/kex/booking/api/serializers.py b/kex/booking/api/serializers.py index c2763ef..352983d 100644 --- a/kex/booking/api/serializers.py +++ b/kex/booking/api/serializers.py @@ -21,6 +21,7 @@ class Meta: "created_at", "start_date", "end_date", + "renting_mode", ] @@ -90,6 +91,7 @@ class Meta: "start_time", "end_time", "customer", + "renting_mode", ] read_only_fields = [ "booking_id", @@ -204,6 +206,7 @@ class Meta: "status", "number_of_days", "owner", + "renting_mode", ] def get_total_daily_rent(self, obj): diff --git a/kex/booking/migrations/0003_booking_renting_mode.py b/kex/booking/migrations/0003_booking_renting_mode.py new file mode 100644 index 0000000..8730baf --- /dev/null +++ b/kex/booking/migrations/0003_booking_renting_mode.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.11 on 2022-04-11 18:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('booking', '0002_auto_20220304_1055'), + ] + + operations = [ + migrations.AddField( + model_name='booking', + name='renting_mode', + field=models.CharField(choices=[('With Assistance', 'With Assistance'), ('Self Use', 'Self Use')], default='Self Use', max_length=200), + ), + ] diff --git a/kex/booking/models.py b/kex/booking/models.py index 41d7ebe..d6906c5 100644 --- a/kex/booking/models.py +++ b/kex/booking/models.py @@ -26,6 +26,12 @@ class Booking(models.Model): ) created_at = models.DateTimeField(auto_now_add=True) + RENTING_MODES = (("With Assistance", "With Assistance"), ("Self Use", "Self Use")) + + renting_mode = models.CharField( + choices=RENTING_MODES, max_length=200, default="Self Use" + ) + def __str__(self): return self.customer.username + " - " + self.equipment.title diff --git a/kex/equipment/api/serializers.py b/kex/equipment/api/serializers.py index 2ed85f7..6054c4d 100644 --- a/kex/equipment/api/serializers.py +++ b/kex/equipment/api/serializers.py @@ -83,6 +83,7 @@ class Meta: "available_end_time", "show_phone_number", "created_at", + "delivery_choice", ] def get_manufacturer(self, obj): @@ -174,6 +175,7 @@ class Meta: "available_end_time", "show_phone_number", "created_at", + "delivery_choice", ] def get_image_1(self, obj): diff --git a/kex/equipment/migrations/0006_equipment_delivery_choice.py b/kex/equipment/migrations/0006_equipment_delivery_choice.py new file mode 100644 index 0000000..eb8aca6 --- /dev/null +++ b/kex/equipment/migrations/0006_equipment_delivery_choice.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.11 on 2022-04-11 18:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('equipment', '0005_alter_equipmentrating_unique_together'), + ] + + operations = [ + migrations.AddField( + model_name='equipment', + name='delivery_choice', + field=models.CharField(choices=[('Self', 'Self'), ('Help Centre', 'Help Centre')], default='Self', max_length=200), + ), + ] diff --git a/kex/equipment/models.py b/kex/equipment/models.py index 754cb56..5e8dfcb 100644 --- a/kex/equipment/models.py +++ b/kex/equipment/models.py @@ -46,6 +46,11 @@ class Equipment(models.Model): show_phone_number = models.BooleanField(default=False) created_at = models.DateTimeField(auto_now_add=True) + DELIVERY_CHOICES = (("Self", "Self"), ("Help Centre", "Help Centre")) + delivery_choice = models.CharField( + choices=DELIVERY_CHOICES, max_length=200, default="Self" + ) + def __str__(self): return self.title diff --git a/kex/users/api/serializers.py b/kex/users/api/serializers.py index 32a7559..c5c2b8d 100644 --- a/kex/users/api/serializers.py +++ b/kex/users/api/serializers.py @@ -62,6 +62,7 @@ class UserSignupSerializer(serializers.ModelSerializer): phone_number = serializers.IntegerField( required=True, validators=[validator_mobile_number] ) + aadhar_card_number = serializers.CharField(required=True) email = serializers.EmailField(required=False) password = serializers.CharField(required=True, write_only=True) @@ -81,6 +82,7 @@ class Meta: "pin_code", "phone_number", "secondary_phone_number", + "aadhar_card_number", ] read_only_fields = ["id", "user_id", "uuid"] diff --git a/kex/users/migrations/0006_user_aadhaar_card_number.py b/kex/users/migrations/0006_user_aadhaar_card_number.py new file mode 100644 index 0000000..15acd83 --- /dev/null +++ b/kex/users/migrations/0006_user_aadhaar_card_number.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.11 on 2022-04-11 18:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0005_auto_20220227_0753'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='aadhaar_card_number', + field=models.CharField(blank=True, max_length=12, null=True, verbose_name='AADHAR CARD number of User'), + ), + ] diff --git a/kex/users/models.py b/kex/users/models.py index 10b407f..917309b 100644 --- a/kex/users/models.py +++ b/kex/users/models.py @@ -38,6 +38,10 @@ class User(AbstractUser): twilio_user_id = models.CharField(max_length=9, blank=True, null=True) + aadhaar_card_number = models.CharField( + _("AADHAR CARD number of User"), max_length=12, blank=True, null=True + ) + def tokens(self): refresh = RefreshToken.for_user(self) return {"refresh": str(refresh), "access": str(refresh.access_token)}