Novinky: obrázky jsou klikatelné
This commit is contained in:
parent
8196108b36
commit
6a8db788f0
3 changed files with 21 additions and 8 deletions
|
@ -437,7 +437,7 @@ div.zadani_azad_termin {
|
||||||
float: none;
|
float: none;
|
||||||
width: 70%;
|
width: 70%;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto
|
margin-right: auto;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -649,3 +649,11 @@ div.zadani_azad_termin {
|
||||||
float: right;
|
float: right;
|
||||||
max-width: 42%;
|
max-width: 42%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.novinka_obrazek img {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.novinka_obrazek {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
|
@ -757,6 +757,12 @@ class Novinky(models.Model):
|
||||||
text = models.TextField('Text novinky', blank=True, null=True)
|
text = models.TextField('Text novinky', blank=True, null=True)
|
||||||
obrazek = models.ImageField('Obrázek', upload_to='image_novinky/%Y/%m/%d/',
|
obrazek = models.ImageField('Obrázek', upload_to='image_novinky/%Y/%m/%d/',
|
||||||
null=True, blank=True)
|
null=True, blank=True)
|
||||||
|
obrazek_maly = ImageSpecField(source='obrazek',
|
||||||
|
processors=[
|
||||||
|
ResizeToFit(350, 200, upscale=False)
|
||||||
|
],
|
||||||
|
options={'quality': 95})
|
||||||
|
|
||||||
autor = models.ForeignKey(settings.AUTH_USER_MODEL,
|
autor = models.ForeignKey(settings.AUTH_USER_MODEL,
|
||||||
verbose_name='Autor novinky')
|
verbose_name='Autor novinky')
|
||||||
zverejneno = models.BooleanField('Zveřejněno', default="False")
|
zverejneno = models.BooleanField('Zveřejněno', default="False")
|
||||||
|
|
|
@ -7,15 +7,14 @@
|
||||||
{{ novinka.text | safe }}
|
{{ novinka.text | safe }}
|
||||||
{# obrazek #}
|
{# obrazek #}
|
||||||
{% if novinka.obrazek %}
|
{% if novinka.obrazek %}
|
||||||
<div>
|
<div class='novinka_obrazek'>
|
||||||
<img src='{{novinka.obrazek.url}}'
|
{% if novinka.obrazek.height > novinka.obrazek_maly.height %}
|
||||||
height='
|
<a href='{{ novinka.obrazek.url }}'>
|
||||||
{% if novinka.obrazek.height > 200 %} {# vyska obrazku natvrdo #}
|
<img src='{{ novinka.obrazek.url }}' height='{{ novinka.obrazek_maly.height }}'>
|
||||||
200
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{novinka.obrazek.height}}
|
<img src='{{ novinka.obrazek.url }}' height='{{ novinka.obrazek_maly.height }}'>
|
||||||
{% endif%}
|
{% endif%}
|
||||||
'>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# autor #}
|
{# autor #}
|
||||||
|
|
Loading…
Reference in a new issue