class Customer(models.Model): name = models.CharField(max_length=255, null=True, blank=False) mailing_name = models.CharField(max_length=255, null=True, blank=False) website_url = models.URLField() GST_status = models.CharField(max_length=255, choices = GST_STATUS) GSTIN = GSTField(null = True, blank = True) resident_status = models.CharField(max_length=255, choices=RESIDENT_STATUS) constitution = models.CharField(max_length=255, choices=CONSTITUTION) income_tax_type = models.CharField(max_length=255, choices=INCOME_TAX_TYPE) occupation = models.CharField(max_length=255, choices=OCCUPATION) is_business_entity = models.BooleanField(default=False) is_body_corporate = models.BooleanField(default=False) address = models.TextField() country = models.CharField(max_length=255) state = models.CharField(max_length=255) city = models.CharField(max_length=255) zipcode = models.IntegerField() contact_person_name = models.CharField(max_length=255) office_phone = PhoneNumberField(unique=True, blank=True) email_address = models.EmailField() mobile = PhoneNumberField(unique=True, blank=True) bank_acc_type = models.CharField(max_length=255, choices=BANK_ACC_TYPE) benificiary_bank_name = models.CharField(max_length=255) benificiary_name = models.CharField(max_length=255) acc_number = models.CharField(max_length=100) branch = models.CharField(max_length=255) IFSC = models.CharField(max_length=64)
class OrganizationLocation(models.Model): parent_company = models.ForeignKey(Organization, on_delete=models.CASCADE, related_name='organization') location_code = models.CharField(max_length=64) location_name = models.CharField(max_length=255) GST_reg_status = models.CharField(max_length=255, choices=GST_STATUS) PAN = PANField() parent_company_GST = models.BooleanField(default=True) GST = GSTField() location_id = models.CharField(max_length=64) address = models.TextField() country = models.CharField(max_length=255) state = models.CharField(max_length=255) city = models.CharField(max_length=255) zipcode = models.IntegerField() contact_person_name = models.CharField(max_length=255) office_phone = PhoneNumberField(unique=True, blank=True) email_address = models.EmailField() mobile = PhoneNumberField(unique=True, blank=True) def __str__(self): return self.location_name
class SellerData(models.Model): name = models.CharField(max_length=100) email = models.EmailField(max_length=254) password = models.CharField(max_length=100) mobile = models.CharField(max_length=15) gst = GSTField() comp_name = models.CharField(max_length=100) address = models.TextField(max_length=200) state = models.CharField(max_length=100) pincode = models.CharField(max_length=8) rating = models.IntegerField(default=0)
class User(models.Model): UserType = Choices('BUYER', 'SELLER', 'BROKER', 'GUEST') name = models.CharField(max_length=100) email = models.EmailField() user_type = models.CharField(choices=UserType, max_length=64, default=UserType.BUYER) gstin = GSTField(null=True, blank=True) pan = PANField(null=True, blank=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True)
class Owner(User, PermissionsMixin): company_name = models.CharField(max_length=50) GST = GSTField() PAN = PANField() USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username', 'company_name', 'GST', 'PAN'] objects = OwnerManager() def __str__(self): return self.username
class Organization(models.Model): #owner_name = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=False, blank=False) org_name = models.CharField(max_length=255, null=True, blank=False) mailing_name = models.CharField(max_length=255, null=True, blank=False) website_url = models.URLField() GST_status = models.CharField(max_length=255, choices=GST_STATUS) PAN = PANField() GSTIN = GSTField() prevyear_annual_turnover = models.IntegerField() finance_year = models.CharField(max_length=255, choices=FINANCIAL_YEAR) CIN = models.CharField( max_length=21, validators=[ RegexValidator( regex= r'^([L|U]{1})([0-9]{5})([A-Za-z]{2})([0-9]{4})([A-Za-z]{3})([0-9]{6})$', message=('CIN must be Alphanumeric'), ), ]) resident_status = models.CharField(max_length=255, choices=RESIDENT_STATUS) constitution = models.CharField(max_length=255, choices=CONSTITUTION) income_tax_type = models.CharField(max_length=255, choices=INCOME_TAX_TYPE) occupation = models.CharField(max_length=255, choices=OCCUPATION) is_business_entity = models.BooleanField(default=False) is_body_corporate = models.BooleanField(default=False) company_logo = models.ImageField() PF_number = models.CharField(max_length=255, validators=[ RegexValidator( regex=r'^[A-Z]{2}/\d{5}/\d{7}$', message=('PF must be Alphanumeric'), ), ]) address = models.TextField() country = models.CharField(max_length=255) state = models.CharField(max_length=255) city = models.CharField(max_length=255) zipcode = models.IntegerField() contact_person_name = models.CharField(max_length=255) office_phone = PhoneNumberField(unique=True, blank=True) email_address = models.EmailField() mobile = PhoneNumberField(unique=True, blank=True) bank_acc_type = models.CharField(max_length=255, choices=BANK_ACC_TYPE) benificiary_bank_name = models.CharField(max_length=255) benificiary_name = models.CharField(max_length=255) acc_number = models.CharField(max_length=100) branch = models.CharField(max_length=255) IFSC = models.CharField(max_length=64) def __str__(self): return self.org_name
class CongoUserProfile(models.Model): RETAILER = 'R' WHOLESALER = 'W' BUSINESS_TYPE_CHOICES = [ (RETAILER, 'Retailer'), (WHOLESALER, 'Wholesaler'), ] ELECTRONICS = 'EC' APPLIANCES = 'AP' FASHION = 'FS' HOME_DECOR = 'HD' GROCERY = 'GC' MEDICINES = 'MD' HEALTHFIT = 'HF' BOOKS = 'BK' BUSINESS_CATEGORIES = [ (ELECTRONICS, 'Electronics'), (APPLIANCES, 'Appliances'), (FASHION, 'Fashion'), (HOME_DECOR, 'Home Decoration'), (GROCERY, 'Groceries'), (MEDICINES, 'Medicines'), (HEALTHFIT, 'Health & Fitness'), (BOOKS, 'Books & Stationaries'), ] congo_user = models.OneToOneField(get_user_model(), on_delete=models.CASCADE, related_name='profile') first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=150) is_verified = models.BooleanField(default=False) business_name = models.CharField(max_length=50) gst_number = GSTField() business_type = models.CharField(max_length=1, choices=BUSINESS_TYPE_CHOICES, default=RETAILER) business_category = models.CharField(max_length=2, choices=BUSINESS_CATEGORIES) def __str__(self): return '{} - {} {}'.format(self.business_name, self.first_name, self.last_name)