Opened 7 years ago

Closed 7 years ago

#6357 closed (fixed)

'unicode' object has no attribute 'wkt'

Reported by: sheats@… Owned by: jbronn
Component: GIS Version: gis
Severity: Keywords: gis admin wkt
Cc: jbronn@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Using the GIS branch...

When you save an object in the admin that is spatially enabled the error "'unicode' object has no attribute 'wkt'" is thrown when there is a field validation error on another field. For example, if you have a URLField and a MultipolygonField on a model and try to save an object with an invalid URL in the URLField you'll get the error. Here are the details:

Template error:
In template /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/admin/templates/widget/default.html, error at line 1

Caught an exception while rendering: 'unicode' object has no attribute 'wkt'
1 : {% load admin_modify %} {% output_all bound_field.form_fields %}

2 :

Traceback:
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/template/debug.py" in render_node

  1. result = node.render(context)

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/template/init.py" in render

  1. return func(*resolved_vars)

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/admin/templatetags/admin_modify.py" in output_all

  1. return u.join([force_unicode(f) for f in form_fields])

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/utils/encoding.py" in force_unicode

  1. s = unicode(s)

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/oldforms/init.py" in unicode

  1. return force_unicode(self.formfield.render(self.data))

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/gis/oldforms/init.py" in render

  1. return super(WKTField, self).render(data.wkt)

Exception Type: AttributeError at /admin/schools/school/1257/
Exception Value: 'unicode' object has no attribute 'wkt'

Change History (3)

comment:1 Changed 7 years ago by Simon Greenhill <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from SVN to gis

comment:2 Changed 7 years ago by jbronn

  • Cc jbronn@… added
  • Keywords gis admin wkt added
  • Owner changed from nobody to jbronn
  • Status changed from new to assigned

The traceback suggests this is a bug. Thanks!

comment:3 Changed 7 years ago by jbronn

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [7026]) gis: Fixed #6357, and added a validator to WKTField.

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