Friday, February 1, 2013

select_related() - suddenly to result

Hi,

I have the following query:

Buch = Buchung.objects.filter(Produkt = int(POSTvalues['Produkt']))

Later I'm using stuff like:

Buch.Produkt.Bestell_Nr

To speed things up i wan't to use select_related() on the query but no mather where I add it if I add it i get 0 entries as a result where without select_related() I do get entries.

I've tried this:

Buch = Buchung.objects.filter(Produkt = int(POSTvalues['Produkt'])).select_related()

and

Buch = Buchung.objects.select_related().filter(Produkt = int(POSTvalues['Produkt']))

Any ideas why the results are wrong if I use select_related()

cheers


. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
Developer
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:Patrick.Szabo@lexisnexis.at
Tel.: +43 1 53452 1573
Fax.: +43 1 534 52 146

. . . . . . . . . . . . . . . . . . . . . . . . . .

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment