Am 02.05.2007 um 18:43 schrieb [EMAIL PROTECTED]:

>
> You didn't post your full model code ... I didn't see anything about
> auditoriums in it :)  ... can you post the relevant part of your model
> for that?

sorry, I used the term "auditorium" for better understanding -  
nothing about that in the models.

> So you are basically trying to list movie times/cinema for each
> movie..right?

yes, a list of cinemas (order by cinema-names) with a sub-list of  
movie-times for each cinema,
where each screen has it´s own row (see screenshot form the previous  
posting).

> W/out knowing your exact model code...what you have in your py file
> should work based on what you had above.
>
> 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')
>
> Then this in your template something like this: ( you had a for loop
> for your add_screen, but I don't see that it's a one to many
> relationship... so that didn't seem to be needed unless I missed
> something )

I´m not having a for-loop for the screens ...

>
> {% for movie in movie_list %}
>
>                           {% if not forloop.first %}
>                               </td></tr></tbody></table>
>                           {% endif %}
>                           <table class="schedule listing_cinemas {%
> cycle bg1,bg2 %}" style="background-color: {% cycle #FCFBFA,#F2F1F0
> %};"><thead>
>
>                           <!-- go thru each cinema program related to
> this movie -->
>                           {% for cinemaprogram in
> movie.cinemaprogram_set.all %}
>                           <tr><th colspan="2">
>                               <h3><a href="/kino/
>                                {{ movie.cinemaprogram.cinema.id }}/">
>                                {{ movie.cinemaprogram.cinema }}</a>,
>                                {{ movie.cinemaprogram.cinema.place_state 
> }}</h3>
>                               <a href="{{ path }}kino/
>                                {{ movie.cinemaprogram.cinema.id }}/" 
> class="right listall
>                                small">Andere Filme in diesem Kino</a>
>                           </th></tr>
>                           {% endfor %}
>                           </thead><tbody>
>
>
>                           <tr><td class="label light">Saal
>                           {% if movie.add_screen %}
>                               {{ movie.add_screen }}
>                           {% else %}
>                               k.A.
>                           {% endif %}
>                           </td><td class="ight">
>
>                                       {{ movie.screening_time|
> time:"H:i" }}&nbsp;&nbsp;
>                       {% if forloop.last %}
>                               {% ifequal forloop.counter 1 %}</td></tr>
>                               {% endifequal %}</tbody></table>
>                       {% endif %}
>  {% endfor %}


if I follow your template-code I´m getting this output:
Screen1: 18:00
Screen1: 20:00
Screen1: 22:00
Screen2: 18:00

instead of:
Screen1: 18:00 20:00 22:00
Screen2: 18:00

thanks,
patrick


>
>
> On May 2, 12:15 pm, "va:patrick.kranzlmueller"
> <[EMAIL PROTECTED]> wrote:
>> here´s an example of how the page should look like:http:// 
>> www.skip.at/AT/kinoprogramm/abfrage/prog_film.php?
>> blnr=1&ort=0&wochtag=3&wahl_tag=02.+05.&filmnr=9315&filmtitel=Das
>> +wilde+Leben
>>
>> (we´re just redesigning that page using django)
>>
>> patrick
>>
>> Am 02.05.2007 um 17:47 schrieb [EMAIL PROTECTED]:
>>
>>
>>
>>> Oops... that should have been
>>
>>>   {{ screens.screening_date }}
>>>   {{ screens.screening_time }}
>>
>>> Forgot the 's'.
>>
>>> If this isn't quite what you mean...let me know... I may have
>>> misunderstood what you were looking for.
>>
>>> On May 2, 11:44 am, "[EMAIL PROTECTED]"
>>> <[EMAIL PROTECTED]> wrote:
>>>> You should be able to do something like this:
>>
>>>> {% for cinema in cinema_list %}
>>>>       {{ cinema }}
>>>>       {% for screens in cinema.cinemaprogram_set.all %}
>>>>           {{ screen.screening_date }}
>>>>           {{ screen.screening_time }}
>>>>       {% endfor %}
>>>>  {% endfor %}
>>
>>>> Go to this page:http://www.djangoproject.com/documentation/db-api/
>>>> and check out the one-to-many relationships, backward section.
>>
>>>> va:patrick.kranzlmueller wrote:
>>>>> 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