galerie | zmena cest na ukladani souboru rozumneji

This commit is contained in:
Bc. Petr Pecha 2015-10-13 19:00:37 +02:00
parent bd01182b2e
commit f3bf6d5300
2 changed files with 3 additions and 2 deletions

View file

@ -3,6 +3,7 @@
|======| |======|
Aktualni Aktualni
* co s titulni fotkou
* do CSS * do CSS
* nahledy * nahledy
* nastylovat tabulku s nahledy * nastylovat tabulku s nahledy

View file

@ -62,11 +62,11 @@ def obrazek_filename_maly(self, filename):
def obrazek_filename_obecny(self, filename, typ): def obrazek_filename_obecny(self, filename, typ):
gal = self.galerie gal = self.galerie
cislo_gal = force_unicode(gal.pk)
cesta = "" cesta = ""
while(not gal.soustredeni): while(not gal.soustredeni):
cesta = os.path.join(force_unicode(gal.nazev), cesta)
gal = gal.galerie_up gal = gal.galerie_up
return os.path.join('Galerie', force_unicode(gal.soustredeni), cesta, typ, force_unicode(self.nazev)) return os.path.join('Galerie', "soustredeni_" + force_unicode(gal.soustredeni.pk), "galerie_" + cislo_gal, typ, force_unicode(self.nazev))
class Obrazek(models.Model): class Obrazek(models.Model):
obrazek_velky = models.ImageField(upload_to=obrazek_filename, obrazek_velky = models.ImageField(upload_to=obrazek_filename,