#11710: construct_change_message() with unicode verbose_name fix
-------------------------------------------+--------------------------------
          Reporter:  Rupe                  |         Owner:  nobody             
                             
            Status:  new                   |     Milestone:                     
                             
         Component:  django.contrib.admin  |       Version:  SVN                
                             
        Resolution:                        |      Keywords:  
construct_change_message exception ascii unicode
             Stage:  Unreviewed            |     Has_patch:  1                  
                             
        Needs_docs:  0                     |   Needs_tests:  0                  
                             
Needs_better_patch:  0                     |  
-------------------------------------------+--------------------------------
Comment (by Rupe):

 Here is the model with the verbose name that was giving me problems. I've
 tried it with and without the u Unincode indicator in front of the
 verbose_name string.

 {{{
 #!python
 # -*- coding: utf-8 -*-

 class Matriz(modelUtils.MyModelAudit):
     """
     Localidades ondi pessoas mesti paga taxas
     Locals where a person needs to pay taxes
     """

     NumOrd        = models.IntegerField('número', primary_key=True,
         blank=True, help_text='Número de identificação. Se você deixar em
 branco o próximo número será dado disponível.')
     SitPredios    = fields_db.AutoCompleteCharField('situação dos
 prédios', max_length=50)
     SitTipoCD_Choices=((1,'Rustica'),(2,'Urbano'))
     SitTipoCD     = models.IntegerField('tipo de Situação',
         choices=SitTipoCD_Choices)
     Proprietarios = models.ManyToManyField(Pessoa, through='MatrizPropri')
     Ano           = models.IntegerField(help_text = 'Ano documentos
 assinar')
     Documentos    = models.ManyToManyField(Documento,
 through='MatrizDocs')
     Descricao     = models.TextField('descrição', max_length=4000,
         help_text = 'Descrição dos prédios, suas divisões, confrontações,
 ' + \
         'superfície coberta e sua aplicação')
     Rendimento    = CurrencyField('rendimento colectável', max_digits=15)
     RendTipoCD_Choices=((1,'Total'),(2,'Parcial'))
     RendTipoCD   = models.IntegerField('tipo de Rendimento',
         choices=RendTipoCD_Choices)
     Observacoes  = models.TextField('observações', max_length=2000,
 blank=True)

     Anular       = models.BooleanField(default=False, blank=True)
     UltimoAno    = models.IntegerField('último ano', null=True,
 blank=True, help_text = 'Último ano activo')
     AnularInfo   = models.CharField('informação / Razão', max_length=50,
 null=True, blank=True,
         help_text='O número de novo prédio e/ou o razão por anular.')

     ULTIMOANO_MISSING_ERROR = _("You need to provided an ending year for a
 nulled property.")

     class Meta:
         ordering = ["NumOrd"]
         verbose_name = 'prédio'
         verbose_name_plural = 'prédios'

     def __unicode__(self):
         return unicode(self.NumOrd) + ' - ' + self.SitPredios

     def save(self, force_insert=False, force_update=False):
         if self.Anular and not self.UltimoAno:
             raise ValidationError(unicode(self.ULTIMOANO_MISSING_ERROR))
         super(Matriz, self).save(force_insert, force_update)

 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11710#comment:3>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to