コード例 #1
0
ファイル: datatables.py プロジェクト: clld/dictionaria
 def col_defs(self):
     poscol = Col(self, 'part_of_speech', model_col=Word.pos)
     if self.contribution:
         pos = sorted((c for c, in DBSession.query(Word.pos)
                      .filter(Word.dictionary_pk == self.contribution.pk)
                      .distinct() if c))
         res = [
             FtsCol(self, 'fts', sTitle='full entry', model_col=Word.fts),
             WordCol(self, 'word', sTitle='headword', model_col=common.Unit.name),
             Col(self,
                 'part_of_speech',
                 sTitle='part of speech',
                 model_col=Word.pos,
                 choices=pos,
                 format=lambda i: HTML.span(i.pos or '', class_='vocabulary')),
             MeaningDescriptionCol2(self,
                 'description',
                 sTitle='meaning description',
                 model_col=common.Unit.description),
         ]
         if self.second_tab:
             for name in self.vars:
                 res.append(CustomCol(self, name, sTitle=name.replace('lang-', '')))
             return res
         else:
             res.append(Col(self,
                 'examples',
                 input_size='mini',
                 model_col=Word.example_count))
         if self.contribution.semantic_domains:
             res.append(SemanticDomainCol(self, 'semantic_domain', split(self.contribution.semantic_domains)))
         if self.contribution.count_audio:
             res.append(MediaCol(self, 'audio', 'audio', sTitle=''))
         if self.contribution.count_image:
             res.append(ThumbnailCol(self, 'image', sTitle=''))
             #res.append(MediaCol(self, 'image', 'image', sTitle=''))
         for name in self.vars:
             col = CustomCol(self, name, sTitle=name.replace('lang-', ''))
             if name in self.contribution.jsondata['choices']:
                 col.choices = self.contribution.jsondata['choices'][name]
             res.append(col)
         return res
     return [
         WordCol(self, 'word'),
         poscol,
         Col(self, 'description'),
         MeaningsCol(self, 'meaning', bSortable=False, sTitle='Comparison meaning'),
         DictionaryCol(self, 'dictionary'),
     ]
コード例 #2
0
 def col_defs(self):
     poscol = Col(self, 'part_of_speech', model_col=Word.pos)
     if self.contribution:
         pos = sorted((c for c, in DBSession.query(Word.pos)
                      .filter(Word.dictionary_pk == self.contribution.pk)
                      .distinct() if c))
         res = [
             FtsCol(self, 'fts', sTitle='full entry', model_col=Word.fts),
             WordCol(self, 'word', sTitle='headword', model_col=common.Unit.name),
             Col(self,
                 'part_of_speech',
                 sTitle='part of speech',
                 model_col=Word.pos,
                 choices=pos,
                 format=lambda i: HTML.span(i.pos or '', class_='vocabulary')),
             Col(self,
                 'description',
                 sTitle='meaning description',
                 model_col=common.Unit.description),
             Col(self,
                 'examples',
                 input_size='mini',
                 model_col=Word.example_count),
         ]
         if self.second_tab:
             for name in self.vars:
                 res.append(CustomCol(self, name, sTitle=name.replace('lang-', '')))
             return res
         if self.contribution.semantic_domains:
             res.append(SemanticDomainCol(self, 'semantic_domain', split(self.contribution.semantic_domains)))
         if self.contribution.count_audio:
             res.append(MediaCol(self, 'audio', 'audio', sTitle=''))
         if self.contribution.count_image:
             res.append(ThumbnailCol(self, 'image', sTitle=''))
             #res.append(MediaCol(self, 'image', 'image', sTitle=''))
         for name in self.vars:
             col = CustomCol(self, name, sTitle=name.replace('lang-', ''))
             if name in self.contribution.jsondata['choices']:
                 col.choices = self.contribution.jsondata['choices'][name]
             res.append(col)
         return res
     return [
         WordCol(self, 'word'),
         poscol,
         Col(self, 'description'),
         MeaningsCol(self, 'meaning', bSortable=False, sTitle='Comparison meaning'),
         DictionaryCol(self, 'dictionary'),
     ]
コード例 #3
0
 def semantic_domain_list(self):
     if self.semantic_domain:
         return split(self.semantic_domain)
     return []
コード例 #4
0
 def reverse_list(self):
     return split(self.reverse or '')
コード例 #5
0
 def comparison_meanings_list(self):
     return split(self.comparison_meanings)
コード例 #6
0
 def description_list(self):
     return split(self.description)
コード例 #7
0
ファイル: models.py プロジェクト: clld/dictionaria
 def semantic_domain_list(self):
     if self.semantic_domain:
         return split(self.semantic_domain)
     return []
コード例 #8
0
ファイル: models.py プロジェクト: clld/dictionaria
 def reverse_list(self):
     return split(self.reverse or '')
コード例 #9
0
ファイル: models.py プロジェクト: clld/dictionaria
 def comparison_meanings_list(self):
     return split(self.comparison_meanings)
コード例 #10
0
ファイル: models.py プロジェクト: clld/dictionaria
 def description_list(self):
     return split(self.description)