Tuesday, October 2, 2012

Re: Django 1.4.1, multiple geometry fields problem

2.10.2012 14:06, George Silva kirjoitti:
> This is puzzling. I'm on 1.4.1 and I have models with two geometric
> columns, without a hitch.
>
> The only interesting thing I can see is that you are using SRID =
> settings.4326 on extent. Is that correct?

Nope. Normally it's something totally different depending on customer
(and picked from settings file). I just tried qicly replace it by more
common WGS84...

Maybe it's Oracle spesific or are you using Oracle as well?

> On Tue, Oct 2, 2012 at 7:52 AM, Jani Tiainen <redetin@gmail.com
> <mailto:redetin@gmail.com>> wrote:
>
> Hi,
>
> I've several models that contains two geometry fields (following is
> simplified example):
>
> class NetDiagram(models.Model):
> # Columns
> name = models.CharField(max_length=__60, blank=True, null=True)
>
> location = models.GeometryField(_("__Center"),
> db_column='location', srid=4326, null=True, blank=True)
> extent = models.GeometryField(_("__Extent"),
> db_column='extent', srid=settings.4326, null=True, blank=True)
>
> objects = models.GeoManager()
>
>
> Now when trying to save model like that I get:
>
> Traceback (most recent call last):
> File
> "c:\users\jtiai\work\keycom-__dev-std\prj\keycom\keycom_net___diagram\diagram\entity___diagram_builder.py",
> line 134, in _save_to_database
> netdiagram.save()
> File
> "C:\Users\jtiai\Work\keycom-__dev-std\lib\site-packages\__django\db\models\base.py",
> line 463, in save
> self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
> File
> "C:\Users\jtiai\Work\keycom-__dev-std\lib\site-packages\__django\db\models\base.py",
> line 551, in save_base
> result = manager._insert([self], fields=fields,
> return_id=update_pk, using=using, raw=raw)
> File
> "C:\Users\jtiai\Work\keycom-__dev-std\lib\site-packages\__django\db\models\manager.py",
> line 203, in _insert
> return insert_query(self.model, objs, fields, **kwargs)
> File
> "C:\Users\jtiai\Work\keycom-__dev-std\lib\site-packages\__django\db\models\query.py",
> line 1576, in insert_query
> return query.get_compiler(using=__using).execute_sql(return_id)
> File
> "C:\Users\jtiai\Work\keycom-__dev-std\lib\site-packages\__django\db\models\sql\compiler.__py",
> line 909, in execute_sql
> for sql, params in self.as_sql():
> File
> "C:\Users\jtiai\Work\keycom-__dev-std\lib\site-packages\__django\db\models\sql\compiler.__py",
> line 886, in as_sql
> for val in values
> File
> "C:\Users\jtiai\Work\keycom-__dev-std\lib\site-packages\__django\contrib\gis\db\__backends\oracle\compiler.py",
> line 25, in placeholder
> param_idx = self.query.columns.index(__field.column)
> AttributeError: 'InsertQuery' object has no attribute 'columns'
>
>
> Error is consistent and happens when there is two or more geometry
> fields on a single model.
>
> Same code worked on 1.3 flawlessly.
>
> --
> Jani Tiainen
>
> - Well planned is half done and a half done has been sufficient
> before...
>
> --
> 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
> <mailto:django-users@googlegroups.com>.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@__googlegroups.com
> <mailto:django-users%2Bunsubscribe@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/__group/django-users?hl=en
> <http://groups.google.com/group/django-users?hl=en>.
>
>
>
>
> --
> George R. C. Silva
>
> Desenvolvimento em GIS
> http://geoprocessamento.net
> http://blog.geoprocessamento.net
>
> --
> 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
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment