I´m having 2 models:

class CinemaProgram(models.Model):
     cinema = models.ForeignKey(Cinema)
     movie = models.ForeignKey(Movie, raw_id_admin=True)
     ....

class CinemaProgramDate(models.Model):
     cinemaprogram = models.ForeignKey(CinemaProgram,  
edit_inline=models.TABULAR, num_in_admin=20, max_num_in_admin=200,  
num_extra_on_change=100)
     screening_date = models.DateField('Screening Date', core=True)
     screening_time = models.TimeField('Screening Time', core=True)
     add_screen = models.CharField('Screen', maxlength=50,  
blank=True, null=True)
     ....

for the template, I´d like to have something like this:

{% for cinema in cinema_list %}
     {{ cinema }}
     {% for screens in cinema %}
         {{ screen }}
         {% for screening_time in screens %}
             {{ screening_time }}
         {% endfor %}
     {% endfor %}
{% endfor %}

Now, my question is: how do I get/construct the dict for this template?

Note: The output should be:

Movie XXX on Date YYY is shown in these Cinemas:
Cinema 1
Screen 1: 18:00 20:00 23:00
Screen 2: 20:00
Cinema 2
Screen 1: 18:30
Cinema 3
Screen 1: 20:00
Screen 4: 22:30

I don´t really know if I need a custom manager or a custom method or  
if I have to refactor my models.

any hints are really appreciated (I´ve been working on this one for a  
couple of days and it´s getting frustrating ...).

so far, I´ve been using this one:
movie_list = CinemaProgramDate.objects.filter 
(cinemaprogram__cinema__place_state__slug=state, screening_date=date,  
cinemaprogram__movie=movie_id).select_related().order_by 
('cinemas_cinema.name', 'add_screen')

with what I get here, I´m not able to do the template accordingly  
(because I´d need an {% ifnotchanged %} which doesn´t exist).

well, enough for now - I hope somebody has the time to help me with  
this.

Thanks,
patrick
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to