|
@ -30,7 +30,7 @@ def obrazek_filename_velky(): |
|
|
|
|
|
|
|
|
def obrazek_filename(self, filename): |
|
|
def obrazek_filename(self, filename): |
|
|
gal = self.galerie |
|
|
gal = self.galerie |
|
|
cislo_gal = force_unicode(gal.pk) |
|
|
cislo_gal = gal.pk |
|
|
|
|
|
|
|
|
# najdi kořenovou galerii |
|
|
# najdi kořenovou galerii |
|
|
while (gal.galerie_up): |
|
|
while (gal.galerie_up): |
|
@ -39,8 +39,8 @@ def obrazek_filename(self, filename): |
|
|
# soustředění je v cestě jen pokud galerie pod nějaké patří |
|
|
# soustředění je v cestě jen pokud galerie pod nějaké patří |
|
|
cesta = ( |
|
|
cesta = ( |
|
|
['Galerie'] + |
|
|
['Galerie'] + |
|
|
(["soustredeni_" + force_unicode(gal.soustredeni.pk)] if gal.soustredeni else []) + |
|
|
(["soustredeni_" + gal.soustredeni.pk] if gal.soustredeni else []) + |
|
|
["galerie_" + cislo_gal, force_unicode(self.nazev)] |
|
|
["galerie_" + cislo_gal, self.nazev] |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
return os.path.join(*cesta) |
|
|
return os.path.join(*cesta) |
|
@ -60,8 +60,8 @@ class Obrazek(models.Model): |
|
|
galerie = models.ForeignKey('Galerie', blank=True, null=True, on_delete=models.SET_NULL) |
|
|
galerie = models.ForeignKey('Galerie', blank=True, null=True, on_delete=models.SET_NULL) |
|
|
poradi = models.IntegerField('Pořadí', blank=True, null=True) |
|
|
poradi = models.IntegerField('Pořadí', blank=True, null=True) |
|
|
|
|
|
|
|
|
def __unicode__(self): |
|
|
def __str__(self): |
|
|
return unicode(self.obrazek_velky.name) |
|
|
return self.obrazek_velky.name |
|
|
|
|
|
|
|
|
class Meta: |
|
|
class Meta: |
|
|
verbose_name = 'Obrázek' |
|
|
verbose_name = 'Obrázek' |
|
@ -94,7 +94,7 @@ class Galerie(models.Model): |
|
|
on_delete=models.PROTECT) |
|
|
on_delete=models.PROTECT) |
|
|
poradi = models.IntegerField('Pořadí', blank = True, null = True) |
|
|
poradi = models.IntegerField('Pořadí', blank = True, null = True) |
|
|
|
|
|
|
|
|
def __unicode__(self): |
|
|
def __str__(self): |
|
|
return self.nazev |
|
|
return self.nazev |
|
|
class Meta: |
|
|
class Meta: |
|
|
verbose_name = 'Galerie' |
|
|
verbose_name = 'Galerie' |
|
|