How to use the cartoview.fields.ListField function in cartoview

To help you get started, we’ve selected a few cartoview 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 cartologic / cartoview / cartoview / layers / migrations / 0001_initial.py View on Github external
('connections', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Layer',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='base_resource.BaseModel')),
                ('name', models.CharField(max_length=255)),
                ('attribution', models.TextField(blank=True, null=True)),
                ('bounding_box', cartoview.fields.ListField(default=[0, 0, 0, 0], validators=[cartoview.validators.ListValidator(max_length=4, min_length=4)])),
                ('projection', models.CharField(max_length=30, validators=[cartoview.layers.validators.validate_projection])),
                ('valid', models.BooleanField(default=True)),
                ('url', models.URLField(blank=True, null=True, verbose_name='layer URL')),
                ('tile_size', cartoview.fields.ListField(default=[256, 256], validators=[cartoview.validators.ListValidator(max_length=2, min_length=2)])),
                ('urls', cartoview.fields.ListField(blank=True, null=True)),
                ('wrap_x', models.BooleanField(default=True, help_text='Whether to wrap the world horizontally.')),
                ('is_base', models.BooleanField(default=False)),
                ('extra', jsonfield.fields.JSONField(default=dict)),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='layers', to=settings.AUTH_USER_MODEL)),
                ('server', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='layers', to='connections.Server')),
            ],
            options={
                'abstract': False,
                'unique_together': {('name', 'server')},
            },
            bases=('base_resource.basemodel',),
        ),
github cartologic / cartoview / cartoview / maps / models.py View on Github external
geonode_id = models.IntegerField(null=True, blank=True)
    title_ar = models.CharField(max_length=255, default="بدون عنوان", help_text="بدون عنوان")
    description_ar = models.TextField(
        null=True, blank=True, default="بدون وصف", help_text="بدون وصف")
    abstract_ar = models.TextField(
        null=True, blank=True, default="بدون نبذه مختصره", help_text="بدون نبذه مختصره")
    site = models.ForeignKey(Site, related_name='site_maps',
                             on_delete=models.CASCADE, null=True, blank=True)
    bounding_box = ListField(null=True, blank=True, default=[0, 0, 0, 0],
                             validators=[ListValidator(min_length=4,
                                                       max_length=4), ])
    projection = models.CharField(
        max_length=30,
        blank=False,
        null=False, validators=[validate_projection, ], default="EPSG:3857")
    center = ListField(null=False, blank=False, default=[0, 0], validators=[
                       ListValidator(min_length=2, max_length=2), ])
    constrain_rotation = models.BooleanField(default=True)
    enable_rotation = models.BooleanField(default=True)
    max_zoom = models.IntegerField(default=28, validators=[
        MaxValueValidator(28),
        MinValueValidator(0)
    ])
    min_zoom = models.IntegerField(default=0, validators=[
        MaxValueValidator(28),
        MinValueValidator(0)
    ])
    zoom_factor = models.IntegerField(default=2, validators=[
        MaxValueValidator(28),
        MinValueValidator(1)
    ])
    zoom = models.FloatField(default=6, validators=[
github cartologic / cartoview / cartoview / app_manager / migrations / 0002_appinstance_appstore_apptype_bookmark.py View on Github external
migrations.CreateModel(
            name='AppType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, unique=True)),
            ],
            options={
                'ordering': ['-name'],
            },
        ),
        migrations.CreateModel(
            name='Bookmark',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='base_resource.BaseModel')),
                ('name', models.CharField(default='No Name Provided', max_length=255)),
                ('extent', cartoview.fields.ListField(default=[0, 0, 0, 0], validators=[cartoview.validators.ListValidator(max_length=4, min_length=4)])),
                ('projection', models.CharField(max_length=30, validators=[cartoview.layers.validators.validate_projection])),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
            ],
            bases=('base_resource.basemodel',),
        ),
        migrations.CreateModel(
            name='AppInstance',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='base_resource.BaseModel')),
                ('config', jsonfield.fields.JSONField(blank=True, default=dict, null=True)),
                ('app', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='instances', to='app_manager.App')),
            ],
            bases=('base_resource.basemodel',),
        ),
github cartologic / cartoview / cartoview / layers / models.py View on Github external
class BaseLayer(BaseModel):
    name = models.CharField(max_length=255)
    attribution = models.TextField(null=True, blank=True)
    bounding_box = ListField(null=False, blank=False, default=[0, 0, 0, 0], validators=[
                             ListValidator(min_length=4, max_length=4), ])
    projection = models.CharField(max_length=30, blank=False, null=False,
                                  validators=[validate_projection, ])
    server = models.ForeignKey(Server, on_delete=models.CASCADE,
                               related_name='layers')
    valid = models.BooleanField(default=True)
    owner = models.ForeignKey(get_user_model(), on_delete=models.CASCADE,
                              related_name="layers", blank=True, null=True)
    url = models.URLField(verbose_name='layer URL', null=True, blank=True)
    tile_size = ListField(null=False, blank=False, default=[256, 256], validators=[
                          ListValidator(min_length=2, max_length=2), ])
    urls = ListField(null=True, blank=True)
    wrap_x = models.BooleanField(help_text="Whether to wrap the world horizontally.", default=True)
    is_base = models.BooleanField(default=False, null=False, blank=False)
    @property
    def server_type(self):
        if not self.server:
            return None
        return self.server.server_type

    @property
    def server_url(self):
        if self.server:
            return self.server.url
        return None

    @property
    def server_operations(self):
github cartologic / cartoview / cartoview / layers / migrations / 0001_initial.py View on Github external
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('connections', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Layer',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='base_resource.BaseModel')),
                ('name', models.CharField(max_length=255)),
                ('attribution', models.TextField(blank=True, null=True)),
                ('bounding_box', cartoview.fields.ListField(default=[0, 0, 0, 0], validators=[cartoview.validators.ListValidator(max_length=4, min_length=4)])),
                ('projection', models.CharField(max_length=30, validators=[cartoview.layers.validators.validate_projection])),
                ('valid', models.BooleanField(default=True)),
                ('url', models.URLField(blank=True, null=True, verbose_name='layer URL')),
                ('tile_size', cartoview.fields.ListField(default=[256, 256], validators=[cartoview.validators.ListValidator(max_length=2, min_length=2)])),
                ('urls', cartoview.fields.ListField(blank=True, null=True)),
                ('wrap_x', models.BooleanField(default=True, help_text='Whether to wrap the world horizontally.')),
                ('is_base', models.BooleanField(default=False)),
                ('extra', jsonfield.fields.JSONField(default=dict)),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='layers', to=settings.AUTH_USER_MODEL)),
                ('server', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='layers', to='connections.Server')),
            ],
            options={
                'abstract': False,
                'unique_together': {('name', 'server')},
            },
            bases=('base_resource.basemodel',),
        ),
github cartologic / cartoview / cartoview / layers / models.py View on Github external
class BaseLayer(BaseModel):
    name = models.CharField(max_length=255)
    attribution = models.TextField(null=True, blank=True)
    bounding_box = ListField(null=False, blank=False, default=[0, 0, 0, 0], validators=[
                             ListValidator(min_length=4, max_length=4), ])
    projection = models.CharField(max_length=30, blank=False, null=False,
                                  validators=[validate_projection, ])
    server = models.ForeignKey(Server, on_delete=models.CASCADE,
                               related_name='layers')
    valid = models.BooleanField(default=True)
    owner = models.ForeignKey(get_user_model(), on_delete=models.CASCADE,
                              related_name="layers", blank=True, null=True)
    url = models.URLField(verbose_name='layer URL', null=True, blank=True)
    tile_size = ListField(null=False, blank=False, default=[256, 256], validators=[
                          ListValidator(min_length=2, max_length=2), ])
    urls = ListField(null=True, blank=True)
    wrap_x = models.BooleanField(help_text="Whether to wrap the world horizontally.", default=True)
    is_base = models.BooleanField(default=False, null=False, blank=False)
    @property
    def server_type(self):
        if not self.server:
            return None
        return self.server.server_type

    @property
    def server_url(self):
        if self.server:
            return self.server.url
        return None
github cartologic / cartoview / cartoview / layers / models.py View on Github external
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from django.urls import reverse_lazy
from guardian.shortcuts import assign_perm

from .validators import validate_projection


class BaseLayer(BaseModel):
    name = models.CharField(max_length=255)
    attribution = models.TextField(null=True, blank=True)
    bounding_box = ListField(null=False, blank=False, default=[0, 0, 0, 0], validators=[
                             ListValidator(min_length=4, max_length=4), ])
    projection = models.CharField(max_length=30, blank=False, null=False,
                                  validators=[validate_projection, ])
    server = models.ForeignKey(Server, on_delete=models.CASCADE,
                               related_name='layers')
    valid = models.BooleanField(default=True)
    owner = models.ForeignKey(get_user_model(), on_delete=models.CASCADE,
                              related_name="layers", blank=True, null=True)
    url = models.URLField(verbose_name='layer URL', null=True, blank=True)
    tile_size = ListField(null=False, blank=False, default=[256, 256], validators=[
                          ListValidator(min_length=2, max_length=2), ])
    urls = ListField(null=True, blank=True)
    wrap_x = models.BooleanField(help_text="Whether to wrap the world horizontally.", default=True)
    is_base = models.BooleanField(default=False, null=False, blank=False)
    @property
    def server_type(self):
github cartologic / cartoview / cartoview / maps / models.py View on Github external
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models


class Map(BaseModel):
    geonode_id = models.IntegerField(null=True, blank=True)
    title_ar = models.CharField(max_length=255, default="بدون عنوان", help_text="بدون عنوان")
    description_ar = models.TextField(
        null=True, blank=True, default="بدون وصف", help_text="بدون وصف")
    abstract_ar = models.TextField(
        null=True, blank=True, default="بدون نبذه مختصره", help_text="بدون نبذه مختصره")
    site = models.ForeignKey(Site, related_name='site_maps',
                             on_delete=models.CASCADE, null=True, blank=True)
    bounding_box = ListField(null=True, blank=True, default=[0, 0, 0, 0],
                             validators=[ListValidator(min_length=4,
                                                       max_length=4), ])
    projection = models.CharField(
        max_length=30,
        blank=False,
        null=False, validators=[validate_projection, ], default="EPSG:3857")
    center = ListField(null=False, blank=False, default=[0, 0], validators=[
                       ListValidator(min_length=2, max_length=2), ])
    constrain_rotation = models.BooleanField(default=True)
    enable_rotation = models.BooleanField(default=True)
    max_zoom = models.IntegerField(default=28, validators=[
        MaxValueValidator(28),
        MinValueValidator(0)
    ])
    min_zoom = models.IntegerField(default=0, validators=[
        MaxValueValidator(28),
github cartologic / cartoview / cartoview / maps / migrations / 0001_initial.py View on Github external
initial = True

    dependencies = [
        ('base_resource', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('sites', '0002_alter_domain_unique'),
        ('layers', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Map',
            fields=[
                ('basemodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='base_resource.BaseModel')),
                ('bounding_box', cartoview.fields.ListField(blank=True, default=[0, 0, 0, 0], null=True, validators=[cartoview.validators.ListValidator(max_length=4, min_length=4)])),
                ('projection', models.CharField(default='EPSG:3857', max_length=30, validators=[cartoview.layers.validators.validate_projection])),
                ('center', cartoview.fields.ListField(default=[0, 0], validators=[cartoview.validators.ListValidator(max_length=2, min_length=2)])),
                ('constrain_rotation', models.BooleanField(default=True)),
                ('enable_rotation', models.BooleanField(default=True)),
                ('max_zoom', models.IntegerField(default=28, validators=[django.core.validators.MaxValueValidator(28), django.core.validators.MinValueValidator(0)])),
                ('min_zoom', models.IntegerField(default=0, validators=[django.core.validators.MaxValueValidator(28), django.core.validators.MinValueValidator(0)])),
                ('zoom_factor', models.IntegerField(default=2, validators=[django.core.validators.MaxValueValidator(28), django.core.validators.MinValueValidator(1)])),
                ('zoom', models.FloatField(default=6, validators=[django.core.validators.MaxValueValidator(28), django.core.validators.MinValueValidator(1)])),
                ('rotation', models.IntegerField(default=0)),
                ('render_options', jsonfield.fields.JSONField(blank=True, default=dict)),
                ('layers', models.ManyToManyField(blank=True, to='layers.Layer')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='maps', to=settings.AUTH_USER_MODEL)),
                ('site', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='site_maps', to='sites.Site')),
            ],
            bases=('base_resource.basemodel',),
        ),