You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LANGUAGES = (
('it', 'Italian'),
('en', 'English'),
)
there are no problems, but removing the ('en', 'English'), language raise an exception on nullable fields
when launcing sync_transmeta_db
with the following trace
Traceback (most recent call last):
File "Z:\Exprivia\Programmi_e_configurazioni\workspaceEclipseLuna\Consumattori\manage.py", line 10, in
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management__init__.py", line 385, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(_args, *_options.dict)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 338, in execute
output = self.handle(_args, *_options)
File "c:\python27\lib\site-packages\django_transmeta-0.7.3-py2.7.egg\transmeta\management\commands\sync_transmeta_db.py", line 88, in handle
sql_sentences = self.get_sync_sql(field_name, db_change_langs, model, db_table_fields)
File "c:\python27\lib\site-packages\django_transmeta-0.7.3-py2.7.egg\transmeta\management\commands\sync_transmeta_db.py", line 197, in get_sync_sql
col_type = self.get_type_of_db_field(field_name, model)
File "c:\python27\lib\site-packages\django_transmeta-0.7.3-py2.7.egg\transmeta\management\commands\sync_transmeta_db.py", line 171, in get_type_of_db_field
field = model._meta.get_field(get_real_fieldname(field_name))
File "C:\Python27\lib\site-packages\django\db\models\options.py", line 398, in get_field
raise FieldDoesNotExist('%s has no field named %r' % (self.object_name, name))
django.db.models.fields.FieldDoesNotExist: Question has no field named 'extra_en'
the model is:
classQuestion(models.Model):
__metaclass__=TransMetaquestionset=models.ForeignKey(QuestionSet)
number=models.CharField(max_length=8, help_text="eg. <tt>1</tt>, <tt>2a</tt>, <tt>2b</tt>, <tt>3c</tt><br /> ""Number is also used for ordering questions.")
text=models.TextField(blank=True, verbose_name=_("Text"))
type=models.CharField(u"Type of question", max_length=32,
choices=QuestionChoices,
help_text=u"Determines the means of answering the question. " \
"An open question gives the user a single-line textfield, " \
"multiple-choice gives the user a number of choices he/she can " \
"choose from. If a question is multiple-choice, enter the choices " \
"this user can choose from below'.")
extra=models.CharField(u"Extra information", max_length=512, blank=True, null=True, help_text=u"Extra information (use on question type)")
checks=models.CharField(u"Additional checks", max_length=512, blank=True,
null=True, help_text="Additional checks to be performed for this ""value (space separated) <br /><br />""For text fields, <tt>required</tt> is a valid check.<br />""For yes/no choice, <tt>required</tt>, <tt>required-yes</tt>, ""and <tt>required-no</tt> are valid.<br /><br />""If this question is required only if another question's answer is "'something specific, use <tt>requiredif="QuestionNumber,Value"</tt> ''or <tt>requiredif="QuestionNumber,!Value"</tt> for anything but '"a specific value. ""You may also combine tests appearing in <tt>requiredif</tt> ""by joining them with the words <tt>and</tt> or <tt>or</tt>, "'eg. <tt>requiredif="Q1,A or Q2,B"</tt>')
footer=models.TextField(u"Footer", help_text="Footer rendered below the question interpreted as textile", blank=True)
defquestionnaire(self):
returnself.questionset.questionnairedefgetcheckdict(self):
"""getcheckdict returns a dictionary of the values in self.checks"""if(hasattr(self, '__checkdict_cached')):
returnself.__checkdict_cachedtry:
self.__checkdict_cached=d=parse_checks(self.sameas().checksor'')
exceptParseException:
raiseException("Error Parsing Checks for Question %s: %s"% (
self.number, self.sameas().checks))
returnddef__unicode__(self):
returnu'{%s} (%s) %s'% (unicode(self.questionset), self.number, self.text)
defsameas(self):
ifself.type=='sameas':
try:
kwargs= {}
forcheck, valueinparse_checks(self.checks):
ifcheck=='sameasid':
kwargs['id'] =valuebreakelifcheck=='sameas':
kwargs['number'] =valuekwargs['questionset__questionnaire'] =self.questionset.questionnairebreakself.__sameas=res=getattr(self, "__sameas", Question.objects.get(**kwargs))
returnresexceptQuestion.DoesNotExist:
returnQuestion(type='comment') # replace with something benignreturnselfdefdisplay_number(self):
"Return either the number alone or the non-number part of the question number indented"m=_numre.match(self.number)
ifm:
sub=m.group(2)
return" "+subreturnself.numberdefchoices(self):
ifself.type=='sameas':
returnself.sameas().choices()
res=Choice.objects.filter(question=self).order_by('sortid')
returnresdefis_custom(self):
return"custom"==self.sameas().typedefget_type(self):
"Get the type name, treating sameas and custom specially"t=self.sameas().typeift=='custom':
cd=self.sameas().getcheckdict()
if'type'notincd:
raiseException("When using custom types, you must have type=<name> in the additional checks field")
returncd.get('type')
returntdefquestioninclude(self):
return"questionnaire/"+self.get_type() +".html"# def __cmp__(a, b):# anum, astr = split_numal(a.number)# bnum, bstr = split_numal(b.number)# cmpnum = cmp(anum, bnum)# return cmpnum or cmp(astr, bstr)classMeta:
translate= ('text', 'extra', 'footer')
The text was updated successfully, but these errors were encountered:
If I have the following settings
LANGUAGE_CODE = 'it'
LANGUAGES = (
('it', 'Italian'),
('en', 'English'),
)
there are no problems, but removing the ('en', 'English'), language raise an exception on nullable fields
when launcing sync_transmeta_db
with the following trace
Traceback (most recent call last):
File "Z:\Exprivia\Programmi_e_configurazioni\workspaceEclipseLuna\Consumattori\manage.py", line 10, in
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management__init__.py", line 385, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(_args, *_options.dict)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 338, in execute
output = self.handle(_args, *_options)
File "c:\python27\lib\site-packages\django_transmeta-0.7.3-py2.7.egg\transmeta\management\commands\sync_transmeta_db.py", line 88, in handle
sql_sentences = self.get_sync_sql(field_name, db_change_langs, model, db_table_fields)
File "c:\python27\lib\site-packages\django_transmeta-0.7.3-py2.7.egg\transmeta\management\commands\sync_transmeta_db.py", line 197, in get_sync_sql
col_type = self.get_type_of_db_field(field_name, model)
File "c:\python27\lib\site-packages\django_transmeta-0.7.3-py2.7.egg\transmeta\management\commands\sync_transmeta_db.py", line 171, in get_type_of_db_field
field = model._meta.get_field(get_real_fieldname(field_name))
File "C:\Python27\lib\site-packages\django\db\models\options.py", line 398, in get_field
raise FieldDoesNotExist('%s has no field named %r' % (self.object_name, name))
django.db.models.fields.FieldDoesNotExist: Question has no field named 'extra_en'
the model is:
The text was updated successfully, but these errors were encountered: