class OrderGood(models.Model):
pass
class SupplyOrderGoodServiceBase(models.Model):
supplier_price = models.DecimalField(max_digits=12, decimal_places=4)
title = models.CharField(max_length=512)
class Meta:
ordering = ('id',)
class SupplyOrderGood(SupplyOrderGoodServiceBase):
order_good = models.ForeignKey(to=OrderGood, on_delete=models.CASCADE)
Title field must be translated, the options are configured as follows:
@register(SupplyOrderGoodServiceBase)
class SupplyOrderGoodServiceBaseTranslation(TranslationOptions):
fields = ('title',)
@register(SupplyOrderGood)
class SupplyOrderGoodServiceBaseTranslation(TranslationOptions):
fields = ()
However, update queries do not work due to default ordering being added to order_by. Consider this query:
ORDER BY `supply_supplyordergood`.`supplyordergoodservicebase_ptr_id` ASC
I believe this happens only on MySQL as the incompatibility comes from SQLUpdateCompiler class for MySQL. update_query and update_params are both empty, but self.query.order_by is not, which leads to this query with only the ORDER BY part.
Consider the following models:
Title field must be translated, the options are configured as follows:
However, update queries do not work due to default ordering being added to order_by. Consider this query:
It generates the following query:
I believe this happens only on MySQL as the incompatibility comes from SQLUpdateCompiler class for MySQL. update_query and update_params are both empty, but self.query.order_by is not, which leads to this query with only the ORDER BY part.
I uploaded an example project here https://github.com/ryselis/django_34495 There is a failing test in supply/tests.py