Skip to content

Commit

Permalink
Merge pull request #672 from kartoza/develop
Browse files Browse the repository at this point in the history
Downloader: add readme file + filter by organisation (#655)
  • Loading branch information
meomancer authored Mar 22, 2024
2 parents 69e690d + a6adbbe commit a00a2c2
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deployment/.env
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ PYTHONPATH=/home/web/django_project:/geonode
USE_DEFAULT_GEOSERVER_STYLE=False
INITIAL_FIXTURES=True

VERSION=4.4.10
VERSION=4.4.11
ISTSOS_VERSION=2.4.1-2

# ------ GEOSERVER ------
Expand Down
22 changes: 22 additions & 0 deletions django_project/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Django: Run server",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver", "8000"
],
"django": true,
"justMyCode": true,
"env": {
"DJANGO_SETTINGS_MODULE": "core.settings.dev"
}
}
]
}
1 change: 1 addition & 0 deletions django_project/core/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
"set_layers_permissions",
"refresh_materialized_views",
"generate_data_countries_cache",
"generate_data_organisations_cache",
"generate_data_wells_cache",
"generate_well_measurement_cache",
"generate_uploader_report",
Expand Down
2 changes: 1 addition & 1 deletion django_project/gwml2
Submodule gwml2 updated from 4898bb to 7d3e05
23 changes: 23 additions & 0 deletions django_project/igrac/migrations/0013_auto_20240322_0315.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.20 on 2024-03-22 03:15

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('igrac', '0012_sitepreference_banner'),
]

operations = [
migrations.AddField(
model_name='sitepreference',
name='download_readme_text',
field=models.TextField(blank=True, help_text='Readme text to be included in the download zip file.', null=True),
),
migrations.AddField(
model_name='sitepreference',
name='ggmn_download_readme_text',
field=models.TextField(blank=True, help_text='Readme text to be included in the download zip file of GGMN data type.', null=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.20 on 2024-03-22 04:18

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('igrac', '0013_auto_20240322_0315'),
]

operations = [
migrations.AddField(
model_name='groundwaterlayer',
name='is_ggmn_layer',
field=models.BooleanField(default=False, help_text='Indicate that this layer is ggmn layer. It will be used to construct the data to be downloaded.'),
),
]
24 changes: 23 additions & 1 deletion django_project/igrac/models/groundwater_layer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib.gis.db import models
from django.contrib.postgres.fields import ArrayField
from django.db.models.signals import post_delete
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver

from geonode.layers.models import Dataset
Expand All @@ -14,6 +14,13 @@ class GroundwaterLayer(models.Model):
on_delete=models.CASCADE
)
organisations = ArrayField(models.IntegerField())
is_ggmn_layer = models.BooleanField(
default=False,
help_text=(
'Indicate that this layer is ggmn layer. '
'It will be used to construct the data to be downloaded.'
)
)

def __str__(self):
return self.layer.__str__()
Expand All @@ -39,3 +46,18 @@ def groundwater_layer_deleted(
):
if instance.layer:
instance.layer.delete()


@receiver(post_save, sender=GroundwaterLayer)
def groundwater_layer_saved(
sender, instance: GroundwaterLayer, using, **kwargs
):
from gwml2.tasks.data_file_cache.country_recache import (
generate_data_all_country_cache
)
from gwml2.tasks.data_file_cache.organisation_cache import (
generate_data_all_organisation_cache
)
if instance.is_ggmn_layer:
generate_data_all_country_cache.delay()
generate_data_all_organisation_cache.delay()
10 changes: 10 additions & 0 deletions django_project/igrac/models/site_preference.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ class SitePreference(Preferences):
related_name='preference_ggmn_layer',
on_delete=models.SET_NULL
)
download_readme_text = models.TextField(
blank=True,
null=True,
help_text='Readme text to be included in the download zip file.'
)
ggmn_download_readme_text = models.TextField(
blank=True,
null=True,
help_text='Readme text to be included in the download zip file of GGMN data type.'
)
banner = models.ImageField(
upload_to='images',
null=True, blank=True,
Expand Down
2 changes: 1 addition & 1 deletion django_project/version/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.4.10
4.4.11

0 comments on commit a00a2c2

Please sign in to comment.