Re: Django 1.4.1, multiple geometry fields problem

2012-10-02 Thread Jani Tiainen
Well bug was closed because it fixed the issue back then. I suspect that 
internals of query has been changed between 1.3 and 1.4 that causes now 
a new problem.


Main issue is that when inserting or updating value cx_Oracle 
interpreted NULL value for OBJECT field when placeholder (%s)  as a 
CHAR. (since it's Oracle user type actually). And insertion or update 
failed.


As a solution it was implemented so that when ever encountering None 
value for geometry field placeholder and actual value was removed from 
the whole insert clause.


Now I think that internals how to figure out position of parameter and 
it's value was changed and there is not stuff that small if-part 
requires to work. It just requires someone with deeper knowledge of ORM 
than me to update that fix so it will work in newer versions of Django 
as well.


If someone else is encountering this issue I raised ticket 
https://code.djangoproject.com/ticket/19058



2.10.2012 15:55, George Silva kirjoitti:

Well, the bug was closed. You can try inserting empty geometries, but
then, you would need to recheck them if they are something before using.
A property might suit you well in this case.

if self.geometry.empty:
 return None


Hackish, but it's Oracle Spatial :o


And even that might work that is not an option for two reasons:
1) Models were working fine with previous version of Django (1.3)
2) I've more than 300 models which I really won't modify


On Tue, Oct 2, 2012 at 9:49 AM, Jani Tiainen mailto:rede...@gmail.com>> wrote:

I guess all this is related to special munging required by Oracle:

https://code.djangoproject.__com/ticket/10888



2.10.2012 15:12, George Silva kirjoitti:

Then it's probably Oracle, which is riddled with bugs on the
spatial part.

I'm using PostGIS.

On Tue, Oct 2, 2012 at 8:38 AM, Jani Tiainen mailto:rede...@gmail.com>
>> wrote:


 2.10.2012 14:34, Jani Tiainen kirjoitti:

 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?


 It might be Oracle spesific since I recall that there was
something
 done long time ago for Oracle and NULL values... And it
only happens
 if one or both fields are None (NULL) but if I provide data
for both
 fields it works.


 On Tue, Oct 2, 2012 at 7:52 AM, Jani Tiainen
 mailto:rede...@gmail.com>
>
  

Re: Django 1.4.1, multiple geometry fields problem

2012-10-02 Thread George Silva
Well, the bug was closed. You can try inserting empty geometries, but then,
you would need to recheck them if they are something before using. A
property might suit you well in this case.

if self.geometry.empty:
> return None


Hackish, but it's Oracle Spatial :o

On Tue, Oct 2, 2012 at 9:49 AM, Jani Tiainen  wrote:

> I guess all this is related to special munging required by Oracle:
>
> https://code.djangoproject.**com/ticket/10888
>
>
> 2.10.2012 15:12, George Silva kirjoitti:
>
>> Then it's probably Oracle, which is riddled with bugs on the spatial part.
>>
>> I'm using PostGIS.
>>
>> On Tue, Oct 2, 2012 at 8:38 AM, Jani Tiainen > > wrote:
>>
>>
>> 2.10.2012 14:34, Jani Tiainen kirjoitti:
>>
>> 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?
>>
>>
>> It might be Oracle spesific since I recall that there was something
>> done long time ago for Oracle and NULL values... And it only happens
>> if one or both fields are None (NULL) but if I provide data for both
>> fields it works.
>>
>>
>> On Tue, Oct 2, 2012 at 7:52 AM, Jani Tiainen
>> mailto:rede...@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",
>>
>>  li

Re: Django 1.4.1, multiple geometry fields problem

2012-10-02 Thread Jani Tiainen

I guess all this is related to special munging required by Oracle:

https://code.djangoproject.com/ticket/10888


2.10.2012 15:12, George Silva kirjoitti:

Then it's probably Oracle, which is riddled with bugs on the spatial part.

I'm using PostGIS.

On Tue, Oct 2, 2012 at 8:38 AM, Jani Tiainen mailto:rede...@gmail.com>> wrote:


2.10.2012 14:34, Jani Tiainen kirjoitti:

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?


It might be Oracle spesific since I recall that there was something
done long time ago for Oracle and NULL values... And it only happens
if one or both fields are None (NULL) but if I provide data for both
fields it works.


On Tue, Oct 2, 2012 at 7:52 AM, Jani Tiainen
mailto:rede...@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@g

Re: Django 1.4.1, multiple geometry fields problem

2012-10-02 Thread George Silva
Then it's probably Oracle, which is riddled with bugs on the spatial part.

I'm using PostGIS.

On Tue, Oct 2, 2012 at 8:38 AM, Jani Tiainen  wrote:

>
> 2.10.2012 14:34, Jani Tiainen kirjoitti:
>
>  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?
>>
>
> It might be Oracle spesific since I recall that there was something done
> long time ago for Oracle and NULL values... And it only happens if one or
> both fields are None (NULL) but if I provide data for both fields it works.
>
>
>  On Tue, Oct 2, 2012 at 7:52 AM, Jani Tiainen >> > 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
>>> >> >.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscribe@__goo**glegroups.com
>>> 
>>> >> **>.
>>> For more options, visit this group at
>>> 
>>> 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.

Re: Django 1.4.1, multiple geometry fields problem

2012-10-02 Thread Jani Tiainen


2.10.2012 14:34, Jani Tiainen kirjoitti:

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?


It might be Oracle spesific since I recall that there was something done 
long time ago for Oracle and NULL values... And it only happens if one 
or both fields are None (NULL) but if I provide data for both fields it 
works.



On Tue, Oct 2, 2012 at 7:52 AM, Jani Tiainen mailto:rede...@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
.
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
.




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



Re: Django 1.4.1, multiple geometry fields problem

2012-10-02 Thread Jani Tiainen

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 mailto:rede...@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
.
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
.




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



Re: Django 1.4.1, multiple geometry fields problem

2012-10-02 Thread George Silva
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?

On Tue, Oct 2, 2012 at 7:52 AM, Jani Tiainen  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.
> 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
> .
>
>


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



Django 1.4.1, multiple geometry fields problem

2012-10-02 Thread Jani Tiainen

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