forked from beba/foerderbarometer
				
			survey mails send (for Library only in the moment)
This commit is contained in:
		
							parent
							
								
									af68b71018
								
							
						
					
					
						commit
						7fa5110865
					
				|  | @ -5,7 +5,7 @@ from django.template.loader import get_template | |||
| from django.core.mail import send_mail, BadHeaderError | ||||
| 
 | ||||
| from input.models import Project, Library | ||||
| from input.settings import URLPREFIX, IF_EMAIL | ||||
| from input.settings import URLPREFIX, IF_EMAIL, SURVEYPREFIX | ||||
| 
 | ||||
| class Command(BaseCommand): | ||||
|     ''' mails will be send here: | ||||
|  | @ -26,7 +26,22 @@ class Command(BaseCommand): | |||
|               after some amount of time.''' | ||||
| 
 | ||||
|     def survey_link(self, email, type, pid, name, realname): | ||||
|             print(f'send surveylinkemail to {email}...') | ||||
|         context = {'realname': realname, | ||||
|                        'type': type, | ||||
|                        'name': name, | ||||
|                        'pid': pid, | ||||
|                        'SURVEYPREFIX': SURVEYPREFIX, } | ||||
|         mail_template = get_template('input/survey_mail.txt') | ||||
|         try: | ||||
|             send_mail('Projektende erreicht', | ||||
|                   mail_template.render(context), | ||||
|                   IF_EMAIL, | ||||
|                   [email], | ||||
|                   fail_silently=False) | ||||
|         except BadHeaderError: | ||||
|             return HttpResponse('Invalid header found.') | ||||
| 
 | ||||
|         print(f'send surveylinkemail to {email}...') | ||||
| 
 | ||||
|     def end_of_projects_reached(self): | ||||
|         ''' end of project reached ''' | ||||
|  | @ -66,5 +81,7 @@ class Command(BaseCommand): | |||
|                              pid=9999, ## TODO | ||||
|                              name=item.library, | ||||
|                              realname=item.realname) | ||||
| #            project.end_mail_send = True | ||||
| #            project.save() | ||||
| 
 | ||||
|         self.stdout.write(self.style.SUCCESS('sendmails custom command executed')) | ||||
|  |  | |||
|  | @ -1,28 +1,28 @@ | |||
| Hallo {{data.realname}}, | ||||
| Hallo {{realname}}, | ||||
| 
 | ||||
| Vor einiger Zeit durfte Wikimedia Deutschland Deine Aktivität für Freies Wissen | ||||
| unterstützen. | ||||
| {% if data.type == 'PRO' %} | ||||
| Deine Aktivitäten werden von uns unter dem Projekttitel {{data.name}} geführt. | ||||
| {% elif data.type == 'HON' %} | ||||
| Du hast von uns eine Bescheinigung ({{data.name}}) erhalten. | ||||
| {% elif data.type == 'BIB' %} | ||||
| Du hast von uns ein Bibliotheksstipendium für {{data.name}} erhalten. | ||||
| {% elif data.type == 'ELIT' %} | ||||
| Du hast von uns ein eLiteraturstipendium für {{data.name}} erhalten. | ||||
| {% elif data.type == 'IFG'} | ||||
| Wir haben Dich bei einer IFG-Anfrage unterstützt: {{data.name}} | ||||
| {% elif data.type == 'LIT' %} | ||||
| Du hast von uns ein Literaturstipendium für {{data.name}} erhalten. | ||||
| {% elif data.type == 'TRAV' %} | ||||
| Wir haben Dich mit Reisekostenübernahme für {{data.name}} unterstützt. | ||||
| {% elif data.type == 'SOFT' %} | ||||
| Du hast von uns ein Softwarestipendium für {{data.name}} erhalten. | ||||
| {% elif data.type == 'MAIL' %} | ||||
| {% if type == 'PRO' %} | ||||
| Deine Aktivitäten werden von uns unter dem Projekttitel {{name}} geführt. | ||||
| {% elif type == 'HON' %} | ||||
| Du hast von uns eine Bescheinigung ({{name}}) erhalten. | ||||
| {% elif type == 'BIB' %} | ||||
| Du hast von uns ein Bibliotheksstipendium für {{name}} erhalten. | ||||
| {% elif type == 'ELIT' %} | ||||
| Du hast von uns ein eLiteraturstipendium für {{name}} erhalten. | ||||
| {% elif type == 'IFG'} | ||||
| Wir haben Dich bei einer IFG-Anfrage unterstützt: {{name}} | ||||
| {% elif type == 'LIT' %} | ||||
| Du hast von uns ein Literaturstipendium für {{name}} erhalten. | ||||
| {% elif type == 'TRAV' %} | ||||
| Wir haben Dich mit Reisekostenübernahme für {{name}} unterstützt. | ||||
| {% elif type == 'SOFT' %} | ||||
| Du hast von uns ein Softwarestipendium für {{name}} erhalten. | ||||
| {% elif type == 'MAIL' %} | ||||
| Du hast von uns eine E-Mail-Adresse erhalten. | ||||
| {% elif data.type == 'LIST' %} | ||||
| {% elif type == 'LIST' %} | ||||
| Wir haben Dir eine Mailingliste bereit gestellt. | ||||
| {% elif data.type == 'VIS' %} | ||||
| {% elif type == 'VIS' %} | ||||
| Du hast von uns Visitenkarten erhalten. | ||||
| {% endif %} | ||||
| 
 | ||||
|  | @ -32,7 +32,7 @@ Förderprogramme im Sinne der Communitys weiter zu verbessern. Wir freuen uns, | |||
| wenn du dir kurz die Zeit dafür nehmen würdest. Die Umfrage mit weiteren | ||||
| Informationen findest du unter dem folgenden Link: | ||||
| 
 | ||||
| {{SURVEYPREFIX}}{{data.pid}}=1 | ||||
| {{SURVEYPREFIX}}{{pid}}=1 | ||||
| 
 | ||||
| Da dies eine automatisch erzeugte Nachricht ist, wende dich bei Rückfragen zur Umfrage bitte an community@wikimedia.de | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue