django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread tyrrrr
Hi I am trying to add a search view to an application I wrote in django but my EntryManager() seems to be getting hung up on the last line of code when django tries to call the url of the search. This EntryManager() (models.py) is excellent for performing searches in the django shell ($ python ma

Re: How to get request.user inside a model method?

2009-04-22 Thread tyrrrr
Please clarify what you mean exactly. You must enable users in your views if you want access to them within your templates. from http://docs.djangoproject.com/en/dev/topics/auth/ : if request.user.is_authenticated(): # Do something for authenticated users. else: # Do something for anonymo

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread tyrrrr
: /dsf/models.py in search, line 59 views.py in searching 68. results = Entry.objects.search(query_string) models.py in search 59. return qs.filter(reduce(operator.or_, q_objects)) On 22 Apr, 09:17, ty wrote: > Hi > I am trying to add a search view to an application I wr

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread tyrrrr
ren Tracey wrote: > On Wed, Apr 22, 2009 at 10:48 AM, ty wrote: > > > this is the error: > > > reduce() of empty sequence with no initial value > > > Request Method:         GET > > Request URL:    http://dsf/search/ > > E

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread tyrrrr
I might add that it gives me exactly the same error if I try to fetch a url with a query in it, for example: asdjhakshd/search/?=purple asdjhakshd/search/?=monkey_dishwasher asdjhakshd/search/?=purple+monkey+dishwasher On 22 Apr, 11:00, ty wrote: > Yes. I realise that this is exactly

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread tyrrrr
Thank you so much! On 22 Apr, 11:25, Karen Tracey wrote: > On Wed, Apr 22, 2009 at 11:08 AM, tyrrrr wrote: > > > I might add that it gives me exactly the same error if I try to fetch > > a url with a query in it, for example: > > asdjhakshd/search/?=purp

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-26 Thread tyrrrr
, q_objects)) return qs.none() #or qs.all() as the case may be On 22 Apr, 11:34, ty wrote: > Thank you so much! > > On 22 Apr, 11:25, Karen Tracey wrote: > > > On Wed, Apr 22, 2009 at 11:08 AM,ty wrote: > > > > I might add that it gives me e