temp fix: Temporarily disable welcome emails

This commit is contained in:
James Graham
2020-05-27 14:47:10 +01:00
parent c364db4f16
commit 8bc82b2a15

View File

@@ -37,7 +37,9 @@ class User(AbstractUser):
context.update({ context.update({
'user': self, 'user': self,
}) })
return False
mail.send( mail.send(
[self.email], [self.email],
sender=settings.DEFAULT_FROM_EMAIL, sender=settings.DEFAULT_FROM_EMAIL,
@@ -51,19 +53,17 @@ class Organisation(models.Model):
""" """
Organisation to which a :class:`Person` belongs. Organisation to which a :class:`Person` belongs.
""" """
name = models.CharField(max_length=255, name = models.CharField(max_length=255, blank=False, null=False)
blank=False, null=False)
def __str__(self) -> str: def __str__(self) -> str:
return self.name return self.name
class Role(models.Model): class Role(models.Model):
""" """
Role which a :class:`Person` holds within the project. Role which a :class:`Person` holds within the project.
""" """
name = models.CharField(max_length=255, name = models.CharField(max_length=255, blank=False, null=False)
blank=False, null=False)
def __str__(self) -> str: def __str__(self) -> str:
return self.name return self.name
@@ -73,23 +73,20 @@ class Discipline(models.Model):
""" """
Discipline within which a :class:`Person` works. Discipline within which a :class:`Person` works.
""" """
name = models.CharField(max_length=255, name = models.CharField(max_length=255, blank=False, null=False)
blank=False, null=False)
#: Short code using system such as JACS 3 #: Short code using system such as JACS 3
code = models.CharField(max_length=15, code = models.CharField(max_length=15, blank=True, null=False)
blank=True, null=False)
def __str__(self) -> str: def __str__(self) -> str:
return self.name return self.name
class Theme(models.Model): class Theme(models.Model):
""" """
Project theme within which a :class:`Person` works. Project theme within which a :class:`Person` works.
""" """
name = models.CharField(max_length=255, name = models.CharField(max_length=255, blank=False, null=False)
blank=False, null=False)
def __str__(self) -> str: def __str__(self) -> str:
return self.name return self.name
@@ -106,21 +103,22 @@ class Person(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL, user = models.OneToOneField(settings.AUTH_USER_MODEL,
related_name='person', related_name='person',
on_delete=models.CASCADE, on_delete=models.CASCADE,
blank=True, null=True) blank=True,
null=True)
#: Name of the person #: Name of the person
name = models.CharField(max_length=255, name = models.CharField(max_length=255, blank=False, null=False)
blank=False, null=False)
#: Is this person a member of the core project team? #: Is this person a member of the core project team?
core_member = models.BooleanField(default=False, core_member = models.BooleanField(default=False, blank=False, null=False)
blank=False, null=False)
#: People with whom this person has relationship - via intermediate :class:`Relationship` model #: People with whom this person has relationship - via intermediate :class:`Relationship` model
relationship_targets = models.ManyToManyField('self', related_name='relationship_sources', relationship_targets = models.ManyToManyField(
through='Relationship', 'self',
through_fields=('source', 'target'), related_name='relationship_sources',
symmetrical=False) through='Relationship',
through_fields=('source', 'target'),
symmetrical=False)
############################################################### ###############################################################
# Data collected for analysis of community makeup and structure # Data collected for analysis of community makeup and structure
@@ -133,7 +131,8 @@ class Person(models.Model):
gender = models.CharField(max_length=1, gender = models.CharField(max_length=1,
choices=GenderChoices.choices, choices=GenderChoices.choices,
blank=True, null=False) blank=True,
null=False)
class AgeGroupChoices(TextChoices): class AgeGroupChoices(TextChoices):
LTE_25 = '<=25', _('25 or under') LTE_25 = '<=25', _('25 or under')
@@ -149,8 +148,9 @@ class Person(models.Model):
age_group = models.CharField(max_length=5, age_group = models.CharField(max_length=5,
choices=AgeGroupChoices.choices, choices=AgeGroupChoices.choices,
blank=True, null=False) blank=True,
null=False)
nationality = CountryField(blank=True, null=True) nationality = CountryField(blank=True, null=True)
country_of_residence = CountryField(blank=True, null=True) country_of_residence = CountryField(blank=True, null=True)
@@ -159,34 +159,33 @@ class Person(models.Model):
organisation = models.ForeignKey(Organisation, organisation = models.ForeignKey(Organisation,
on_delete=models.PROTECT, on_delete=models.PROTECT,
related_name='members', related_name='members',
blank=True, null=True) blank=True,
null=True)
#: Job title this person holds within their organisation #: Job title this person holds within their organisation
job_title = models.CharField(max_length=255, job_title = models.CharField(max_length=255, blank=True, null=False)
blank=True, null=False)
#: Discipline within which this person works #: Discipline within which this person works
discipline = models.ForeignKey(Discipline, discipline = models.ForeignKey(Discipline,
on_delete=models.PROTECT, on_delete=models.PROTECT,
related_name='people', related_name='people',
blank=True, null=True) blank=True,
null=True)
#: Role this person holds within the project #: Role this person holds within the project
role = models.ForeignKey(Role, role = models.ForeignKey(Role,
on_delete=models.PROTECT, on_delete=models.PROTECT,
related_name='holders', related_name='holders',
blank=True, null=True) blank=True,
null=True)
#: Project themes within this person works #: Project themes within this person works
themes = models.ManyToManyField(Theme, themes = models.ManyToManyField(Theme, related_name='people', blank=True)
related_name='people',
blank=True)
@property @property
def relationships(self): def relationships(self):
return self.relationships_as_source.all().union( return self.relationships_as_source.all().union(
self.relationships_as_target.all() self.relationships_as_target.all())
)
def get_absolute_url(self): def get_absolute_url(self):
return reverse('people:person.detail', kwargs={'pk': self.pk}) return reverse('people:person.detail', kwargs={'pk': self.pk})