Skip to content

Commit

Permalink
Preparatory for: g3w-suite/g3w-client#391
Browse files Browse the repository at this point in the history
  • Loading branch information
Raruto committed Jan 9, 2024
1 parent 89c4f98 commit c79dfee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 8 additions & 5 deletions g3w-admin/client/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@
)

from core.utils.decorators import cache_page
from django.views.decorators.cache import never_cache
from django.utils.decorators import method_decorator

# never cache initconfig response when `DEBUG = true`
production_cache = cache_page(
None,
('group_slug', 'project_type', 'project_id'),
key_prefix=settings.QDJANGO_PRJ_CACHE_KEY,
) if not settings.DEBUG else never_cache

class ClientConfigApiView(APIView):
"""
Expand All @@ -32,11 +39,7 @@ class ClientConfigApiView(APIView):
ProjectIsActivePermission
)

@method_decorator(cache_page(
None,
('group_slug', 'project_type', 'project_id'),
key_prefix=settings.QDJANGO_PRJ_CACHE_KEY
))
@method_decorator(production_cache)
def get(
self, request, format=None, group_slug=None, project_type=None, project_id=None
):
Expand Down
6 changes: 6 additions & 0 deletions g3w-admin/qdjango/api/projects/serializers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.http.request import QueryDict
from django.conf import settings
from django.utils.translation import ugettext_lazy as _, get_language
from django.urls import reverse
from rest_framework import serializers
from rest_framework.fields import empty
from owslib.wms import WebMapService
Expand Down Expand Up @@ -598,6 +599,11 @@ def readLeaf(layer, container):
# reset tokenfilter by session
self.reset_filtertoken()

ret['edit_url'] = reverse('qdjango-project-update', kwargs={
'group_slug': instance.group.slug,
'slug': instance.slug
})

return ret

class Meta:
Expand Down

0 comments on commit c79dfee

Please sign in to comment.