Re: is it possible to have more than one search result in a view
Perhaps I don't understand the question, but why cannot your context include a number of different pieces of data? return render_to_response('country/search_detail.html', {'search_results': search_results, 'firm_search':firm_search, 'client_search':client_search, 'query': q}) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Need help first user of django..
Those are both good, and the book _Practical Django Projects_ by Bennett is another good choice. Jim --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
sanitizing the regex in Entry.objects.get(title__iregex=regex)
I have a question about escaping a db query that uses iregex. I wonder if there isn't just a function that I need to use that I don't know how to find. I have a text box where users can enter multiple words and I will search the database for a regex made from those words (the underlying databse record is from a CharField). My first try was this: regex=r'('+'|'.join(word_list)+')+' xQ = X.objects.filter(f__iregex=regex) I entered "paper; select * from pkg_y" and got a screen dump (a text traceback) going down to a line involving the database cursor (I have a quite recent Django running from the svn, using Python 2.6 and PostgreSQL, if that matters). From this I understood that I have to sanitize regex. Is that right? Is there a natural way to do that? I have at the moment got regex=r'('+"|".join([re.escape(t) for t in word_list])+')+' but I am dubious about my ability to outsmart any bad guys. Thank you for any help, Jim --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Question about field/widget relationship
How does a field pass attributes to a widget? I have approximately this class fooForm(forms.Form): x_choice=myForms.xField(widget=myWidgets.xWidget) where myWidgets.xWidget is a subclass of RadioSelect so it has a required argument like "choices=[('a','1'), ('b','a')]" (this is generated dynamically so I can't build it in to xWidget). Where in the Django code base does that information get passed? The examples I've studied don't seem to me to show xField being written to pass it explicitly but they do make a super() call, so I expect it is done there. I see in the render code for the widget references to the variable self.choices, so it is getting remembered by the widget in that way. However, I've struggled with the Django source and I can't make out how it is passed. I'd be very grateful if someone could help me find it. Jim --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: encoding and escaping of form values
Thank you *very* much. > What happens when you try it? Your computer won't catch on fire when you > make a mistake, so experimentation is a good way to learn. :-) I left out a lot of fumblings, including these ones. I find that when I'm beginning trying to understand a system with lots of parts them I can't understand from what I'm looking at even what is relevant to my question. That is, it's the "Hello world" problem where until you have something then you can't move on to the next. Thanks again. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---