galerie | neznovuukladani fotek
ukladani fotek podle cesty, ktera by se mela tvorit uz ve spravnem poradi nezobrazovani komentare None
This commit is contained in:
parent
b1cf79271f
commit
50dfb8484f
2 changed files with 13 additions and 6 deletions
|
@ -35,7 +35,7 @@ def obrazek_filename_obecny(self, filename, typ):
|
||||||
gal = self.galerie
|
gal = self.galerie
|
||||||
cesta = ""
|
cesta = ""
|
||||||
while(not gal.soustredeni):
|
while(not gal.soustredeni):
|
||||||
cesta = os.path.join(cesta, force_unicode(gal.nazev))
|
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', force_unicode(gal.soustredeni), cesta, typ, force_unicode(self.nazev))
|
||||||
|
|
||||||
|
@ -59,8 +59,10 @@ class Obrazek(models.Model):
|
||||||
def save(self):
|
def save(self):
|
||||||
original = Image.open(self.obrazek_velky)
|
original = Image.open(self.obrazek_velky)
|
||||||
jmeno = os.path.basename(self.obrazek_velky.file.name)
|
jmeno = os.path.basename(self.obrazek_velky.file.name)
|
||||||
Obrazek._vyrobMiniaturu(original, jmeno, 500, self.obrazek_stredni)
|
if not self.obrazek_stredni:
|
||||||
Obrazek._vyrobMiniaturu(original, jmeno, 200, self.obrazek_maly)
|
Obrazek._vyrobMiniaturu(original, jmeno, 500, self.obrazek_stredni)
|
||||||
|
if not self.obrazek_maly:
|
||||||
|
Obrazek._vyrobMiniaturu(original, jmeno, 200, self.obrazek_maly)
|
||||||
super(Obrazek, self).save()
|
super(Obrazek, self).save()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -41,11 +41,16 @@
|
||||||
{% if preview %}
|
{% if preview %}
|
||||||
<form action=".#obsah" method="post">
|
<form action=".#obsah" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{form}}
|
<table>
|
||||||
<input name="odeslat" type="submit" value="Změň komentář">
|
<tr><td><label>Aktuální komentář:</label></td><td>{{obrazek.popis}}</td>
|
||||||
|
{{form.as_table}}
|
||||||
|
<tr><td></td><td><input name="odeslat" type="submit" value="Změň komentář"></td></tr>
|
||||||
|
</table>
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{obrazek.popis}}
|
{% if obrazek.popis %}
|
||||||
|
{{obrazek.popis}}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue