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 <rede...@gmail.com> wrote:

> I guess all this is related to special munging required by Oracle:
>
> https://code.djangoproject.**com/ticket/10888<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 <rede...@gmail.com
>> <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
>>             <rede...@gmail.com <mailto:rede...@gmail.com>
>>             <mailto:rede...@gmail.com <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
>>             
>> <mailto:django-users@**googlegroups.com<django-users@googlegroups.com>
>> >
>>                  
>> <mailto:django-users@__googleg**roups.com<http://googlegroups.com>
>>
>>             
>> <mailto:django-users@**googlegroups.com<django-users@googlegroups.com>
>> >>.
>>                  To unsubscribe from this group, send email to
>>                  
>> django-users+unsubscribe@__goo**__glegroups.com<http://goo__glegroups.com>
>>             <http://googlegroups.com>
>>                  
>> <mailto:django-users%__**2bunsubscr...@googlegroups.com<django-users%25__2bunsubscr...@googlegroups.com>
>>             
>> <mailto:django-users%**252Bunsubscribe@googlegroups.**com<django-users%25252bunsubscr...@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>
>>             
>> <http://groups.google.com/__**group/django-users?hl=en<http://groups.google.com/__group/django-users?hl=en>
>> >
>>
>>                  
>> <http://groups.google.com/__**group/django-users?hl=en<http://groups.google.com/__group/django-users?hl=en>
>>             
>> <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
>>
>>             
>> <http://blog.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
>>             
>> <mailto:django-users@**googlegroups.com<django-users@googlegroups.com>
>> >.
>>             To unsubscribe from this group, send email to
>>             
>> django-users+unsubscribe@__goo**glegroups.com<http://googlegroups.com>
>>             
>> <mailto:django-users%**2bunsubscr...@googlegroups.com<django-users%252bunsubscr...@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>
>>             
>> <http://groups.google.com/**group/django-users?hl=en<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
>>     <mailto:django-users@**googlegroups.com<django-users@googlegroups.com>
>> >.
>>     To unsubscribe from this group, send email to
>>     django-users+unsubscribe@__goo**glegroups.com<http://googlegroups.com>
>>     
>> <mailto:django-users%**2bunsubscr...@googlegroups.com<django-users%252bunsubscr...@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>
>>     
>> <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 <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<django-users%2bunsubscr...@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>
>> .
>>
>
>
> --
> 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 <django-users%2bunsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to