Organizatori | ListView + template
Nutno pak dostylovat podle vzhledu. Zaklad zobrazovanych informaci. Nutno rozdelit na aktivni a neaktivni a to idealne tak, ze template bude jeden a list se zpravne zkompetuje ve view.
This commit is contained in:
parent
8241a25337
commit
3a8f2ec35e
4 changed files with 53 additions and 3 deletions
20
seminar/migrations/0025_zmena_cesty_nahravani_obrazku.py
Normal file
20
seminar/migrations/0025_zmena_cesty_nahravani_obrazku.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('seminar', '0024_add_organizator'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='organizator',
|
||||
name='foto',
|
||||
field=models.ImageField(help_text=b'Vlo\xc5\xbe fotografii organiz\xc3\xa1tora o libovon\xc3\xa9 velikosti', upload_to=b'image_organizatori/velke/%Y/', null=True, verbose_name=b'Fotografie organiz\xc3\xa1tora', blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -681,7 +681,7 @@ class Organizator(models.Model):
|
|||
strucny_popis_organizatora = models.TextField('Stručný popis organizátora',
|
||||
null = True, blank = True)
|
||||
foto = models.ImageField('Fotografie organizátora',
|
||||
upload_to='image_organizatori/%Y/', null = True, blank = True,
|
||||
upload_to='image_organizatori/velke/%Y/', null = True, blank = True,
|
||||
help_text = 'Vlož fotografii organizátora o libovoné velikosti')
|
||||
foto_male = models.ImageField(upload_to='image_organizatori/male/%Y/',
|
||||
null = True, blank = True, editable = False)
|
||||
|
|
|
@ -4,6 +4,35 @@
|
|||
<div>
|
||||
<h2>Organizátoři</h2>
|
||||
|
||||
{% for org in object_list %}
|
||||
{{org.user.first_name}}
|
||||
{% if org.prezdivka %}
|
||||
"{{org.prezdivka}}"
|
||||
{% endif %}
|
||||
{{org.user.last_name}} <br>
|
||||
<ul>
|
||||
{% if org.organizuje_od_roku %}
|
||||
<li>Organizuje od roku: {{org.organizuje_od_roku}}
|
||||
{% endif %}
|
||||
{% if org.organizuje_do_roku %}
|
||||
<li>Organizuje do roku: {{org.organizuje_do_roku}}
|
||||
{% endif %}
|
||||
{% if org.studuje %}
|
||||
<li>Studuje: {{org.studuje}}
|
||||
{% endif %}
|
||||
{% if org.user.email %}
|
||||
<li>Pošta: {{org.user.email}}
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% if org.foto %}
|
||||
<div class="foto_org">
|
||||
<img src="{{org.foto.url}}" height="{{org.foto.height}}">
|
||||
<img src="{{org.foto_male.url}}" height="{{org.foto_male.height}}"
|
||||
</div>
|
||||
{% endif %}
|
||||
<hr>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.views import generic
|
|||
from django.utils.translation import ugettext as _
|
||||
from django.http import Http404
|
||||
|
||||
from .models import Problem, Cislo, Reseni, VysledkyKCislu, Nastaveni, Rocnik, Soustredeni
|
||||
from .models import Problem, Cislo, Reseni, VysledkyKCislu, Nastaveni, Rocnik, Soustredeni, Organizator
|
||||
|
||||
|
||||
def AktualniZadaniView(request):
|
||||
|
@ -17,7 +17,8 @@ def AktualniZadaniView(request):
|
|||
|
||||
# Co je M&M
|
||||
|
||||
class CojemamOrganizatoriView(generic.TemplateView):
|
||||
class CojemamOrganizatoriView(generic.ListView):
|
||||
model = Organizator
|
||||
template_name='seminar/cojemam/organizatori.html'
|
||||
|
||||
class CislaView(generic.ListView):
|
||||
|
|
Loading…
Reference in a new issue