1đ
Itâs recommended to use unicode strings for help_text
and verbose_name
.
Try marking the string as unicode with the u
prefix, then find the previous migration where the verbose name was set as a byte string, and change that to a unicode string as well. Since editing the help_text
and verbose_name
doesnât require any schema changes, this should be safe to do.
migrations.AddField(
model_name='datedmodel',
name='created',
field=models.DateTimeField(default=datetime.datetime(2015, 9, 10, 14, 8, 23, 349990, tzinfo=utc), verbose_name='Créé le', auto_now_add=True),
preserve_default=False,
),
Thereâs no need for uâ prefix in migration file since it has from __future__ import unicode_literals
.
Then, when you rerun makemigrations
, Django will hopefully say âno changes detectedâ.
đ€Alasdair
0đ
Appending .encode('utf-8')
prevent the error but makemigrations
still detect changes each time it is run.
class Checkpoint(models.Model):
name = models.CharField(max_length=128, help_text=_('Nom du repĂšre/checkpoint'.encode('utf-8')))
passed = models.BooleanField(default=False, help_text=_('Le checkpoint a t-il était validé?'.encode('utf-8')))
site = models.ForeignKey('Site', null=True, help_text=_('Entité concernée par le checkpoint'.encode('utf-8')))
đ€Ădouard Lopez
- How to use reverse an url with extra arguments in a django template tag?
- How to catch a PermissionDenied(403) from Django with Ajax?
- Django EventLog: Passing in current user
- Use 'disable' attribute in modelformset
Source:stackexchange.com