Zaškrtávátko, aby se mail poslat nemusel
This commit is contained in:
		
							parent
							
								
									bb58f29c86
								
							
						
					
					
						commit
						62adb24a5f
					
				
					 3 changed files with 24 additions and 2 deletions
				
			
		|  | @ -18,7 +18,7 @@ class KorekturovanePDFAdmin(VersionAdmin): | |||
| 	fieldsets = [ | ||||
| 			(None, | ||||
| 				{'fields': | ||||
| 					['pdf', 'cas', 'org', 'stran', 'nazev', 'komentar']}), | ||||
| 					['pdf', 'cas', 'org', 'stran', 'nazev', 'komentar', 'poslat_mail']}), | ||||
| 			# (u'PDF',       {'fields': ['pdf']}), | ||||
| 				] | ||||
| 	list_display = ['nazev', 'cas', 'stran', 'org'] | ||||
|  | @ -27,7 +27,7 @@ class KorekturovanePDFAdmin(VersionAdmin): | |||
| 
 | ||||
| 	def save_model(self, request, obj, form, change): | ||||
| 		super().save_model(request, obj, form, change) | ||||
| 		if not change: # Je nový | ||||
| 		if not change and obj.poslat_mail: # Je nový a má se poslat mail | ||||
| 			odkaz = request.build_absolute_uri(reverse('korektury', kwargs={'pdf': obj.id})) | ||||
| 			odesilatel = 'korekturovatko-nove-pdf@mam.mff.cuni.cz' | ||||
| 			prijemce = 'org@mam.mff.cuni.cz' | ||||
|  |  | |||
							
								
								
									
										18
									
								
								korektury/migrations/0018_korekturovanepdf_poslat_mail.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								korektury/migrations/0018_korekturovanepdf_poslat_mail.py
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| # Generated by Django 2.2.24 on 2021-12-05 23:09 | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('korektury', '0017_auto_20190610_2358'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.AddField( | ||||
|             model_name='korekturovanepdf', | ||||
|             name='poslat_mail', | ||||
|             field=models.BooleanField(default=True, help_text='Určuje, zda se má o nově nahraném PDF poslat e-mail do mam-org. Při upravování existujícího souboru už nemá žádný vliv.', verbose_name='Poslat mail o novém PDF'), | ||||
|         ), | ||||
|     ] | ||||
|  | @ -63,6 +63,10 @@ class KorekturovanePDF(models.Model): | |||
| 	status = models.CharField(u'stav PDF',max_length=16, choices=STATUS_CHOICES, blank=False, | ||||
| 			default = STATUS_PRIDAVANI) | ||||
| 
 | ||||
| 	poslat_mail = models.BooleanField('Poslat mail o novém PDF', default=True, | ||||
| 			help_text='Určuje, zda se má o nově nahraném PDF poslat e-mail do mam-org. Při upravování existujícího souboru už nemá žádný vliv.', | ||||
| 			) | ||||
| 
 | ||||
| 
 | ||||
| 	#TODO Nepovinný foreign key k číslu | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Pavel "LEdoian" Turinsky
						Pavel "LEdoian" Turinsky