Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. #show.html
  2. {% for showtime in showtimes %}
  3. <div class="row">
  4. <div class="medium-11 medium-centered columns">
  5. <div class="panel callout radius">
  6. Кинотеатр: {{ showtime.showtime_place }}<br>
  7. Дата: {{ showtime.showtime_dates }}<br>
  8. Время: {{ showtime.showtime_times }}<br>
  9. Формат: {{ showtime.showtime_format }}<br>
  10. </div>
  11. </div>
  12. </div>
  13. {% endfor %}
  14.  
  15. #models.py
  16. class Showtime(models.Model):
  17. showtime_dates = models.CharField('Date', max_length=30)
  18. showtime_times = models.CharField('Time', max_length=30)
  19. showtime_format = models.CharField('Format', max_length=4, blank=True)
  20. showtime_place = models.ForeignKey('app_places.place', verbose_name='Place')
  21. showtime_show = models.ForeignKey(Show, verbose_name='Show name')
  22.  
  23. #views.py
  24. def show(request, show_id=1):
  25. return render_to_response('app_shows_and_times/show.html',
  26. {'show': Show.objects.get(id=show_id),
  27. 'showtimes': Showtime.objects.filter(showtime_show_id=show_id)})
  28.  
  29. ID…|……………..Date………………|…….Time | Format | showtime_place_id | showtime_show_id
  30. 122,“30 августа, сегодня”, .|……19:00,…..2D,…………………2,…………………….5
  31. 123,“30 августа, сегодня”, .|……23:20,…..2D,…………………2,…………………….5
  32. 124,“31 августа, понедельник”,|.12:20,…..2D,…………………2,…………………….5
  33. 125,“31 августа, понедельник”,|.17:00,…..2D,…………………2,…………………….5
  34.  
  35. {% regroup showtimes by showtime.showtime_place as cinema_place %}
  36. <ul>
  37. {% for showtime.showtime_place in cinema_place %}
  38. <li>
  39. {{ showtime.showtime_place.grouper }}
  40. <ul>
  41. {% for item in showtime.showtime_place.list %}
  42. <li>
  43. {{ item.showtime.showtime_dates }}: {{ item.showtime.showtime_times }}
  44. </li>
  45. {% endfor %}
  46. </ul>
  47. </li>
  48. {% endfor %}
  49. </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement