new modell field survey_mail_send to make sure every mail is sendet only once
This commit is contained in:
parent
7fa5110865
commit
d3ba817b09
4 changed files with 49 additions and 14 deletions
|
@ -13,7 +13,7 @@ class ProjectForm(ModelForm):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Project
|
model = Project
|
||||||
exclude = ('pid', 'granted', 'username', 'realname', 'email', 'project_end_mail')
|
exclude = ('pid', 'granted', 'username', 'realname', 'email', 'project_end_mail', 'survey_mail_send')
|
||||||
widgets = {'start': AdminDateWidget(),
|
widgets = {'start': AdminDateWidget(),
|
||||||
'end': AdminDateWidget(),}
|
'end': AdminDateWidget(),}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class VolunteerForm(ModelForm):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Volunteer
|
model = Volunteer
|
||||||
exclude = ('granted',)
|
exclude = ('granted','survey_mail_send')
|
||||||
|
|
||||||
INTERN_CHOICES = [('PRO', 'Projektsteckbrief'),
|
INTERN_CHOICES = [('PRO', 'Projektsteckbrief'),
|
||||||
('HON', 'Ehrenamtsbescheinigung'),
|
('HON', 'Ehrenamtsbescheinigung'),
|
||||||
|
@ -41,21 +41,21 @@ class InternForm(ModelForm):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Volunteer
|
model = Volunteer
|
||||||
exclude = ('granted',)
|
exclude = ('granted','survey_mail_send')
|
||||||
|
|
||||||
|
|
||||||
class LibraryForm(ModelForm):
|
class LibraryForm(ModelForm):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Library
|
model = Library
|
||||||
exclude = ('realname', 'email', 'username', 'type', 'granted')
|
exclude = ('realname', 'email', 'username', 'type', 'granted', 'survey_mail_send')
|
||||||
|
|
||||||
class IFGForm(ModelForm):
|
class IFGForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IFG
|
model = IFG
|
||||||
exclude = ('realname', 'email', 'username', 'granted')
|
exclude = ('realname', 'email', 'username', 'granted', 'survey_mail_send')
|
||||||
|
|
||||||
class HonoraryCertificateForm(ModelForm):
|
class HonoraryCertificateForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = HonoraryCertificate
|
model = HonoraryCertificate
|
||||||
exclude = ('realname', 'email', 'username', 'granted')
|
exclude = ('realname', 'email', 'username', 'granted', 'survey_mail_send')
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Command(BaseCommand):
|
||||||
project.end_mail_send = True
|
project.end_mail_send = True
|
||||||
project.save()
|
project.save()
|
||||||
except BadHeaderError:
|
except BadHeaderError:
|
||||||
return HttpResponse('Invalid header found.')
|
self.stdout.write(self.style.ERROR('Invalid header found.'))
|
||||||
|
|
||||||
self.stdout.write(self.style.SUCCESS('end_of_projects_reached() executed.'))
|
self.stdout.write(self.style.SUCCESS('end_of_projects_reached() executed.'))
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
self.end_of_projects_reached()
|
self.end_of_projects_reached()
|
||||||
|
|
||||||
supported = Library.objects.filter(granted=True)
|
supported = Library.objects.filter(granted=True)\
|
||||||
|
.exclude(survey_mail_send=True)
|
||||||
print(supported)
|
print(supported)
|
||||||
for item in supported:
|
for item in supported:
|
||||||
self.survey_link(email=item.email,
|
self.survey_link(email=item.email,
|
||||||
|
@ -81,7 +82,7 @@ class Command(BaseCommand):
|
||||||
pid=9999, ## TODO
|
pid=9999, ## TODO
|
||||||
name=item.library,
|
name=item.library,
|
||||||
realname=item.realname)
|
realname=item.realname)
|
||||||
# project.end_mail_send = True
|
item.survey_mail_send = True
|
||||||
# project.save()
|
item.save()
|
||||||
|
|
||||||
self.stdout.write(self.style.SUCCESS('sendmails custom command executed'))
|
self.stdout.write(self.style.SUCCESS('sendmails custom command executed'))
|
||||||
|
|
33
input/migrations/0022_auto_20201022_1233.py
Normal file
33
input/migrations/0022_auto_20201022_1233.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# Generated by Django 3.1.1 on 2020-10-22 12:33
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('input', '0021_auto_20201022_0934'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='honorarycertificate',
|
||||||
|
name='survey_mail_send',
|
||||||
|
field=models.BooleanField(null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='ifg',
|
||||||
|
name='survey_mail_send',
|
||||||
|
field=models.BooleanField(null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='library',
|
||||||
|
name='survey_mail_send',
|
||||||
|
field=models.BooleanField(null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='project',
|
||||||
|
name='survey_mail_send',
|
||||||
|
field=models.BooleanField(null=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -8,6 +8,7 @@ class Volunteer(models.Model):
|
||||||
email = models.CharField(max_length=200, null=True)
|
email = models.CharField(max_length=200, null=True)
|
||||||
username = models.CharField(max_length=200, null=True)
|
username = models.CharField(max_length=200, null=True)
|
||||||
granted = models.BooleanField(null=True)
|
granted = models.BooleanField(null=True)
|
||||||
|
survey_mail_send = models.BooleanField(null=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_granted(cl, key, b):
|
def set_granted(cl, key, b):
|
||||||
|
|
Loading…
Reference in a new issue