On Saturday 15 November 2008 17:34, Luke Seelenbinder wrote: > > You need to specify your encoding in your models file. > Like: # -*- coding: iso-8859-15 -*- > Look at <a href='http://evanjones.ca/python-utf8.html'>http:// > evanjones.ca/python-utf8.html</a> The sixth section of the page > explains. thanks for answer, but the first line in my models.py is # -*- coding: utf-8 -*-. Please see : http://gista.sk/dl/bugs/django/models.py
> > Regards > Luke > > On Nov 15, 11:09 am, Ivan Mincik <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a problem when adding record by Django Admin and I am not sure where > > I have to look for it. Is this some problem in Django Admin or it can be > > solved by some > > configuration in model ? > > I use Foreign Key in table where I want to add record. Foreign Key is the > > field containing some non ASCII characters. > > See:http://gista.sk/dl/bugs/django/add_record_in_admin.png > > I want to add record to "Metadata" which uses ForeignKey from "Vrstva". > > > > *** When I submit, I get this error (nothing else printed): > > Screenshot is > > here:http://gista.sk/dl/bugs/django/add_record_in_admin_submit.png > > > > Mod_python error: "PythonHandler django.core.handlers.modpython" > > > > Traceback (most recent call last): > > > > File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, > > in HandlerDispatch > > result = object(req) > > > > File > > "/var/lib/python-support/python2.4/django/core/handlers/modpython.py", line > > 222, in handler > > return ModPythonHandler()(req) > > > > File > > "/var/lib/python-support/python2.4/django/core/handlers/modpython.py", line > > 195, in __call__ > > response = self.get_response(request) > > > > File "/var/lib/python-support/python2.4/django/core/handlers/base.py", > > line 128, in get_response > > return self.handle_uncaught_exception(request, resolver, exc_info) > > > > File "/var/lib/python-support/python2.4/django/core/handlers/base.py", > > line 148, in handle_uncaught_exception > > return debug.technical_500_response(request, *exc_info) > > > > File "/var/lib/python-support/python2.4/django/views/debug.py", line 39, > > in technical_500_response > > html = reporter.get_traceback_html() > > > > File "/var/lib/python-support/python2.4/django/views/debug.py", line 95, > > in get_traceback_html > > c = Context({ > > > > File "/var/lib/python-support/python2.4/django/utils/encoding.py", line > > 35, in smart_unicode > > return force_unicode(s, encoding, strings_only, errors) > > > > File "/var/lib/python-support/python2.4/django/utils/encoding.py", line > > 70, in force_unicode > > raise DjangoUnicodeDecodeError(s, *e.args) > > > > DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position > > 1: ordinal not in range(128). You passed in > > > > *** Snippets from my model: > > Full models.py is here:http://gista.sk/dl/bugs/django/models.py > > > > class Metadata(models.Model): > > vrstva = models.ForeignKey(Vrstva) > > nazov = models.CharField(u"Názov stĺpca", max_length=100) > > dlhy_nazov = models.CharField(u"Dlhý názov stĺpca", max_length=200) > > hodnota = models.CharField(u"Formátovanie hodnoty", max_length=512, > > default="%s") > > externa_databaza = models.ForeignKey(Externa_databaza, blank=True, > > null=True) > > sql = models.TextField(u"SQL dopyt", blank=True) > > > > def __unicode__(self): > > return "%s %s" % (self.vrstva,self.nazov) > > > > class Meta: > > ordering = ["vrstva", "nazov"] > > verbose_name_plural = u"metadata" > > > > class Vrstva(Vrstvy_zaklad): > > kategoria = models.ForeignKey(Kategoria, verbose_name=u"Kategória") > > sql_atrib = models.TextField(u"Atributový SQL", blank=True) > > tabulka = models.CharField(u"Tabuľka", max_length=200, blank=True, > > help_text=u"Tabuľka v ktorej sú gid a geom pre danú vrstvu") > > transparent = models.BooleanField(u"Transparent") > > zoom_level = models.IntegerField(u"Zoom level", default=1, > > help_text=u"Zoom level ktory sa použije pri zoomovaní na objekt pri > > vyhľadávaní") > > sql_hladanie = models.TextField(u"Vyhľadávací SQL", blank=True) > > > > class Meta: > > ordering = ['kategoria','poradie'] > > verbose_name_plural = u"vrstvy" > > > > *** My environment details: > > OS: Debian Etch with python 2.4 > > Django version: 1.0, also tested on new 1.0.1 with same results > > Database: PostgreSQL 8.1 > > > > *** It looks like the bug #3924 which should be allready closed. > > > > Can anybody give me some hint where to look for the solution ? > > > > Thanks a lot > > -- > > Ivan > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---