leads-db/leads/models.py
Lord_Devi 1cd1295202 fix: update IDSData model and import function
The commit message is:

fix: update IDSData model and import function to handle decimal values in CSV data
2024-09-16 23:14:49 -04:00

61 lines
2.6 KiB
Python

from django.db import models
class Lead(models.Model):
name = models.CharField(max_length=100)
email = models.EmailField()
company = models.CharField(max_length=100)
lead_source = models.CharField(max_length=50, choices=[
('website', 'Website'),
('referral', 'Referral'),
('event', 'Event'),
('other', 'Other'),
])
score = models.IntegerField(default=0)
def calculate_lead_score(self):
score = 0
if self.lead_source == 'website':
score += 10
elif self.lead_source == 'referral':
score += 20
elif self.lead_source == 'event':
score += 15
# Add more scoring logic based on other factors
return score
def save(self, *args, **kwargs):
self.score = self.calculate_lead_score()
super().save(*args, **kwargs)
def __str__(self):
return self.name
class IDSData(models.Model):
business_name = models.CharField(max_length=255)
business_uuid = models.UUIDField(unique=True)
location_uuid = models.UUIDField()
yib = models.CharField(max_length=50, blank=True, null=True) # Year in Business
gbp_business_category = models.CharField(max_length=255)
gbp_matching_service = models.CharField(max_length=255, blank=True, null=True)
gbp_review_rating = models.FloatField(null=True, blank=True)
gbp_review_count = models.IntegerField(null=True, blank=True)
gbp_industry_avg_review_rating = models.FloatField(null=True, blank=True)
gbp_industry_avg_review_count = models.FloatField(null=True, blank=True)
gbp_review_rating_offset = models.FloatField(null=True, blank=True)
gbp_review_count_offset = models.FloatField(null=True, blank=True)
gbp_review_rating_health = models.CharField(max_length=50, blank=True, null=True)
gbp_review_count_health = models.CharField(max_length=50, blank=True, null=True)
gbp_location_municipality = models.CharField(max_length=255)
gbp_location_state = models.CharField(max_length=2)
location_from_gbp_business_name = models.CharField(max_length=255, blank=True, null=True)
gbp_business_phone = models.CharField(max_length=20, blank=True, null=True)
gbp_business_website = models.URLField(blank=True, null=True)
root_domain = models.CharField(max_length=255, blank=True, null=True)
md5_for_scrape = models.CharField(max_length=32)
services_reputation_management = models.BooleanField(default=False)
services_gbp_optimization = models.BooleanField(default=False)
services_needs_website = models.BooleanField(default=False)
def __str__(self):
return self.business_name