Hi Serge,

thank you for your reply.

I'm working on an environmental monitoring app, where I want to store, and 
serve, monitoring value on different geometries, points, tracks or polygon.
That's why I'm trying to use a polymorphic model in order to have one 
entity and multiple geometries.

Cheers

L


On Friday, February 5, 2016 at 10:51:31 AM UTC+1, Sergiy Khohlov wrote:
>
>  I would like as simple question :  Are you planning  to have some 
> advantages using this abstract class ? 
>  I’m working on  similar product  (look like you are making energy 
> pipeline system based on postgis and gjango). My product is GTS system 
> which includes POINTS (datas are received via GTS devices mounted on 
> vehicles). Polylines (car route for selected time range),  etc.  Producing 
> abstract class can decrease DB productivity. Which one functional do you 
> need in case of abstract class for different types usage ? 
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
> On Fri, Feb 5, 2016 at 11:07 AM, Luca Moiana <luca....@gmail.com 
> <javascript:>> wrote:
>
>> Hi Collin,
>>
>> Sorry for the late reply, but I still don't get the google groups;
>>
>> Yes, I am tryng to crete a models where you can choose between the three 
>> geometry types.
>>
>> I'll go back to my app and test the code you suggested and post again the 
>> error.
>>
>> thanks
>>
>>
>> On Wednesday, October 28, 2015 at 7:00:26 PM UTC+1, Collin Anderson wrote:
>>>
>>> Hello,
>>>
>>> Are you trying to combine multiple models into one, like this?
>>>
>>> class PolyModel(pdmpunto, pdmtransetto, pdmarea):
>>>     pass
>>>
>>> You could also try asking on the geodjango list: 
>>> http://groups.google.com/group/geodjango
>>>
>>> Collin
>>>
>>> On Monday, October 26, 2015 at 7:18:24 AM UTC-4, Luca Moiana wrote:
>>>>
>>>> Hi, working on my first django app, and run into a problem.
>>>>
>>>> I tend to create geodjango objects, and add all data from external 
>>>> tables with pk.
>>>>
>>>> Then I want to have different geometries 8points, lines, polygons) into 
>>>> a unique polymorphic class, can I do that?
>>>>
>>>> I have an error that I'll document later, and I'm trying to figure out 
>>>> what to do.
>>>>
>>>> Here is the model:
>>>> import datetime
>>>>
>>>> from django.db import models
>>>> from django.contrib.gis.db import models as geomodels
>>>> from django.utils import timezone
>>>> from django.forms import ModelForm
>>>> from polymorphic import PolymorphicModel
>>>>
>>>> # Geometria linea da monitorare
>>>> class geolinea(geomodels.Model):
>>>>     progetto = models.CharField(max_length=14, primary_key=True)
>>>>     geom = geomodels.MultiLineStringField()
>>>>     objects = geomodels.GeoManager()
>>>>     def __str__(self):
>>>>             return '%s' % (self.progetto)
>>>> # Oggetto Progetto soggetto a PMA
>>>> class linea(models.Model):
>>>>     progetto = models.ForeignKey(geolinea)
>>>>     nome = models.CharField(max_length=200)
>>>>     TENSIONE = (
>>>>         ('132', '132kV'),
>>>>         ('150', '150kV'),
>>>>         ('220', '220kV'),
>>>>         ('380', '380kV'),
>>>>     )
>>>>     tensione = models.CharField(max_length=5,
>>>>                                 choices=TENSIONE)
>>>>     def __str__(self):
>>>>         return '%s' % (self.nome)
>>>>
>>>> # Geometria dei pdm
>>>> class pdmpunto(geomodels.Model):
>>>>     linea = models.ForeignKey(linea)
>>>>     numero = models.CharField(max_length=3)
>>>>     geom = geomodels.PointField()
>>>>     objects = geomodels.GeoManager()
>>>>
>>>> class pdmtransetto(geomodels.Model):
>>>>     linea = models.ForeignKey(linea)
>>>>     numero = models.CharField(max_length=3)
>>>>     geom = geomodels.LineStringField()
>>>>     objects = geomodels.GeoManager()
>>>>
>>>> class pdmarea(geomodels.Model):
>>>>     linea = models.ForeignKey(linea)
>>>>     numero = models.CharField(max_length=3)
>>>>     geom = geomodels.PolygonField()
>>>>     objects = geomodels.GeoManager()
>>>>
>>>> class pdm(PolymorphicModel):
>>>>     numero = models.CharField(max_length=14, primary_key=True)
>>>> class punto(pdm):
>>>>     rifpunto = models.ForeignKey(pdmpunto)
>>>> class transetto(pdm):
>>>>     riftransetto = models.ForeignKey(pdmtransetto)
>>>> class area(pdm):
>>>>     rifarea = models.ForeignKey(pdmarea)
>>>>
>>>>
>>>>
>>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/cd243d25-0aff-446d-b9c9-cb5682d9bdf3%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/cd243d25-0aff-446d-b9c9-cb5682d9bdf3%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/70b475b9-34d7-498c-ad1f-d27f020d02d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to