Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#20140 closed Bug (invalid)

core/ treats string as integer an throws TypeError

Reported by: stadtpirat11@… Owned by: nobody
Component: Core (Other) Version: 1.5
Severity: Release blocker Keywords: core, python3, validators
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Implement django.contrib.gis.admin

Run your Project with Django
$ python3 runserver

Visit http://localhost:8000/admin/stadtpirat_climbs/fels/add/

Add data to fels
Code is

class Fels(models.Model):
    name = models.CharField(max_length="255")
    beschreibung = models.TextField()
    polygon = models.PolygonField()
    punkt   = models.PointField()
    objects = models.GeoManager()

Request Method: POST
Request URL: http://localhost:8000/admin/ stadtpirat_climbs/fels/add/

Django Version: 1.5
Python Version: 3.2.3
Installed Applications:
 ' stadtpirat_climbs')
Installed Middleware:

File "/usr/local/lib/python3.2/dist-packages/django/core/handlers/" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.2/dist-packages/django/contrib/admin/" in wrapper
  372.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/usr/local/lib/python3.2/dist-packages/django/utils/" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.2/dist-packages/django/views/decorators/" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.2/dist-packages/django/contrib/admin/" in inner
  202.             return view(request, *args, **kwargs)
File "/usr/local/lib/python3.2/dist-packages/django/utils/" in _wrapper
  25.             return bound_func(*args, **kwargs)
File "/usr/local/lib/python3.2/dist-packages/django/utils/" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.2/dist-packages/django/utils/" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File "/usr/local/lib/python3.2/dist-packages/django/db/" in inner
  223.                 return func(*args, **kwargs)
File "/usr/local/lib/python3.2/dist-packages/django/contrib/admin/" in add_view
  989.             if form.is_valid():
File "/usr/local/lib/python3.2/dist-packages/django/forms/" in is_valid
  126.         return self.is_bound and not bool(self.errors)
File "/usr/local/lib/python3.2/dist-packages/django/forms/" in _get_errors
  117.             self.full_clean()
File "/usr/local/lib/python3.2/dist-packages/django/forms/" in full_clean
  272.         self._clean_fields()
File "/usr/local/lib/python3.2/dist-packages/django/forms/" in _clean_fields
  287.                     value = field.clean(value)
File "/usr/local/lib/python3.2/dist-packages/django/forms/" in clean
  156.         self.run_validators(value)
File "/usr/local/lib/python3.2/dist-packages/django/forms/" in run_validators
  135.                 v(value)
File "/usr/local/lib/python3.2/dist-packages/django/core/" in __call__
  166.         if, self.limit_value):
File "/usr/local/lib/python3.2/dist-packages/django/core/" in <lambda>
  194.     compare = lambda self, a, b: a > b

Exception Type: TypeError at /admin/ stadtpirat_climbs/fels/add/
Exception Value: unorderable types: int() > str()

Change History (4)

comment:1 Changed 4 years ago by stadtpirat11@…

Component: GISCore (Other)
Keywords: core validators added; admin gis removed
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Summary: Admin breaks with python3 when adding data.core/ treats string as integer an throws TypeError

I change this because I have more details.

Changing line 194 in /usr/local/lib/python3.2/dist-packages/django/core/ from

    compare = lambda self, a, b: a > b


    compare = lambda self, a, b: a > b

is a quick fix.

comment:2 Changed 4 years ago by anonymous

Typo in my previous post.
From ... to

    compare = lambda self, a, b: a > int(b)

My bad :)

comment:3 Changed 4 years ago by Claude Paroz

Resolution: invalid
Status: newclosed

max_length="255" -> max_length=255

comment:4 Changed 4 years ago by anonymous


Note: See TracTickets for help on using tickets.
Back to Top