On 8 Lis, 18:06, Victor wrote:
> Hi,
>
>
> user_item_rel_set is a m2m relationship between the User and Item
> class. For every item, I look back at its m2m relationship model and
> retrieve payment_amount. The only problem is, select_related()
> doesn't grab the user_item_rel_set.all() when I
Hi,
I'm trying to optimize some queries I'm making, but I'm not sure how
to do it.
61 for t in items:
62 try:
63 t.price = t.user_item_rel_set.get
(user=u).payment_amount
64 except:
65 t.price = -1 * t.buyer
I think using SQL could be quite database independant though less
readable. Anyway, executing a count query for each "TagName" is not
acceptable. So if there's no "django way" to do that, I would
recommand SQL
--~--~-~--~~~---~--~~
You received this message bec
Hi,
sometimes I find myself in a need of raw sql, for example when joining
tables that don't have explicit related fields.
In those cases "extra" method comes in really handy. For example I
have following models.
class TagName(models.Model):
name = model.CharField()
class Tag(models.Model):
4 matches
Mail list logo