Re: formatting results of search

2010-03-04 Thread gintare
Thanks,

How about values in database?
Than i am retrieving data from database i am getting:
(3, u' ANN I. PERSSON1', u' MAGNUS W. LARSSON2, STIG STENSTR\xd6M3, B.
JONAS OHLSSON1, LARS SAMUELSON1 AND L. REINE WALLENBERG2 ', u' nature
materials', u' ..

Is it possible to write to databse normal string without preceding
u'  ?
I am using smart_unicode() function to be able to save special
characters in database.

#Ath.html





#view.py
def search1(request):
Lq,stitles, query = [ ] , string_column _names,
request.GET.get( 'q','')
Lq=query.split('<')
   my_custom_sql( Lq, Ltitles)

def my_custom_sql( Lq, stitles):
from django.db import connection, transaction
cursor = connection.cursor()
for i in range(len(Lq)): stLq=stLq+'\"'+smart_unicode(Lq[i],
encoding='utf-8', strings_only=False, errors='strict')+'\"'+' , '
st2='insert into Ath_aref'+ ' ( ' + stitles + ' ) values ' + '(' +
stLq+ '); '
cursor.execute(st2);
transaction.commit_unless_managed()


regards,
gintare





On Feb 22, 1:15 am, Dennis Kaarsemaker  wrote:
> On wo, 2010-02-17 at 05:32 -0800,gintarewrote:
>
> > @@in *.html
> > @@using line  {{ word|escape }}
>
> > @@i am getting printed answer :(u'moi',)  instead of moi.
> > @@I need only word moi (without any brakets, quatations) be visible in
> > a webpage.
>
> In this case you want word.0|escape
>
> values() always returns a sequence of tuples.
> --
> Dennis K.
>
> The universe tends towards maximum irony. Don't push it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: formatting results of search

2010-02-21 Thread Dennis Kaarsemaker
On wo, 2010-02-17 at 05:32 -0800, gintare wrote:
> @@in *.html
> @@using line  {{ word|escape }}
> 
> @@i am getting printed answer :(u'moi',)  instead of moi.
> @@I need only word moi (without any brakets, quatations) be visible in
> a webpage. 

In this case you want word.0|escape

values() always returns a sequence of tuples.
-- 
Dennis K.

The universe tends towards maximum irony. Don't push it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



formatting results of search

2010-02-17 Thread gintare
@@in views.py i am making search in database:

def search1(request):
#..
 results = EntryD.objects.filter(qset).values_list('fwordE')
#
 return render_to_response("diction.html", {
"results": results,
"query": query
})


@@in *.html
@@using line  {{ word|escape }}

@@i am getting printed answer :(u'moi',)  instead of moi.
@@I need only word moi (without any brakets, quatations) be visible in
a webpage.

How correctly format results of search in database when they are
posted to *.html?

regards,
gintare

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.