class SalesUnitTranslation(_ShortNameToSymbol, TranslatedFieldsModel): master = TranslationsForeignKey( on_delete=models.CASCADE, to=SalesUnit, related_name="translations", null=True, editable=False ) name = models.CharField( max_length=128, verbose_name=_("name"), help_text=_( "The sales unit name to use for products (e.g. " "'pieces' or 'units'). Sales units can be set individually for each " "product through the product editor view." ), ) symbol = models.CharField( max_length=128, verbose_name=_("unit symbol"), help_text=_("An abbreviated name for this sales unit that is shown " "throughout admin and order invoices."), ) class Meta: # Use same meta options as Parler's defaults to avoid migration unique_together = [("language_code", "master")] verbose_name = "sales unit Translation" db_table = SalesUnit._meta.db_table + "_translation" db_tablespace = SalesUnit._meta.db_tablespace managed = SalesUnit._meta.managed default_permissions = ()
class CleanFieldModelTranslation(TranslatedFieldsModel): master = TranslationsForeignKey( CleanFieldModel, related_name='translations', null=True, default=1, on_delete=models.CASCADE) tr_title = CleanCharField("Translated Title", max_length=200) class Meta: unique_together = ('language_code', 'master') def clean(self): self.tr_title += "_cleantrans"
class TranslationRelatedTranslation(TranslatedFieldsModel): master = TranslationsForeignKey(TranslationRelated, related_name='translations', on_delete=models.CASCADE) title = models.CharField(max_length=200) m2m_regular = models.ManyToManyField(RegularModel)
class CharModelTranslation(TranslatedFieldsModel): master = TranslationsForeignKey(CharModel, on_delete=models.CASCADE) tr_title = models.CharField(max_length=200)
class DoubleModelMoreTranslations(TranslatedFieldsModel): master = TranslationsForeignKey(DoubleModel, related_name='more_translations', on_delete=models.CASCADE) l2_title = models.CharField(max_length=200)
class ManualModelTranslations(TranslatedFieldsModel): master = TranslationsForeignKey(ManualModel, related_name='translations', on_delete=models.CASCADE) tr_title = models.CharField(max_length=200)