leads-db/leads/models.py
Lord_Devi 76fdf8b71f fix: Update IDSData model to allow non-unique business_uuid
feat: Add bulk delete functionality for IDS Data records
docs: Update commit message structure

fix: Update IDSData model to allow non-unique business_uuid
- Changed the `business_uuid` field in the `IDSData` model to not be unique
- This allows the import function to handle duplicate `business_uuid` values

feat: Add bulk delete functionality for IDS Data records
- Added a new view `ids_data_delete_all` to handle deleting all IDS Data records
- Added a new template `ids_data_delete_confirm.html` for the delete confirmation
- Updated the `ids_data` view to include a "Delete All" button

docs: Update commit message structure
- The commit message follows the structure: <type>: <description>
- The type uses the following values: fix, feat, build, chore, ci, docs, style, refactor, perf, test
2024-09-16 23:20:18 -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()
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