def test_field_choices_used_to_translated_value():
 LANGUAGES = (('en', 'English'), ('ru', 'Russian'))
 from django.db import models
 class Article(models.Model, ):
  name = models.CharField(max_length=200)
  language = models.CharField(max_length=200, choices=LANGUAGES)
  class Meta:
   app_label = 'django_tables2_test'
  def __unicode__(self):
   return self.name
 class ArticleTable(tables.Table, ):
  class Meta:
   model = Article
 table = ArticleTable([Article(name='English article', language='en'), Article(name='Russian article', language='ru')])
 assert ('English' == table.rows[0].get_cell('language'))
 assert ('Russian' == table.rows[1].get_cell('language'))

def test_field_choices_used_to_translated_value ( ) : LANGUAGES = ( ( 'en' , 'English' ) , ( 'ru' , 'Russian' ) ) from django . db import models class Article ( models . Model , ) : name = models . CharField ( max_length = 200 ) language = models . CharField ( max_length = 200 , choices = LANGUAGES ) class Meta : app_label = 'django_tables2_test' def __unicode__ ( self ) : return self . name class ArticleTable ( tables . Table , ) : class Meta : model = Article table = ArticleTable ( [ Article ( name = 'English article' , language = 'en' ) , Article ( name = 'Russian article' , language = 'ru' ) ] ) assert ( 'English' == table . rows [ 0 ] . get_cell ( 'language' ) ) assert ( 'Russian' == table . rows [ 1 ] . get_cell ( 'language' ) )
when a model field uses the choices option .