Použití {%maillink%} v detailu řešení
Ten řádek má sice pořád 117 znaků, ale IMHO je to o dost lepší. Mně to i správně vyplňuje subjecty v Thunderbirdu, takže můj kód asi není úplně mimo :-)
This commit is contained in:
		
							parent
							
								
									ff996c2924
								
							
						
					
					
						commit
						efe1b4bb5a
					
				
					 2 changed files with 8 additions and 1 deletions
				
			
		|  | @ -1,6 +1,7 @@ | ||||||
| {% extends "base.html" %} | {% extends "base.html" %} | ||||||
| {% load static %} | {% load static %} | ||||||
| {% load deadliny %} | {% load deadliny %} | ||||||
|  | {% load mail %} | ||||||
| 
 | 
 | ||||||
| {% block content %} | {% block content %} | ||||||
| 
 | 
 | ||||||
|  | @ -14,7 +15,10 @@ | ||||||
| 
 | 
 | ||||||
| {% if edit %} | {% if edit %} | ||||||
|   <p>Řešitelé: |   <p>Řešitelé: | ||||||
|     {% for r in object.resitele.all %}{{ r }} (<a href="mailto:{{ r.osoba.email }}?subject={{ "Oprava řešení M&M " | urlencode }}{{ object.problem.all.0.hlavni_problem | urlencode }}">{{ r.osoba.email }}</a>){% if forloop.revcounter0 != 0 %}, {% endif %}{% endfor %} |   {% for r in object.resitele.all %} | ||||||
|  |     {{ r }} | ||||||
|  |     ({% maillink r.osoba.email to=r.osoba.email subject=mailsubject %}){% if forloop.revcounter0 != 0 %}, {% endif %} | ||||||
|  |   {% endfor %} | ||||||
|   </p> |   </p> | ||||||
| {% else %} | {% else %} | ||||||
|   <p>Řešitelé: {{ object.resitele.all | join:", " }}</p> |   <p>Řešitelé: {{ object.resitele.all | join:", " }}</p> | ||||||
|  |  | ||||||
|  | @ -237,6 +237,9 @@ class DetailReseniView(DetailView): | ||||||
| 		ctx = super().get_context_data(**kw) | 		ctx = super().get_context_data(**kw) | ||||||
| 		detaily_hodnoceni = self.aktualni_hodnoceni() | 		detaily_hodnoceni = self.aktualni_hodnoceni() | ||||||
| 		ctx["hodnoceni"] = detaily_hodnoceni | 		ctx["hodnoceni"] = detaily_hodnoceni | ||||||
|  | 
 | ||||||
|  | 		# Subject případného mailu (template neumí použitelně spojovat řetězce: https://stackoverflow.com/q/4386168) | ||||||
|  | 		ctx["mailsubject"] = "Oprava řešení M&M "+self.reseni.problem.first().hlavni_problem.nazev | ||||||
| 		return ctx | 		return ctx | ||||||
| 
 | 
 | ||||||
| 	def get(self, request, *args, **kwargs): | 	def get(self, request, *args, **kwargs): | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel "LEdoian" Turinsky
						Pavel "LEdoian" Turinsky