#11710: construct_change_message() with unicode verbose_name fix
-------------------------------------------+--------------------------------
Reporter: Rupe | Owner: nobody
Status: closed | Milestone:
Component: django.contrib.admin | Version: SVN
Resolution: worksforme | Keywords:
construct_change_message exception ascii unicode
Stage: Unreviewed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by ramiro):
* status: new => closed
* resolution: => worksforme
Comment:
The symptoms you describe are located in code that handles the creation of
a change message for modifications of inlined models but a) I don't see
any FK from your `Matriz` model to another model and b) Inlines can't be
created for many to many relationships (of which `Matriz` has two), that's
weird because it seems you simply pasted your whole model ()without
reducing it to the relevant parts so we can try to diagnose the real
problem with minimal surrounding noise. So I suspect you aren't telling us
the complete story here.
I've created this simplified setup:
{{{
#!python
# -*- coding: utf-8 -*-
from django.db import models
class Foo(models.Model):
name = models.CharField(max_length=100)
class Matriz(models.Model):
NumOrd = models.IntegerField(u'número', primary_key=True, blank=True,
help_text=u'Número de identificação. Se você deixar em branco...')
SitPredios = models.CharField(u'situação dos prédios', max_length=50)
foo = models.ForeignKey(Foo)
class Meta:
ordering = ["NumOrd"]
verbose_name = u'prédio'
verbose_name_plural = u'prédios'
def __unicode__(self):
return unicode(self.NumOrd) + u' - ' + self.SitPredios
}}}
{{{
#!python
from django.contrib import admin
from t11710.models import Matriz, Foo
class MatrizInline(admin.TabularInline):
model = Matriz
class FooAdmin(admin.ModelAdmin):
inlines = (MatrizInline,)
admin.site.register(Foo, FooAdmin)
}}}
And I can perform CRUD actions on `Matriz` instances inlined to a `Foo`
admin form without experimenting the problem you report. Note how I used
the `u` prefix for ALL the literals. Also, you need to be sure the real
coding of the models.py file is UTF-8, using the `# -*- coding: utf-8 -*-`
header isn't enough. i.e.:
{{{
$ file t11710/models.py
t11710/models.py: UTF-8 Unicode Java program text
}}}
Because of that, and because the ticket tracker isn't the place to have
this kind of conversation (I suggest to post additional details to the
django-users mailing), I'm closing this ticket.
--
Ticket URL: <http://code.djangoproject.com/ticket/11710#comment:4>
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
-~----------~----~----~----~------~----~------~--~---