Answer the question
In order to leave comments, you need to log in
Complicated query on Django model?
There is a model Users (standard) Contacts and ProjectUsers
class Users():
pass
class Contacts(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user')
first_name = models.CharField(max_length=32, blank=True, verbose_name='First name')
last_name = models.CharField(max_length=32, blank=True, verbose_name='Last name')
middle_name = models.CharField(max_length=32, blank=True, verbose_name='Middle name')
email = models.EmailField(blank=True)
tel = models.CharField(max_length=16, blank=True, verbose_name='Tel.')
group = models.ManyToManyField(ContactGroups, blank=True)
in_service = models.NullBooleanField(default=0)
company = models.ForeignKey(Company, null=True, verbose_name='Company')
class ProjectUsers(models.Model):
project = models.ForeignKey(Project, null=True)
user = models.ForeignKey(User, on_delete=models.CASCADE)
user_role = models.ForeignKey(UserRole)
default_project = models.BooleanField(verbose_name=u'Проект по умолчанию')
date_log = models.DateTimeField(verbose_name=u'Дата регистрации', auto_now_add=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question