Gotcha, you are filtering the QuerySet in Django, returning to client, and
further filtering with jQuery. Makes sense now. :-)

Happy Coding!

Furbee

On Wed, Mar 14, 2012 at 2:11 PM, Larry Martell <larry.mart...@gmail.com>wrote:

> On Tue, Mar 13, 2012 at 4:26 PM, Furbee <furbeena...@gmail.com> wrote:
> > Oh, you are filtering in the template, using Django, sorry. I thought you
> > meant you pass it to the template and use jQuery to filter. My bad. :-)
>
> I am filtering in the template using jQuery.
>
> >
> > Cheers
> >
> >
> > On Tue, Mar 13, 2012 at 3:25 PM, Furbee <furbeena...@gmail.com> wrote:
> >>
> >> Aha! Very nice. As a sidebar, you said you pass the filter string back
> to
> >> the template so it can apply filtering on the new data set. This makes
> me
> >> think that filtering is being done on the entire data set from the
> browser,
> >> instead of the server. Maybe I misunderstood, but if so, I would suggest
> >> filtering the data on Django's end and simply returning the filtered
> >> QuerySet. This may make the page load faster and would be scalable for
> >> larger lists where lots of records are being filtered by the client
> browser.
> >>
> >>
> >> On Tue, Mar 13, 2012 at 3:01 PM, Larry Martell <larry.mart...@gmail.com
> >
> >> wrote:
> >>>
> >>> On Tue, Mar 13, 2012 at 3:53 PM, Furbee <furbeena...@gmail.com> wrote:
> >>> > Gotcha, I was unclear. You can have jQuery modify the URL without
> >>> > actually
> >>> > requesting the page from the webserver, I thought that was what you
> >>> > meant.
> >>> > This comes in handy when you want to use javascript to update the URL
> >>> > without requesting a new page from the server in case the user hits
> F5
> >>> > or
> >>> > refreshes the page, it will request the updated URL instead of the
> >>> > original.
> >>> >
> >>> > So, you can do this as you mentioned, or you can parse the
> request.GET
> >>> > dictionary and return them as variables to the template from the
> view.
> >>>
> >>> There's a 'live filtering' function on the page. It's text field with
> >>> a keyup event handler. Each time the field gets updated the data
> >>> currently on the screen is filtered, and the URL is updated to include
> >>> the current filter string so that when the user pages forward or
> >>> backwards through the data (which is a return back to the server), the
> >>> filter string can get passed back into the template so it can apply
> >>> the filtering on the new data set
> >>>
> >>>
> >>> > On Tue, Mar 13, 2012 at 2:42 PM, Larry Martell
> >>> > <larry.mart...@gmail.com>
> >>> > wrote:
> >>> >>
> >>> >> On Tue, Mar 13, 2012 at 3:33 PM, Furbee <furbeena...@gmail.com>
> wrote:
> >>> >> > Good deal, but if you send the page to the client, then jQuery
> >>> >> > updates
> >>> >> > the
> >>> >> > URL, the {{ request.get_full_path }} is still only able to have
> the
> >>> >> > original
> >>> >> > URL that was requested. Once the page is sent to the client,
> >>> >> > Django/Python
> >>> >> > is done and cannot manipulate the page, unless you are using AJAX
> to
> >>> >> > get
> >>> >> > updated details.
> >>> >>
> >>> >> When the URL that gets updated by jQuery is clicked on, it goes back
> >>> >> to Django/Python and the {{ request.get_full_path }} gets updated.
> >>> >>
> >>> >>
> >>> >> > On Tue, Mar 13, 2012 at 2:23 PM, Larry Martell
> >>> >> > <larry.mart...@gmail.com>
> >>> >> > wrote:
> >>> >> >>
> >>> >> >> On Tue, Mar 13, 2012 at 2:19 PM, Furbee <furbeena...@gmail.com>
> >>> >> >> wrote:
> >>> >> >> > Hi Larry,
> >>> >> >> >
> >>> >> >> > render_to_response is one of many ways to return an
> HttpResponse
> >>> >> >> > to
> >>> >> >> > send
> >>> >> >> > to
> >>> >> >> > the client. Wherever your view does the return, you can pass
> >>> >> >> > these
> >>> >> >> > GET
> >>> >> >> > variables.
> >>> >> >> >
> >>> >> >> > However, if they are being generated by jQuery, dynamically,
> you
> >>> >> >> > should
> >>> >> >> > be
> >>> >> >> > using jQuery/javascript to read them and deal with them. This
> >>> >> >> > should
> >>> >> >> > be
> >>> >> >> > client side javascript code. To read the current URL string in
> >>> >> >> > jQuery, I
> >>> >> >> > found a nice little article
> >>> >> >> >
> >>> >> >> >
> >>> >> >> >
> >>> >> >> > at
> http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html
>  which
> >>> >> >> > should demonstrate how to get these in javascript on the
> >>> >> >> > client-side
> >>> >> >> > browser.
> >>> >> >>
> >>> >> >> I was able to get the entire URL with {{ request.get_full_path }}
> >>> >> >>
> >>> >> >> But thanks for the link - looks like it could be very useful in
> the
> >>> >> >> future.
> >>> >> >>
> >>> >> >>
> >>> >> >> > On Tue, Mar 13, 2012 at 11:57 AM, Larry Martell
> >>> >> >> > <larry.mart...@gmail.com>
> >>> >> >> > wrote:
> >>> >> >> >>
> >>> >> >> >> On Tue, Mar 13, 2012 at 12:38 PM, Furbee <
> furbeena...@gmail.com>
> >>> >> >> >> wrote:
> >>> >> >> >> > I think you want to actually get these in the view code and
> >>> >> >> >> > pass
> >>> >> >> >> > them
> >>> >> >> >> > to
> >>> >> >> >> > the
> >>> >> >> >> > template as named variables. For example:
> >>> >> >> >> >
> >>> >> >> >> >     return render_to_response('page.htm',
> >>> >> >> >> > {'date_time': request.GET['date_time'], 'submit_preview':
> >>> >> >> >> > request.GET['submit_preview'], 'event_type':
> >>> >> >> >> > request.GET['event_type'],
> >>> >> >> >> > 'filterValue':
> >>> >> >> >> >
> >>> >> >> >> >
> >>> >> >> >> >
> >>> >> >> >> >
> request.GET['_filterValue']}, context_instance=RequestContext(request))
> >>> >> >> >> >
> >>> >> >> >> > From the template, now, the different variables are
> available.
> >>> >> >> >> > {{
> >>> >> >> >> > date_time
> >>> >> >> >> > }}, {{ submit_preview }}, {{ event_type }}, {{ filterValue
> }}.
> >>> >> >> >> > That's
> >>> >> >> >> > how I
> >>> >> >> >> > would handle it at least.
> >>> >> >> >>
> >>> >> >> >> The URL gets created dynamically by jQuery code in a template.
> >>> >> >> >> Not
> >>> >> >> >> all
> >>> >> >> >> these fields are always present. Also, render_to_response is
> not
> >>> >> >> >> used.
> >>> >> >> >> (I'm
> >>> >> >> >> fairly new to both django and this job, and I just grepped
> >>> >> >> >> through
> >>> >> >> >> the
> >>> >> >> >> entire code base and it wasn't found.)
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >> >
> >>> >> >> >> > Furbee
> >>> >> >> >> >
> >>> >> >> >> > On Tue, Mar 13, 2012 at 11:27 AM, Larry Martell
> >>> >> >> >> > <larry.mart...@gmail.com>
> >>> >> >> >> > wrote:
> >>> >> >> >> >>
> >>> >> >> >> >> On Tue, Mar 13, 2012 at 11:58 AM, Xavier Ordoquy
> >>> >> >> >> >> <xordo...@linovia.com>
> >>> >> >> >> >> wrote:
> >>> >> >> >> >> >
> >>> >> >> >> >> > Le 13 mars 2012 à 18:40, Larry Martell a écrit :
> >>> >> >> >> >> >
> >>> >> >> >> >> >> On Tue, Mar 13, 2012 at 11:26 AM, Xavier Ordoquy
> >>> >> >> >> >> >> <xordo...@linovia.com>
> >>> >> >> >> >> >> wrote:
> >>> >> >> >> >> >>> Hi
> >>> >> >> >> >> >>>
> >>> >> >> >> >> >>> Le 13 mars 2012 à 18:11, larry.mart...@gmail.com a
> écrit
> >>> >> >> >> >> >>> :
> >>> >> >> >> >> >>>
> >>> >> >> >> >> >>>> From within a template can I find out the URL that
> >>> >> >> >> >> >>>> caused
> >>> >> >> >> >> >>>> the
> >>> >> >> >> >> >>>> template
> >>> >> >> >> >> >>>> to be invoked?
> >>> >> >> >> >> >>>
> >>> >> >> >> >> >>> You usually should have the request object in your
> >>> >> >> >> >> >>> template.
> >>> >> >> >> >> >>> See
> >>> >> >> >> >> >>>
> >>> >> >> >> >> >>>
> >>> >> >> >> >> >>>
> >>> >> >> >> >> >>>
> >>> >> >> >> >> >>>
> https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.path
> >>> >> >> >> >> >>> to get the url.
> >>> >> >> >> >> >>>
> >>> >> >> >> >> >>
> >>> >> >> >> >> >> But how do I access that in the template? I tried
> >>> >> >> >> >> >> HttpRequest.path
> >>> >> >> >> >> >> and
> >>> >> >> >> >> >> {{ HttpRequest.path }} and neither gives me the URL.
> >>> >> >> >> >> >
> >>> >> >> >> >> > {{ request.path }}
> >>> >> >> >> >> > just make sure you have RequestContext if you use
> >>> >> >> >> >> > render_to_response.
> >>> >> >> >> >>
> >>> >> >> >> >> This is displaying a path, but not the URL I need. It gives
> >>> >> >> >> >> /report//EventsTable/ when the URL that's clicked on is:
> >>> >> >> >> >>
> >>> >> >> >> >>
> >>> >> >> >> >>
> >>> >> >> >> >>
> >>> >> >> >> >>
> >>> >> >> >> >>
> >>> >> >> >> >>
> http://127.0.0.1/report/EventsTable/?date_time=3y&submit_preview=Generate+Report&event_type=RecipeCreated&_filterValue=dev
> >>> >> >> >> >>
> >>> >> >> >> >> I'm after all the arguments. Is there a way to get them?
> >>> >> >> >> >>
> >>> >> >> >> >> --
> >>> >> >> >> >> 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.
> >>> >> >> >> >>
> >>> >> >> >> >
> >>> >> >> >> > --
> >>> >> >> >> > 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.
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >> --
> >>> >> >> >> Sent from my iPhone
> >>> >> >> >>
> >>> >> >> >> --
> >>> >> >> >> 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.
> >>> >> >> >
> >>> >> >> >
> >>> >> >> > --
> >>> >> >> > 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.
> >>> >> >>
> >>> >> >> --
> >>> >> >> 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.
> >>> >> >>
> >>> >> >
> >>> >> > --
> >>> >> > 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.
> >>> >>
> >>> >> --
> >>> >> 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.
> >>> >>
> >>> >
> >>> > --
> >>> > 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.
> >>>
> >>> --
> >>> 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.
> >>>
> >>
> >
> > --
> > 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.
>
> --
> 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.
>
>

-- 
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