Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #show.html
- {% for showtime in showtimes %}
- <div class="row">
- <div class="medium-11 medium-centered columns">
- <div class="panel callout radius">
- Кинотеатр: {{ showtime.showtime_place }}<br>
- Дата: {{ showtime.showtime_dates }}<br>
- Время: {{ showtime.showtime_times }}<br>
- Формат: {{ showtime.showtime_format }}<br>
- </div>
- </div>
- </div>
- {% endfor %}
- #models.py
- class Showtime(models.Model):
- showtime_dates = models.CharField('Date', max_length=30)
- showtime_times = models.CharField('Time', max_length=30)
- showtime_format = models.CharField('Format', max_length=4, blank=True)
- showtime_place = models.ForeignKey('app_places.place', verbose_name='Place')
- showtime_show = models.ForeignKey(Show, verbose_name='Show name')
- #views.py
- def show(request, show_id=1):
- return render_to_response('app_shows_and_times/show.html',
- {'show': Show.objects.get(id=show_id),
- 'showtimes': Showtime.objects.filter(showtime_show_id=show_id)})
- ID…|……………..Date………………|…….Time | Format | showtime_place_id | showtime_show_id
- 122,“30 августа, сегодня”, .|……19:00,…..2D,…………………2,…………………….5
- 123,“30 августа, сегодня”, .|……23:20,…..2D,…………………2,…………………….5
- 124,“31 августа, понедельник”,|.12:20,…..2D,…………………2,…………………….5
- 125,“31 августа, понедельник”,|.17:00,…..2D,…………………2,…………………….5
- {% regroup showtimes by showtime.showtime_place as cinema_place %}
- <ul>
- {% for showtime.showtime_place in cinema_place %}
- <li>
- {{ showtime.showtime_place.grouper }}
- <ul>
- {% for item in showtime.showtime_place.list %}
- <li>
- {{ item.showtime.showtime_dates }}: {{ item.showtime.showtime_times }}
- </li>
- {% endfor %}
- </ul>
- </li>
- {% endfor %}
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement