title: How to filter best related and create in one query?
body: <p>I want to select best related object and save new one in one query to avoid race condition. Is it possible? 
  Does select_for_update solve this problem?</p>
  
  <pre class="lang-py prettyprint-override"><code>class Order(models.Model):
      price = models.DecimalField(max_digits=10, decimal_places=2, default=0)
      maker_order = models.OneToOneField('self', on_delete=models.CASCADE, blank=True, null=True,
                                         related_name='taker_order')
  
      def save(self, *args, **kwargs):
          self.maker_order = Order.objects.filter(maker_order__isnull=True, taker_order__isnull=True,
                                                  price__lte=self.price
                                                  ).order_by('price').first()
          super().save(*args, **kwargs)
  </code></pre>