|
|
@ -30,7 +30,7 @@ def obrazek_filename_velky(): |
|
|
|
|
|
|
|
def obrazek_filename(self, filename): |
|
|
|
gal = self.galerie |
|
|
|
cislo_gal = force_unicode(gal.pk) |
|
|
|
cislo_gal = gal.pk |
|
|
|
|
|
|
|
# najdi kořenovou galerii |
|
|
|
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ří |
|
|
|
cesta = ( |
|
|
|
['Galerie'] + |
|
|
|
(["soustredeni_" + force_unicode(gal.soustredeni.pk)] if gal.soustredeni else []) + |
|
|
|
["galerie_" + cislo_gal, force_unicode(self.nazev)] |
|
|
|
(["soustredeni_" + gal.soustredeni.pk] if gal.soustredeni else []) + |
|
|
|
["galerie_" + cislo_gal, self.nazev] |
|
|
|
) |
|
|
|
|
|
|
|
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) |
|
|
|
poradi = models.IntegerField('Pořadí', blank=True, null=True) |
|
|
|
|
|
|
|
def __unicode__(self): |
|
|
|
return unicode(self.obrazek_velky.name) |
|
|
|
def __str__(self): |
|
|
|
return self.obrazek_velky.name |
|
|
|
|
|
|
|
class Meta: |
|
|
|
verbose_name = 'Obrázek' |
|
|
@ -94,7 +94,7 @@ class Galerie(models.Model): |
|
|
|
on_delete=models.PROTECT) |
|
|
|
poradi = models.IntegerField('Pořadí', blank = True, null = True) |
|
|
|
|
|
|
|
def __unicode__(self): |
|
|
|
def __str__(self): |
|
|
|
return self.nazev |
|
|
|
class Meta: |
|
|
|
verbose_name = 'Galerie' |
|
|
|