python - django-modeltranslation removes text from models -


this translation.py file:

from modeltranslation.translator import translator, translationoptions polls.models import question, choice  class questiontranlationoptions(translationoptions):     fields = ('question_text',)  class choicetranslationoptions(translationoptions):     fields = ('choice_text',)  translator.register(question, questiontranlationoptions) translator.register(choice, choicetranslationoptions); 

models.py :

from django.db import models django.utils import timezone import datetime django.utils.translation import ugettext_lazy _  class question(models.model):     question_text = models.charfield(max_length=200)     pub_date = models.datetimefield(_('date published'))     def __str__(self):         return self.question_text     def was_published_recently(self):         = timezone.now()         return - datetime.timedelta(days=1) <= self.pub_date <=     was_published_recently.admin_order_field = 'pub_date'     was_published_recently.boolean = true     was_published_recently.short_description = _('published recently?')  class choice(models.model):     question = models.foreignkey(question, on_delete=models.cascade)     choice_text = models.charfield(max_length=200)     votes = models.integerfield(default=0)     def __str__(self):         return self.choice_text 

when open app, models' text not visible. 1 of questions "coke or sprite?", can't see text. doing wrong?

python 3.4, django 1.10

i had run command fix it:

c:\users\xxx\myproject>manage.py update_translation_fields 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -