How to use the routemap.util.customfields.BigIntegerField function in routemap

To help you get started, we’ve selected a few routemap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github waymarkedtrails / waymarked-trails-site / django / src / routemap / sites / models.py View on Github external
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

from django.contrib.gis.db import models
import routemap.util.customfields as cfields
from django.db import connection, transaction
from django.conf import settings

from osgende.tags import TagStore

class RouteTableModel(models.Model):
    """Generalized model for table with route information.
    """

    # only the fields required by the generalized functions
    # are added here
    id = cfields.BigIntegerField(primary_key=True)
    name = models.TextField(null=True)
    intnames = cfields.HStoreField()
    geom = models.GeometryField(srid=settings.DATABASES['default']['SRID'])

    def tags(self):
        if not hasattr(self,'_tags'):
            cursor = connection.cursor()
            cursor.execute("SELECT tags FROM relations WHERE id = %s", (self.id,))
            ret = cursor.fetchone()
            self._tags = TagStore(ret[0] if ret is not None else {})
        return self._tags

    def localize_name(self, locstrings):
        for locstring in locstrings:
            if locstring in self.intnames:
                if not self.name == self.intnames[locstring]:
github waymarkedtrails / waymarked-trails-site / django / src / routemap / sites / models.py View on Github external
return self._tags

    def get_id(self):
        return 'w' + str(self.id)

    class Meta:
        db_table = u'slopeways'
        db_tablespace = u'slopemap'

class JoinedWaysTableModel(models.Model):
    """Generalized model for table with joined way information.
    """

    # only the fields required by the generalized functions
    # are added here
    virtual_id = cfields.BigIntegerField()
    child = cfields.BigIntegerField(primary_key=True)

    def tags(self):
        if not hasattr(self,'_tags'):
            cursor = connection.cursor()
            cursor.execute("SELECT tags FROM ways WHERE id = %s", (self.child,))
            ret = cursor.fetchone()
            self._tags = TagStore(ret[0] if ret is not None else {})
        return self._tags

    def localize_name(self, locstrings):
        related_row = self._ways.objects.get(id=self.child)
        intnames = related_row.intnames
        name = related_row.name
        for locstring in locstrings:
            if locstring in intnames:
github waymarkedtrails / waymarked-trails-site / django / src / routemap / sites / models.py View on Github external
def get_id(self):
        return 'w' + str(self.id)

    class Meta:
        db_table = u'slopeways'
        db_tablespace = u'slopemap'

class JoinedWaysTableModel(models.Model):
    """Generalized model for table with joined way information.
    """

    # only the fields required by the generalized functions
    # are added here
    virtual_id = cfields.BigIntegerField()
    child = cfields.BigIntegerField(primary_key=True)

    def tags(self):
        if not hasattr(self,'_tags'):
            cursor = connection.cursor()
            cursor.execute("SELECT tags FROM ways WHERE id = %s", (self.child,))
            ret = cursor.fetchone()
            self._tags = TagStore(ret[0] if ret is not None else {})
        return self._tags

    def localize_name(self, locstrings):
        related_row = self._ways.objects.get(id=self.child)
        intnames = related_row.intnames
        name = related_row.name
        for locstring in locstrings:
            if locstring in intnames:
                if not name == intnames[locstring]: