Zachování časové setřízenosti korekturovátka
This commit is contained in:
		
							parent
							
								
									a8af72df1d
								
							
						
					
					
						commit
						e470aaedaa
					
				
					 2 changed files with 3 additions and 1 deletions
				
			
		|  | @ -5,6 +5,7 @@ from django.utils import timezone | |||
| from django.conf import settings | ||||
| from django.utils.encoding import force_text | ||||
| from django.core.exceptions import ObjectDoesNotExist | ||||
| from django.utils.functional import cached_property | ||||
| from django.utils.text import get_valid_filename | ||||
| 
 | ||||
| from seminar.models import Organizator | ||||
|  | @ -122,6 +123,7 @@ class KorekturovanePDF(models.Model): | |||
| 		# uložíme png a změněný počet stran | ||||
| 		self.convert() | ||||
| 
 | ||||
| 	@cached_property | ||||
| 	def cislo_a_tema(self): | ||||
| 		nazev_split = self.nazev.split() | ||||
| 		try: | ||||
|  |  | |||
|  | @ -59,7 +59,7 @@ class KorekturySeskupeneListView(KorekturyAktualniListView): | |||
| 	# {% regroup %} potřebuje dostat správně setříděné názvy, aby nedělal duplikáty | ||||
| 	def get_queryset(self, *args, **kwargs): | ||||
| 		qs = super().get_queryset(**kwargs) | ||||
| 		return qs.order_by('nazev') | ||||
| 		return reversed(sorted(qs, key=lambda it: it.cislo_a_tema)) | ||||
| 
 | ||||
| ### Korektury | ||||
| class KorekturyView(generic.TemplateView): | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue