geoDjango - coercing to Unicode: need string or buffer, LineString found
I'm running a Django installation with geoDjango, and have created a model like this:

<pre>#models.py
from django.contrib.gis.db import models

class Route(models.Model):
	name = models.CharField(max_length=100)

	path = models.LineStringField(srid=4326)
	objects = models.GeoManager()
	
	def __unicode__(self):
		return str(self.path)
</pre>

This worked, and I was able to create linestring objects, within terminal, and admittedly I never got them to really show, but that was more with my displaying not being fully finished yet. 

But then I saw a screencast, although from 2008, with the geodjango creator - bronn, where he got an openlayer open street map inteface on the admin page, and I followed his instructions adding an admin.py with an OSMGeoAdmin ending up like this:

<pre>#admin.py
from django.contrib.gis import admin
from myproject.georoute.models import Route


class RouteAdmin(admin.OSMGeoAdmin):
	search_fields = ('name',)

admin.site.register(Route, RouteAdmin)
</pre>

This is also working fine - I get a map on which I can draw a linestring, but when i try to save it - or if I have a Route object already created and try to view the Route list on adminpage - I get an error. More specifically *"coercing to Unicode: need string or buffer, LineString found"* and from what I understand this comes from trying to unicode a object that doesn't have a __ unicode__ function(or something like this).

So I checked the linestring object definition and there was no unicode function so I did a feeble attempt of adding one, with no luck.

So here I am, stumped. Anyone knows how I may solve this problem?
geoDjango - coercing to Unicode: need string or buffer, LineString found
===

I'm running a Django installation with geoDjango, and have created a model like this:

<pre>#models.py
from django.contrib.gis.db import models

class Route(models.Model):
	name = models.CharField(max_length=100)

	path = models.LineStringField(srid=4326)
	objects = models.GeoManager()
	
	def __unicode__(self):
		return str(self.path)
</pre>

This worked, and I was able to create linestring objects, within terminal, and admittedly I never got them to really show, but that was more with my displaying not being fully finished yet. 

But then I saw a screencast, although from 2008, with the geodjango creator - bronn, where he got an openlayer open street map inteface on the admin page, and I followed his instructions adding an admin.py with an OSMGeoAdmin ending up like this:

<pre>#admin.py
from django.contrib.gis import admin
from myproject.georoute.models import Route


class RouteAdmin(admin.OSMGeoAdmin):
	search_fields = ('name',)

admin.site.register(Route, RouteAdmin)
</pre>

This is also working fine - I get a map on which I can draw a linestring, but when i try to save it - or if I have a Route object already created and try to view the Route list on adminpage - I get an error. More specifically *"coercing to Unicode: need string or buffer, LineString found"* and from what I understand this comes from trying to unicode a object that doesn't have a __ unicode__ function(or something like this).

So I checked the linestring object definition and there was no unicode function so I did a feeble attempt of adding one, with no luck.

So here I am, stumped. Anyone knows how I may solve this problem?