You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.3 KiB
Python

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 Comment(models.Model):
content = models.TextField()
date_added = models.DateTimeField(auto_now_add=True)
added_by = models.ForeignKey(User, on_delete=models.CASCADE)
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)
comments = models.ManyToManyField(Comment, blank=True)
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)