from django.db import models from osinacore.models import * # Create your models here. class Group(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Country(models.Model): name = models.CharField(max_length=100) code = models.CharField(max_length=5) class ProspectingList(models.Model): name = models.CharField(max_length=100) description = models.TextField(null=True, blank=True) date_added = models.DateTimeField(auto_now_add=True) added_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True) class AddressBook(models.Model): first_name = models.CharField(max_length=100) middle_name = models.CharField(max_length=100, blank=True, null=True) last_name = models.CharField(max_length=100) country = models.ForeignKey(Country, null=True, on_delete=models.SET_NULL) group = models.ManyToManyField(Group, blank=True) class ProspectingListItem(models.Model): prospecting_list = models.ForeignKey(ProspectingList, on_delete=models.CASCADE) addressbook = models.ForeignKey(AddressBook, on_delete=models.CASCADE) date_added = models.DateTimeField(auto_now_add=True) attention = models.BooleanField(default=False) class Contact(models.Model): TYPE_CHOICES = ( ('Email', 'Email'), ('Mobile', 'Mobile'), ('Phone', 'Phone'), ('Whatsapp', 'Whatsapp'), ) type = models.CharField(max_length=20, choices=TYPE_CHOICES) contact = models.CharField(max_length=100) addressbook = models.ForeignKey(AddressBook, on_delete=models.CASCADE) class SocialMedia(models.Model): TYPE_CHOICES = ( ('Facebook', 'Facebook'), ('Instagram', 'Instagram'), ('X', 'X'), ('Tiktok', 'Tiktok'), ('Linkedin', 'Linkedin'), ('Youtube', 'Youtube'), ) type = models.CharField(max_length=20, choices=TYPE_CHOICES) username = models.CharField(max_length=50, blank=True) link = models.URLField(blank=True) addressbook = models.ForeignKey(AddressBook, on_delete=models.CASCADE, null=True) class Comment(models.Model): content = models.TextField() date_added = models.DateTimeField(auto_now_add=True) added_by = models.ForeignKey(User, on_delete=models.CASCADE)