Skip to content

Commit

Permalink
Merge pull request #34 from geofranzi/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
geofranzi authored Oct 7, 2023
2 parents f66cd01 + 4f140dd commit a256d61
Show file tree
Hide file tree
Showing 63 changed files with 851 additions and 558 deletions.
38 changes: 38 additions & 0 deletions config/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
WSGI config for PlantHub project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
import os
import sys
from pathlib import Path

from django.core.wsgi import get_wsgi_application

# This allows easy placement of apps within the interior
# planthub directory.
ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent
sys.path.append(str(ROOT_DIR / "planthub"))
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use
# os.environ["DJANGO_SETTINGS_MODULE"] = "config.settings.production"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
4 changes: 2 additions & 2 deletions framework/authapi/admin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from allauth.account.models import (EmailAddress, EmailConfirmation,)
from django.contrib import admin
from django.contrib.sites.models import Site

from allauth.account.models import EmailAddress, EmailConfirmation
from rest_framework.authtoken.models import Token


# Unregister classes that are not relevant for the admin backend, only internal use of registration service!
#admin.site.unregister(EmailConfirmation)
#admin.site.unregister(EmailAddress)
Expand Down
8 changes: 4 additions & 4 deletions framework/authapi/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from django.urls import include, re_path
from . import views

import django

from dj_rest_auth.registration.views import VerifyEmailView
from django.urls import (include, re_path,)

from . import views


urlpatterns = [
re_path(r'^rest/', include('dj_rest_auth.urls')),
Expand Down
9 changes: 4 additions & 5 deletions framework/authapi/views.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import django
from allauth.account.views import ConfirmEmailView
from dj_rest_auth.registration.views import RegisterView
from django.shortcuts import redirect
from rest_framework import status
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status

import django

from dj_rest_auth.registration.views import RegisterView
from allauth.account.views import ConfirmEmailView
from mapviewer.models import MapViewer


Expand Down
2 changes: 1 addition & 1 deletion framework/climate/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class ClimateConfig(AppConfig):
name = 'climate'
name = 'climate'
23 changes: 18 additions & 5 deletions framework/content/admin.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,54 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.contrib.gis import admin
from django import forms
from django.contrib.gis import admin
from suit.sortables import SortableTabularInline

from content.models import ExternalDatabase, ExternalLayer, StoryLine, StoryLineFeature, StoryLineInline, StoryLinePart, Image, Video, SatdataLayer, Country
from content.models import (Country, ExternalDatabase, ExternalLayer, Image, SatdataLayer, StoryLine, StoryLineFeature,
StoryLineInline, StoryLinePart, Video,)
from inspire.csw import delete_csw
from layers.admin import LayersAdmin
from swos.models import WetlandLayer
from swos.search_es import LayerIndex
from webgis import settings


def make_publishable(modeladmin, request, queryset):
queryset.update(publishable=True)
for item in queryset:
item.save()


make_publishable.short_description = "Mark selected layers as fit for publication"


def make_unpublishable(modeladmin, request, queryset):
queryset.update(publishable=False)
for item in queryset:
if settings.CSW_T == True:
if settings.CSW_T:
delete_csw(item)
if settings.ELASTICSEARCH == True:
if settings.ELASTICSEARCH:
LayerIndex.get(id=item.id).delete()


make_unpublishable.short_description = "Mark selected layers as unfit for publication"


def make_downloadable(modeladmin, request, queryset):
queryset.update(downloadable=True)


make_downloadable.short_description = "Mark as donwloadable"


def make_non_downloadable(modeladmin, request, queryset):
queryset.update(downloadable=False)


make_non_downloadable.short_description = "Mark as not downloadable"


# Register your models here.
class ExternalLayerAdmin(LayersAdmin):
fieldsets = LayersAdmin.fieldsets + ((None, {
Expand Down Expand Up @@ -125,7 +138,7 @@ class StoryLinePartAdmin(admin.ModelAdmin):
class SatdataLayerAdmin(LayersAdmin):
fieldsets = LayersAdmin.fieldsets + ((None, {
'classes': ('suit-tab', 'suit-tab-swos',),
'fields': ('region','thema',)
'fields': ('region', 'thema',)
}),)
list_display = ('title', 'publishable', 'downloadable', 'region', 'thema')
suit_form_tabs = LayersAdmin.suit_form_tabs + (('swos', 'SWOS'),)
Expand Down
Loading

0 comments on commit a256d61

Please sign in to comment.