Re: Bug in Admin or in my model ?

2008-11-15 Thread Karen Tracey
On Sat, Nov 15, 2008 at 2:29 PM, Ivan Mincik <[EMAIL PROTECTED]> wrote:

> On Saturday 15 November 2008 18:57, Karen Tracey wrote:
>
> > The bug in Django is that the attempt to report that your existing
> > __unicode__ method generated an error generated yet another error, and I
> > haven't quite figured that one out yet.  But if you want to make progress
> > you can just fix your __unicode__ method.
> What to do with this? Do I have to fill some bug report ?
>

No need, I opened one myself since I wanted to lay out the sequence of what
happens and I'm not entirely sure of the right fix:

http://code.djangoproject.com/ticket/9608

Karen

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Bug in Admin or in my model ?

2008-11-15 Thread Ivan Mincik

On Saturday 15 November 2008 18:57, Karen Tracey wrote:
> There's a bug both in your models and in Django, I think.  Your __unicode__
> method for class Metadata:
> 
>def __unicode__(self):
> >return "%s %s" % (self.vrstva,self.nazov)
> >
> 
> needs to be:
> 
>def __unicode__(self):
> >
>return u"%s %s" % (self.vrstva,self.nazov)
Karen, really thanks a lot for perfect guess. Problem solved.
> 
> 
> The bug in Django is that the attempt to report that your existing
> __unicode__ method generated an error generated yet another error, and I
> haven't quite figured that one out yet.  But if you want to make progress
> you can just fix your __unicode__ method.
What to do with this? Do I have to fill some bug report ?
> 
> Karen
> 
> > 
> 

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
-~--~~~~--~~--~--~---



Re: Bug in Admin or in my model ?

2008-11-15 Thread Karen Tracey
There's a bug both in your models and in Django, I think.  Your __unicode__
method for class Metadata:

   def __unicode__(self):
>return "%s %s" % (self.vrstva,self.nazov)
>

needs to be:

   def __unicode__(self):
>
   return u"%s %s" % (self.vrstva,self.nazov)


The bug in Django is that the attempt to report that your existing
__unicode__ method generated an error generated yet another error, and I
haven't quite figured that one out yet.  But if you want to make progress
you can just fix your __unicode__ method.

Karen

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Bug in Admin or in my model ?

2008-11-15 Thread Ivan Mincik

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 http://
> evanjones.ca/python-utf8.html 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 

Re: Bug in Admin or in my model ?

2008-11-15 Thread Luke Seelenbinder

You need to specify your encoding in your models file.
Like: # -*- coding: iso-8859-15 -*-
Look at http://
evanjones.ca/python-utf8.html The sixth section of the page
explains.

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
-~--~~~~--~~--~--~---



Bug in Admin or in my model ?

2008-11-15 Thread Ivan Mincik

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
-~--~~~~--~~--~--~---