Свойства стилей
This commit is contained in:
parent
a979dd357a
commit
7303c48c54
@ -1,14 +1,27 @@
|
||||
import json
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
from apps.main.models.model_dinamic_layer import DynamicLayer
|
||||
from apps.main.models.model_static_layer import StaticLayer
|
||||
|
||||
from django import forms
|
||||
|
||||
|
||||
class PrettyJSONEncoder(json.JSONEncoder):
|
||||
def __init__(self, *args, indent, sort_keys, **kwargs):
|
||||
super().__init__(*args, indent=2, sort_keys=True, **kwargs)
|
||||
|
||||
|
||||
class LayerModelForm(forms.ModelForm):
|
||||
layer_style = forms.JSONField(encoder=PrettyJSONEncoder)
|
||||
|
||||
|
||||
@admin.register(StaticLayer)
|
||||
class StaticLayerAdmin(admin.ModelAdmin):
|
||||
pass
|
||||
form = LayerModelForm
|
||||
|
||||
|
||||
@admin.register(DynamicLayer)
|
||||
class DynamicLayerAdmin(admin.ModelAdmin):
|
||||
pass
|
||||
form = LayerModelForm
|
||||
|
||||
@ -35,11 +35,15 @@ def get_style_template() -> dict:
|
||||
"offsetY": -25,
|
||||
"placement": 'point',
|
||||
"maxAngle": '0.7853981633974483',
|
||||
"overflow": 'false',
|
||||
"overflow": False,
|
||||
"rotation": 0.0,
|
||||
"backgroundFill": {
|
||||
"color": '#fff'
|
||||
},
|
||||
"stroke": {
|
||||
"color": "rgba(0, 0, 0, 1)",
|
||||
"width": 1,
|
||||
},
|
||||
"backgroundStroke": {
|
||||
"color": '#000',
|
||||
"width": 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user