Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Hot to use widgets with generic views
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mjd  
View profile  
 More options Aug 14 2012, 1:45 am
From: mjd <palmd...@gmail.com>
Date: Mon, 13 Aug 2012 22:45:24 -0700 (PDT)
Local: Tues, Aug 14 2012 1:45 am
Subject: Hot to use widgets with generic views

This is a general question.

Im am using generic views to display all objects in a model.  This is
working great.
However, i want to add text field widget to filter the objects onkeyup.  
That is, I want the text field to re-render the generic view after applying
the text filter in the queryset used in the generic view.

Can I use widgets with generic views?
If not do I simply implement the text input widget in html?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tomas Neme  
View profile  
 More options Aug 14 2012, 10:17 am
From: Tomas Neme <lacrymol...@gmail.com>
Date: Tue, 14 Aug 2012 11:17:06 -0300
Local: Tues, Aug 14 2012 10:17 am
Subject: Re: Hot to use widgets with generic views
well, for starters, you won't magically get "on keyup" behavior by
adding something on your backend, you'll need to use ajax for this,
and, depending on your expected number of elements, it might be better
to send everything and do any filtering on the client side (if you're
handling, say, up to a few thousands of records, and not up to tens of
thousands or more).

In any way, you'll need to give your view some parameter to do the
filtering. For this, I'd recommend passing a ?q=keywords GET argument
to your view, and with that in mind, I link you here:
https://docs.djangoproject.com/en/dev/topics/class-based-views/generi...

Just do something like that, but instead of using self.args or
self.kwargs, use self.request.GET for the filtering

--
"The whole of Japan is pure invention. There is no such country, there are
no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »