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;
|
||||
width: 70%;
|
||||
margin-left: auto;
|
||||
margin-right: auto
|
||||
margin-right: auto;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -649,3 +649,11 @@ div.zadani_azad_termin {
|
|||
float: right;
|
||||
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)
|
||||
obrazek = models.ImageField('Obrázek', upload_to='image_novinky/%Y/%m/%d/',
|
||||
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,
|
||||
verbose_name='Autor novinky')
|
||||
zverejneno = models.BooleanField('Zveřejněno', default="False")
|
||||
|
|
|
@ -7,15 +7,14 @@
|
|||
{{ novinka.text | safe }}
|
||||
{# obrazek #}
|
||||
{% if novinka.obrazek %}
|
||||
<div>
|
||||
<img src='{{novinka.obrazek.url}}'
|
||||
height='
|
||||
{% if novinka.obrazek.height > 200 %} {# vyska obrazku natvrdo #}
|
||||
200
|
||||
<div class='novinka_obrazek'>
|
||||
{% if novinka.obrazek.height > novinka.obrazek_maly.height %}
|
||||
<a href='{{ novinka.obrazek.url }}'>
|
||||
<img src='{{ novinka.obrazek.url }}' height='{{ novinka.obrazek_maly.height }}'>
|
||||
</a>
|
||||
{% else %}
|
||||
{{novinka.obrazek.height}}
|
||||
<img src='{{ novinka.obrazek.url }}' height='{{ novinka.obrazek_maly.height }}'>
|
||||
{% endif%}
|
||||
'>
|
||||
</div>
|
||||
{% endif %}
|
||||
{# autor #}
|
||||
|
|
Loading…
Reference in a new issue