-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add layer model * Add import function * Add vector tile url * Add tests * Add fields on Layer * Add API * Add api tests * Add permission * Add multi tenants * Add installer * Remove tenants * Add layer type field * Update models * Fix tests * Add style model * Update layer fields * Add upload layer * Add style defaults * Refactor code * Add editor url * Integrate maputnik * Fix maputnik static url * Add is default * Update tests * Test * Change app name * Update maputnik * Update models * Change term Field to Attribute * Add extra metadata * Fix flake error * Fix flake error * Clean code * Fix init * Fix flake * Fix all tests not being called
- Loading branch information
Showing
92 changed files
with
4,751 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "maputnik"] | ||
path = maputnik | ||
url = [email protected]:kartoza/maputnik.git | ||
branch = cloud-native-gis |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Kartoza Context Layer Management | ||
# Kartoza Cloud Native GIS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ volumes: | |
conf-data: | ||
database: | ||
nginx-cache: | ||
backups-data: | ||
data-volume: | ||
|
||
x-common-django: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
"""Context Layer Management.""" | ||
"""Cloud Native GIS.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Cloud Native GIS.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"""Cloud Native GIS.""" | ||
|
||
from .general import * | ||
from .layer import * | ||
from .style import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# coding=utf-8 | ||
"""Cloud Native GIS.""" | ||
|
||
from django.contrib import admin | ||
|
||
from cloud_native_gis.models.general import License | ||
|
||
|
||
class LicenseAdmin(admin.ModelAdmin): | ||
"""License admin.""" | ||
|
||
list_display = ( | ||
'name', 'description' | ||
) | ||
|
||
|
||
admin.site.register(License, LicenseAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# coding=utf-8 | ||
"""Cloud Native GIS.""" | ||
|
||
from django.contrib import admin | ||
from django.utils.safestring import mark_safe | ||
|
||
from cloud_native_gis.forms.layer import LayerForm, LayerUploadForm | ||
from cloud_native_gis.models.layer import Layer, LayerAttributes | ||
from cloud_native_gis.models.layer_upload import LayerUpload | ||
from cloud_native_gis.tasks import import_data | ||
from cloud_native_gis.utils.layer import layer_api_url, MAPUTNIK_URL | ||
|
||
|
||
class LayerAttributeInline(admin.TabularInline): | ||
"""LayerAttribute inline.""" | ||
|
||
model = LayerAttributes | ||
extra = 0 | ||
|
||
def has_add_permission(self, request, obj): | ||
"""Disable add permission.""" | ||
return False | ||
|
||
|
||
@admin.action(description='Import data') | ||
def start_upload_data(modeladmin, request, queryset): | ||
"""Import data of layer.""" | ||
for layer in queryset: | ||
import_data.delay(layer.pk) | ||
|
||
|
||
class LayerAdmin(admin.ModelAdmin): | ||
"""Layer admin.""" | ||
|
||
list_display = ( | ||
'unique_id', 'name', 'created_by', 'created_at', 'tile_url', 'editor' | ||
) | ||
form = LayerForm | ||
inlines = [LayerAttributeInline] | ||
filter_horizontal = ['styles'] | ||
|
||
def get_form(self, request, *args, **kwargs): | ||
"""Return form.""" | ||
form = super(LayerAdmin, self).get_form(request, *args, **kwargs) | ||
form.user = request.user | ||
return form | ||
|
||
def get_queryset(self, request): | ||
"""Return queryset for current request.""" | ||
self.request = request | ||
return super().get_queryset(request) | ||
|
||
def tile_url(self, obj: Layer): | ||
"""Return tile_url.""" | ||
return obj.absolute_tile_url(self.request) | ||
|
||
def field_names(self, obj: Layer): | ||
"""Return fields.""" | ||
return obj.field_names | ||
|
||
def editor(self, obj: Layer): | ||
"""Return fields.""" | ||
return mark_safe( | ||
f"<a target='__blank__' href='{MAPUTNIK_URL}?" | ||
f"api-url={layer_api_url(obj, self.request)}" | ||
f"'>Editor</a>" | ||
) | ||
|
||
editor.allow_tags = True | ||
|
||
|
||
class LayerUploadAdmin(admin.ModelAdmin): | ||
"""Layer admin.""" | ||
|
||
list_display = ( | ||
'created_at', 'created_by', 'layer', 'status', 'progress', 'note' | ||
) | ||
list_filter = ['layer', 'status'] | ||
actions = [start_upload_data] | ||
form = LayerUploadForm | ||
|
||
def get_form(self, request, *args, **kwargs): | ||
"""Return form.""" | ||
form = super(LayerUploadAdmin, self).get_form(request, *args, **kwargs) | ||
form.user = request.user | ||
return form | ||
|
||
|
||
admin.site.register(Layer, LayerAdmin) | ||
admin.site.register(LayerUpload, LayerUploadAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# coding=utf-8 | ||
"""Cloud Native GIS.""" | ||
|
||
from django.contrib import admin | ||
|
||
from cloud_native_gis.forms.style import StyleForm | ||
from cloud_native_gis.models.style import Style | ||
|
||
|
||
class StyleAdmin(admin.ModelAdmin): | ||
"""Layer Style admin.""" | ||
|
||
form = StyleForm | ||
list_display = ( | ||
'name', 'created_by', 'created_at' | ||
) | ||
|
||
def get_form(self, request, *args, **kwargs): | ||
"""Return form.""" | ||
form = super(StyleAdmin, self).get_form(request, *args, **kwargs) | ||
form.user = request.user | ||
return form | ||
|
||
|
||
admin.site.register(Style, StyleAdmin) |
Empty file.
Oops, something went wrong.