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
|
||||
cesta = ""
|
||||
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
|
||||
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):
|
||||
original = Image.open(self.obrazek_velky)
|
||||
jmeno = os.path.basename(self.obrazek_velky.file.name)
|
||||
Obrazek._vyrobMiniaturu(original, jmeno, 500, self.obrazek_stredni)
|
||||
Obrazek._vyrobMiniaturu(original, jmeno, 200, self.obrazek_maly)
|
||||
if not self.obrazek_stredni:
|
||||
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()
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -41,11 +41,16 @@
|
|||
{% if preview %}
|
||||
<form action=".#obsah" method="post">
|
||||
{% csrf_token %}
|
||||
{{form}}
|
||||
<input name="odeslat" type="submit" value="Změň komentář">
|
||||
<table>
|
||||
<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>
|
||||
{% else %}
|
||||
{{obrazek.popis}}
|
||||
{% if obrazek.popis %}
|
||||
{{obrazek.popis}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue