Skip to content

Commit

Permalink
refactor: djangocms_blog_custom… → remote_content
Browse files Browse the repository at this point in the history
This changes remote blog load to be remote anything load.

This removes the failed custom feed (archived in #874):
#874
  • Loading branch information
wesleyboar committed Sep 13, 2024
1 parent 6cd5a77 commit 7d56f8d
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 73 deletions.
5 changes: 0 additions & 5 deletions apps/djangocms_blog_customizations/apps.py

This file was deleted.

26 changes: 0 additions & 26 deletions apps/djangocms_blog_customizations/feeds.py

This file was deleted.

32 changes: 0 additions & 32 deletions apps/djangocms_blog_customizations/urls.py

This file was deleted.

File renamed without changes.
4 changes: 4 additions & 0 deletions apps/remote_content/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django.apps import AppConfig

class remoteContentAppConfig(AppConfig):
name = 'apps.remote_content'
17 changes: 17 additions & 0 deletions apps/remote_content/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import re

from django.urls import re_path
# from django.conf import settings

from .views import RemoteMarkup


app_name = 'remote_content'

# blogRemoteUrlPattern = r'^' + re.escape(settings.PORTAL_REMOTE_CONTENT_CLIENT_PATH)
urlpatterns = [
# To render a blog (or any page) from another website
# TODO: Use query parameter, not URL path
# TODO: Use settings.PORTAL_REMOTE_CONTENT_CLIENT_PATH
re_path(r'^markup/', RemoteMarkup.as_view(), name='remote_markup'),
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
from django.shortcuts import render
from django.views.generic.base import TemplateView

def BlogView(request):
return render(request, 'djangocms_blog/base.html')

class BlogRemoteView(TemplateView):
template_name = 'djangocms_blog_customizations/remote.html'
class RemoteMarkup(TemplateView):
template_name = 'remote_content/markup.html'

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
Expand All @@ -24,8 +21,8 @@ def get_context_data(self, **kwargs):
return context

def get_source_url(self):
client_path = settings.PORTAL_BLOG_REMOTE_CLIENT_PATH
source_root = settings.PORTAL_BLOG_REMOTE_SOURCE_ROOT
client_path = settings.PORTAL_REMOTE_CONTENT_CLIENT_PATH
source_root = settings.PORTAL_REMOTE_CONTENT_SOURCE_ROOT
client = urlparse(self.request.build_absolute_uri())
source = urlparse(source_root)

Expand All @@ -48,8 +45,8 @@ def get_source_markup(self, url):

# CAVEAT: Causes a view request for every resource (img/script/stylesheet)
def get_client_markup(self, source_markup):
source = urlparse(settings.PORTAL_BLOG_REMOTE_SOURCE_ROOT)
client_path = settings.PORTAL_BLOG_REMOTE_CLIENT_PATH
source = urlparse(settings.PORTAL_REMOTE_CONTENT_SOURCE_ROOT)
client_path = settings.PORTAL_REMOTE_CONTENT_CLIENT_PATH

# FAQ: No markup for bad URL or a resource specific to source wesbite
if source_markup:
Expand Down
2 changes: 1 addition & 1 deletion taccsite_cms/custom_app_settings.example.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CUSTOM_APPS = ['apps.custom_example', 'apps.djangocms_blog_customizations']
CUSTOM_APPS = ['apps.custom_example', 'apps.remote_content']
CUSTOM_MIDDLEWARE = []
STATICFILES_DIRS = ()

0 comments on commit 7d56f8d

Please sign in to comment.