Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- styles = style.models.Style.objects.filter(brand_account=self.brand_account, deleted=0)
- style_ids = styles.values_list('id', flat=True)
- style_colors = style.models.StyleColor.objects.filter(deleted=0, style_id__in=style_ids)
- style_color_ids = style_colors.values_list('id', flat=True)
- product_upc = size.models.ProductUPC.objects.filter(style_color_id__in=style_color_ids,
- style=django.db.models.OuterRef(
- django.db.models.OuterRef('pk')))
- styles = styles.annotate(product_upc=django.db.models.Subquery(product_upc.values('product_upc')[:1]))
Add Comment
Please, Sign In to add comment