also attaching relevant parts of view.py:

  movpagin = Paginator(movies, 12)

    page = int(request.GET.get('page','1'))
    try:
        moviesp = movpagin.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        moviesp = movpagin.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of
results.
        moviesp = movpagin.page(movpagin.num_pages)

    actpagin = Paginator(actors, 8)

    page = int(request.GET.get('page','1'))
    try:
        actp = actpagin.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        actp = actpagin.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of
results.
        actp = actpagin.page(actpagin.num_pages)
    cntx = RequestContext(request,{
        'actors':actp,
        'movies' : moviesp,
    })
    return render_to_response('display.html',cntx)


On 7 ספטמבר, 08:54, OC <sag...@gmail.com> wrote:
> I am familiar with js but not with ajax
> I thought that django supports these kind of matters ... isnt it
> trivial?
>
> Attached the code
> Please advise
>
> {% for movie in movies.object_list %#}
>                 <div id={% cycle "white_stripe" "blue_stripe" %}>
>                                        <span class={%cycle
> "whitestripe" "bluestripe" %}>{{movie.name}} </span>
>                   </div>
>
>                 {% endfor %}
>
>                 <div id="pagination_left">
>                         <!-- HANDLE PREV ARROW -->
>                         {% if movies.has_previous %}
>                                 <a href="?
> page={{ movies.previous_page_number }}"><img src="{{ MEDIA_URL }}
> images/preview.png"></a>
>                         {% else %}
>                                 <img src="{{ MEDIA_URL }}images/
> preview.png" style="opacity:0.4;filter:alpha(opacity=40)">
>                         {% endif %}
>
>                         <!-- HANDLE PAGE NUMBERS-->
>                         {% for page_number in
> movies.paginator.page_range %}
>                                 {% if page_number == movies.number %}
>                                         <span
> class="pagination_current">{{ movies.number }}</span>
>                                 {% else %}
>                                         <a href="?
> page={{ page_number }}">{{ page_number }}</a>
>                                 {% endif %}
>                         {% endfor %}
>
>                       <!-- HANDLE NEXT ARROW -->
>                         {% if movies.has_next %}
>                                 <a href="?
> page={{ movies.next_page_number}}"><img src="{{ MEDIA_URL }}images/
> next.png"></a>
>                         {% else %}
>                                 <img src="{{ MEDIA_URL }}images/
> next.png" style="opacity:0.4;filter:alpha(opacity=40)">
>                         {% endif %}
>                 </div>
>         </div>
>
>             {% for actor in actors.object_list %}
>                         {% load parseval %}
>                                 {% autoescape off %}
>                         <div id="right_boxes"><a href="/
> {{ actor.name }}"></a>
>                                 <div id="right_box_head">
>                                         <div
> id="box_header">{{ actor.pt|upper }}</div>
>                                 </div>
>                         </div>
>                                 {% endautoescape %}
>                 {% empty %}
>                 {% endfor %}
>          <div id="pagination_right">
>                         <!-- HANDLE PREV ARROW -->
>                         {% if actors.has_previous %}
>                                 <a href="?
> page={{ actors.previous_page_number }}"><img src="{{ MEDIA_URL }}
> images/preview.png"></a>
>                         {% else %}
>                                 <img src="{{ MEDIA_URL }}images/
> preview.png" style="opacity:0.4;filter:alpha(opacity=40)">
>                         <!-- HANDLE PAGE NUMBERS-->
>                         {% for page_number in
> actors.paginator.page_range %}
>                                 {% if page_number == actors.number %}
>                                         <span
> class="pagination_current">{{ actors.number }}</span>
>                                 {% else %}
>                                         <a href="?
> page={{ page_number }}">{{ page_number }}</a>
>                                 {% endif %}
>                         {% endfor %}
>                         <!-- HANDLE NEXT ARROW -->
>                         {% if actors.has_next %}
>                                 <a href="?
> page={{ actors.next_page_number}}"><img src="{{ MEDIA_URL }}images/
> next.png"></a>
>                         {% else %}
>                                 <img src="{{ MEDIA_URL }}images/
> next.png" style="opacity:0.4;filter:alpha(opacity=40)">
>                         {% endif %}
>                 </div>
>
> On 6 ספטמבר, 17:41, Yaşar Arabacı <yasar11...@gmail.com> wrote:
>
>
>
> > I think your question can be solved with javascript and ajax, ratherthan
> > with django. How is your knowledge in that area?
>
> > 2011/9/6 OC <sag...@gmail.com>
>
> > > Hi,
>
> > > I am new to django and I have apaginationquestion:
> > > In my web page I need to display 2 query results of two different
> > > tables
> > > Each result is displayed in a different div in the same page.
>
> > > How can I implement "multiple"paginationmeaning that each result is
> > > displayed in its own panel and has its own previous and next buttons
> > > but doesn't affect the other's query result?
>
> > > For instance - I have a panel of movies, display 10 each time, and
> > > have a prev and next buttons dedicated to the movies only
> > > Plus
> > > In the same page, I have a panel of actors, display 10 each time, and
> > > have a prev and next buttons dedicated to the actors only
>
> > > My current (wrong) implementation is
> > > usepaginationfor the both of them but when pressing the next/
> > > previous button ofone- it affects (as expected) the display of the
> > > otheronebecause the entire page has changed.
>
> > > Thanks in advance,
> > > Osnat
>
> > > --
> > > 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
> > > django-users+unsubscr...@googlegroups.com.
> > > Formoreoptions, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> > --http://yasar.serveblog.net/-הסתר טקסט מצוטט-
>
> > -הראה טקסט מצוטט--הסתר טקסט מצוטט-
>
> -הראה טקסט מצוטט-

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to