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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -