-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Allow to store custom map themes (authenticathed users) (#813)
* Create model for customer themes. * Implemented CRUD custom theme. * Add constraint. * Typo * Add invalidation of project cache. * Fix test. * Remove CSFR check. * ✨ Client g3w-suite/g3w-client@0e226b2 * 🐛 Client g3w-suite/g3w-client@37adf60 * Add pydantic validation data structure. --------- Co-authored-by: wlorenzetti <lorenzett@gis3w.it> Co-authored-by: volterra79 <boccacci.francesco@gmail.com> Co-authored-by: Raruto <Raruto@users.noreply.github.com>
- Loading branch information
1 parent
005e0e5
commit 3d6637e
Showing
14 changed files
with
465 additions
and
40 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# coding=utf-8 | ||
"""" Pydantic models | ||
.. note:: This program is free software; you can redistribute it and/or modify | ||
it under the terms of the Mozilla Public License 2.0. | ||
""" | ||
|
||
__author__ = 'lorenzetti@gis3w.it' | ||
__date__ = '2024-04-17' | ||
__copyright__ = 'Copyright 2015 - 2024, Gis3w' | ||
__license__ = 'MPL 2.0' | ||
|
||
|
||
from pydantic import BaseModel | ||
from typing import List, Dict, Optional, Union | ||
|
||
|
||
class TreeItemPDModel(BaseModel): | ||
name: str | ||
id: str | ||
visible: bool | ||
|
||
|
||
class TreeNodeItemPDModel(BaseModel): | ||
name: str | ||
#mutually-exclusive: Optional[bool] = None # Todo: replace in the future '-' with '_' | ||
node: Optional[List[Union['TreeItemPDModel', TreeItemPDModel]]] = None | ||
checked: bool | ||
expanded: bool | ||
|
||
|
||
class ThemeProjectPDModel(BaseModel): | ||
layerstree: List[Union[TreeItemPDModel, TreeNodeItemPDModel]] | ||
styles: Dict[str, str] |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 3.2.25 on 2024-04-16 07:57 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('qdjango', '0116_auto_20231204_1357'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='project', | ||
name='use_map_extent_as_init_extent', | ||
field=models.BooleanField(default=False, verbose_name='Use QGIS project map start extent as webgis init extent'), | ||
), | ||
migrations.CreateModel( | ||
name='CustomerTheme', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=255, verbose_name='Theme name')), | ||
('theme', models.TextField(verbose_name='JSON theme structure')), | ||
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='qdjango.project')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
17 changes: 17 additions & 0 deletions
17
g3w-admin/qdjango/migrations/0118_customertheme_unique_name_user.py
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 @@ | ||
# Generated by Django 3.2.25 on 2024-04-16 14:49 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('qdjango', '0117_auto_20240416_0757'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddConstraint( | ||
model_name='customertheme', | ||
constraint=models.UniqueConstraint(fields=('project', 'user', 'name'), name='unique_name_user'), | ||
), | ||
] |
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
Binary file modified
BIN
+0 Bytes
(100%)
g3w-admin/qdjango/tests/data/geodata/cascade_autorelation.sqlite
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
g3w-admin/qdjango/tests/data/geodata/qgis_widget_test_data.gpkg
Binary file not shown.
Oops, something went wrong.