mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-10-30 22:49:51 +01:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			daac77ba57
			...
			392ab86123
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 392ab86123 | ||
|  | 7decc18ad5 | 
| @@ -18,7 +18,7 @@ from django.views.generic import CreateView, DetailView, FormView, RedirectView, | |||||||
| from django.views.generic.edit import FormMixin, ProcessFormView | from django.views.generic.edit import FormMixin, ProcessFormView | ||||||
| from django_tables2 import SingleTableView | from django_tables2 import SingleTableView | ||||||
| from magic import Magic | from magic import Magic | ||||||
| from registration.models import AdminRegistration | from registration.models import AdminRegistration, StudentRegistration | ||||||
| from tfjm.lists import get_sympa_client | from tfjm.lists import get_sympa_client | ||||||
| from tfjm.matrix import Matrix | from tfjm.matrix import Matrix | ||||||
| from tfjm.views import AdminMixin, VolunteerMixin | from tfjm.views import AdminMixin, VolunteerMixin | ||||||
| @@ -315,12 +315,26 @@ class TeamAuthorizationsView(LoginRequiredMixin, DetailView): | |||||||
|         team = self.get_object() |         team = self.get_object() | ||||||
|         output = BytesIO() |         output = BytesIO() | ||||||
|         zf = ZipFile(output, "w") |         zf = ZipFile(output, "w") | ||||||
|         for student in team.participants.all(): |         for participant in team.participants.all(): | ||||||
|             magic = Magic(mime=True) |             magic = Magic(mime=True) | ||||||
|             mime_type = magic.from_file("media/" + student.photo_authorization.name) |             if participant.photo_authorization: | ||||||
|             ext = mime_type.split("/")[1].replace("jpeg", "jpg") |                 mime_type = magic.from_file("media/" + participant.photo_authorization.name) | ||||||
|             zf.write("media/" + student.photo_authorization.name, |                 ext = mime_type.split("/")[1].replace("jpeg", "jpg") | ||||||
|                      _("Photo authorization of {student}.{ext}").format(student=str(student), ext=ext)) |                 zf.write("media/" + participant.photo_authorization.name, | ||||||
|  |                          _("Photo authorization of {participant}.{ext}").format(participant=str(participant), ext=ext)) | ||||||
|  |  | ||||||
|  |             if isinstance(participant, StudentRegistration) and participant.parental_authorization: | ||||||
|  |                 mime_type = magic.from_file("media/" + participant.parental_authorization.name) | ||||||
|  |                 ext = mime_type.split("/")[1].replace("jpeg", "jpg") | ||||||
|  |                 zf.write("media/" + participant.parental_authorization.name, | ||||||
|  |                          _("Parental authorization of {participant}.{ext}") | ||||||
|  |                          .format(participant=str(participant), ext=ext)) | ||||||
|  |  | ||||||
|  |             if participant.health_sheet: | ||||||
|  |                 mime_type = magic.from_file("media/" + participant.health_sheet.name) | ||||||
|  |                 ext = mime_type.split("/")[1].replace("jpeg", "jpg") | ||||||
|  |                 zf.write("media/" + participant.health_sheet.name, | ||||||
|  |                          _("Health sheet of {participant}.{ext}").format(participant=str(participant), ext=ext)) | ||||||
|         zf.close() |         zf.close() | ||||||
|         response = HttpResponse(content_type="application/zip") |         response = HttpResponse(content_type="application/zip") | ||||||
|         response["Content-Disposition"] = "attachment; filename=\"{filename}\"" \ |         response["Content-Disposition"] = "attachment; filename=\"{filename}\"" \ | ||||||
|   | |||||||
| @@ -17,6 +17,6 @@ matrix-nio~=0.15 | |||||||
| phonenumbers~=8.9.10 | phonenumbers~=8.9.10 | ||||||
| psycopg2-binary~=2.8 | psycopg2-binary~=2.8 | ||||||
| ptpython~=3.0 | ptpython~=3.0 | ||||||
| python-magic~=0.4 | python-magic==0.4.18 | ||||||
| sympasoap~=1.0 | sympasoap~=1.0 | ||||||
| whoosh~=2.7 | whoosh~=2.7 | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								tox.ini
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								tox.ini
									
									
									
									
									
								
							| @@ -22,7 +22,7 @@ deps = | |||||||
|     djangorestframework~=3.12 |     djangorestframework~=3.12 | ||||||
|     django-rest-polymorphic~=0.1 |     django-rest-polymorphic~=0.1 | ||||||
|     phonenumbers~=8.9.10 |     phonenumbers~=8.9.10 | ||||||
|     python-magic~=0.4 |     python-magic==0.4.18 | ||||||
|     whoosh~=2.7 |     whoosh~=2.7 | ||||||
| commands = | commands = | ||||||
|     coverage run --source=apps,tfjm ./manage.py test apps/ tfjm/ |     coverage run --source=apps,tfjm ./manage.py test apps/ tfjm/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user