33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
from django.db import models
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from .enums import LanguageTypes
|
|
|
|
|
|
class AppText(models.Model):
|
|
text_id = models.AutoField(primary_key=True)
|
|
text_key = models.TextField(max_length=255, help_text='Do not edit this! It is the key in the mobile app',
|
|
verbose_name=_("text_key"))
|
|
screenshot_url = models.ImageField(upload_to='images/', help_text='The menu image size is 1366x768', blank=True,verbose_name=_("App képernyőkép") )
|
|
checked = models.BooleanField(blank=True, verbose_name=_("Checked, Translation is OK"))
|
|
|
|
class Meta:
|
|
db_table = 'app_text'
|
|
verbose_name = _("App Text")
|
|
verbose_name_plural = _("App Texts")
|
|
|
|
def __str__(self):
|
|
return self.text_key
|
|
|
|
|
|
class AppTextTranslation(models.Model):
|
|
translation_id = models.AutoField(primary_key=True)
|
|
text = models.ForeignKey(AppText, on_delete=models.CASCADE)
|
|
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
|
|
translation = models.TextField(max_length=1000)
|
|
|
|
class Meta:
|
|
db_table = 'app_text_translation'
|
|
verbose_name = _("Translation")
|
|
verbose_name_plural = _("Translations")
|