diff --git a/hypha/public/funds/templates/public_funds/fund_page.html b/hypha/public/funds/templates/public_funds/fund_page.html index 4a83c0a346..606c5d2a78 100644 --- a/hypha/public/funds/templates/public_funds/fund_page.html +++ b/hypha/public/funds/templates/public_funds/fund_page.html @@ -2,7 +2,7 @@ {% block header_modifier %}header--grey-pixels{% endblock %} {# Dont include fixed apply button on this page #} {% block apply_button %}{% endblock %} -{% load wagtailcore_tags wagtailimages_tags navigation_tags static %} +{% load wagtailcore_tags wagtailimages_tags static %} {% block content %} {% include "public_funds/includes/fund_apply_cta.html" with page=page apply_page=page.application_type %} diff --git a/hypha/public/funds/templates/public_funds/lab_page.html b/hypha/public/funds/templates/public_funds/lab_page.html index 7cd1cb76d2..8e916c2aa3 100644 --- a/hypha/public/funds/templates/public_funds/lab_page.html +++ b/hypha/public/funds/templates/public_funds/lab_page.html @@ -2,7 +2,7 @@ {% block header_modifier %}header--grey-pixels{% endblock %} {# Dont include fixed apply button on this page #} {% block apply_button %}{% endblock %} -{% load wagtailcore_tags wagtailimages_tags navigation_tags static %} +{% load wagtailcore_tags wagtailimages_tags static %} {% block content %} {% include "public_funds/includes/lab_apply_cta.html" %} diff --git a/hypha/public/home/management/commands/export_public_pages_json.py b/hypha/public/home/management/commands/export_public_pages_json.py deleted file mode 100644 index 195e8d4a26..0000000000 --- a/hypha/public/home/management/commands/export_public_pages_json.py +++ /dev/null @@ -1,147 +0,0 @@ -import json -import os - -from django.conf import settings -from django.core.management.base import BaseCommand - -from hypha.public.news.models import NewsPage -from hypha.public.people.models import PersonPage -from hypha.public.projects.models import ProjectPage - - -class Command(BaseCommand): - help = "Export public pages to json files." - - def get_streamfield_as_blocks(self, field): - streamfields = [] - for block in field: - if hasattr(block.value, "render_as_block"): - streamfields.append(str(block.value.render_as_block())) - else: - streamfields.append(str(block.value)) - body = "".join(streamfields) - return body - - def get_authors(self, items): - related = [] - for item in items.all(): - related.append(item.author.slug) - return ",".join(related) - - def get_related_pages(self, items): - related = [] - for item in items.all(): - related.append(item.source_page.slug) - return ",".join(related) - - def get_types(self, items): - related = [] - for item in items.all(): - try: - related.append(item.news_type.title) - except AttributeError: - related.append(item.person_type.title) - return ",".join(related) - - def get_funding(self, items): - funding = [] - for item in items.all(): - funding.append( - { - "year": str(item.year), - "duration": str(item.duration), - "value": int(item.value), - "source": str(item.source).strip(), - } - ) - return funding - - def get_contact(self, items): - contact = [] - for item in items.all(): - contact.append( - { - "url": str(item.url), - "service": str(item.service), - } - ) - return contact - - def get_image(self, item): - try: - return item.file.path.replace( - f"{settings.BASE_DIR}/media/original_images/", "" - ) - except AttributeError: - pass - - def handle(self, *args, **options): - try: - os.mkdir("exports") - except FileExistsError: - pass - - # News export - newsdata = [] - for page in NewsPage.objects.live().public(): - newsdata.append( - { - "oldid": int(page.id), - "title": str(page.title).strip(), - "date": str(page.first_published_at.isoformat()), - "lastmod": str(page.latest_revision_created_at.isoformat()), - "authors": self.get_authors(page.authors), - "types": self.get_types(page.news_types), - "related_pages": self.get_related_pages(page.related_pages), - "related_projects": self.get_related_pages(page.related_projects), - "intro": str(page.introduction).strip(), - "body": self.get_streamfield_as_blocks(page.body), - "slug": str(page.slug).strip(), - } - ) - with open("exports/news.json", "w", newline="") as jsonfile: - json.dump(newsdata, jsonfile) - - # People export - peopledata = [] - for page in PersonPage.objects.live().public(): - peopledata.append( - { - "oldid": int(page.id), - "title": str(page.title).strip(), - "date": str(page.first_published_at.isoformat()), - "lastmod": str(page.latest_revision_created_at.isoformat()), - "active": bool(page.active), - "photo": self.get_image(page.photo), - "jobtitle": str(page.title).strip(), - "types": self.get_types(page.person_types), - "email": str(page.email).strip(), - "web": str(page.website).strip(), - "intro": str(page.introduction).strip(), - "body": self.get_streamfield_as_blocks(page.biography), - "slug": str(page.slug).strip(), - } - ) - with open("exports/people.json", "w", newline="") as jsonfile: - json.dump(peopledata, jsonfile) - - # Project export - projectdata = [] - for page in ProjectPage.objects.live().public(): - projectdata.append( - { - "oldid": int(page.id), - "title": str(page.title).strip(), - "date": str(page.first_published_at.isoformat()), - "icon": self.get_image(page.icon), - "lastmod": str(page.latest_revision_created_at.isoformat()), - "funding": self.get_funding(page.funding), - "contact": self.get_contact(page.contact_details), - "related_pages": self.get_related_pages(page.related_pages), - "intro": str(page.introduction).strip(), - "body": self.get_streamfield_as_blocks(page.body), - "slug": str(page.slug).strip(), - } - ) - with open("exports/projects.json", "w", newline="") as jsonfile: - json.dump(projectdata, jsonfile) diff --git a/hypha/public/home/templates/home/home_page.html b/hypha/public/home/templates/home/home_page.html index 3afe23c5d5..e3764c83da 100644 --- a/hypha/public/home/templates/home/home_page.html +++ b/hypha/public/home/templates/home/home_page.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load cache wagtailcore_tags wagtailimages_tags static navigation_tags util_tags %} +{% load cache wagtailcore_tags wagtailimages_tags static util_tags %} {% block header %} {% image page.header_image fill-1440x740 as header_image %} @@ -32,12 +32,6 @@ -
- {% cache 3600 navigation__primary wagtail_site %} - {% primarynav %} - {% endcache %} -
-
@@ -49,9 +43,6 @@ {% endif %}
- {% cache 3600 navigation__primary wagtail_site %} - {% primarynav %} - {% endcache %}
diff --git a/hypha/public/navigation/migrations/0004_delete_navigationsettings.py b/hypha/public/navigation/migrations/0004_delete_navigationsettings.py new file mode 100644 index 0000000000..49219b2e6e --- /dev/null +++ b/hypha/public/navigation/migrations/0004_delete_navigationsettings.py @@ -0,0 +1,15 @@ +# Generated by Django 4.2.9 on 2024-01-10 07:42 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("navigation", "0003_alter_navigationsettings_primary_navigation"), + ] + + operations = [ + migrations.DeleteModel( + name="NavigationSettings", + ), + ] diff --git a/hypha/public/navigation/models.py b/hypha/public/navigation/models.py index 14125c1bae..e69de29bb2 100644 --- a/hypha/public/navigation/models.py +++ b/hypha/public/navigation/models.py @@ -1,34 +0,0 @@ -from django.utils.translation import gettext_lazy as _ -from modelcluster.models import ClusterableModel -from wagtail import blocks -from wagtail.admin.panels import FieldPanel -from wagtail.contrib.settings.models import BaseSiteSetting -from wagtail.fields import StreamField - -from hypha.core.wagtail.admin import register_public_site_setting - - -class LinkBlock(blocks.StructBlock): - page = blocks.PageChooserBlock() - title = blocks.CharBlock( - help_text=_("Leave blank to use the page's own title"), required=False - ) - - class Meta: - template = ("navigation/blocks/menu_item.html",) - - -@register_public_site_setting(icon="", classnames="icon icon-list-ul") -class NavigationSettings(BaseSiteSetting, ClusterableModel): - primary_navigation = StreamField( - [ - ("link", LinkBlock()), - ], - blank=True, - help_text=_("Main site navigation"), - use_json_field=True, - ) - - panels = [ - FieldPanel("primary_navigation"), - ] diff --git a/hypha/public/navigation/templates/navigation/primarynav.html b/hypha/public/navigation/templates/navigation/primarynav.html deleted file mode 100644 index 57b587c8af..0000000000 --- a/hypha/public/navigation/templates/navigation/primarynav.html +++ /dev/null @@ -1,10 +0,0 @@ -{% load wagtailcore_tags %} - -{% include "utils/includes/login_button.html" with class="link--mobile-standout" %} -Apply diff --git a/hypha/public/navigation/templatetags/__init__.py b/hypha/public/navigation/templatetags/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/hypha/public/navigation/templatetags/navigation_tags.py b/hypha/public/navigation/templatetags/navigation_tags.py deleted file mode 100644 index 28a37cf459..0000000000 --- a/hypha/public/navigation/templatetags/navigation_tags.py +++ /dev/null @@ -1,20 +0,0 @@ -from django import template -from wagtail.models import Site - -from hypha.public.navigation.models import NavigationSettings - -register = template.Library() - - -# Primary nav snippets -@register.inclusion_tag("navigation/primarynav.html", takes_context=True) -def primarynav(context): - request = context["request"] - site_from_request = Site.find_for_request(request) - site = context.get("PUBLIC_SITE", site_from_request) - apply_site = context.get("APPLY_SITE", site_from_request) - return { - "primarynav": NavigationSettings.for_site(site).primary_navigation, - "request": request, - "APPLY_SITE": apply_site, - } diff --git a/hypha/public/news/blocks.py b/hypha/public/news/blocks.py deleted file mode 100644 index b9ae574dda..0000000000 --- a/hypha/public/news/blocks.py +++ /dev/null @@ -1,21 +0,0 @@ -from django.utils.translation import gettext_lazy as _ -from wagtail import blocks - -from hypha.public.utils.blocks import StoryBlock - - -class AwesomeTableWidgetBlock(blocks.StructBlock): - table_id = blocks.CharBlock( - classname="title", - help_text=_( - "Please enter only table id from embed code. Table widget code creates automatically." - ), - ) - - class Meta: - icon = "table" - template = "news/blocks/awesome_table_widget_block.html" - - -class NewsStoryBlock(StoryBlock): - awesome_table_widget = AwesomeTableWidgetBlock() diff --git a/hypha/public/news/feeds.py b/hypha/public/news/feeds.py deleted file mode 100644 index 26739305a9..0000000000 --- a/hypha/public/news/feeds.py +++ /dev/null @@ -1,87 +0,0 @@ -from django.conf import settings -from django.contrib.syndication.views import Feed -from django.core.cache import cache -from django.db.models.functions import Coalesce -from django.http import Http404 -from wagtail.models import Site - -from hypha.public.news.models import NewsFeedSettings, NewsIndex, NewsPage, NewsType - - -class NewsFeed(Feed): - def __call__(self, request, *args, **kwargs): - try: - self.site = Site.objects.get(is_default_site=True) - except Site.DoesNotExist as e: - raise Http404 from e - self.news_feed_settings = NewsFeedSettings.for_site(site=self.site) - - cache_key = self.get_cache_key(*args, **kwargs) - response = cache.get(cache_key) - - if response is None: - response = super().__call__(request, *args, **kwargs) - cache.set(cache_key, response, settings.FEED_CACHE_TIMEOUT) - - return response - - def get_cache_key(self, *args, **kwargs): - tag = "" - for key, value in kwargs.items(): - tag += f"-{key}-{value}" - return f"{self.__class__.__module__}{tag}" - - def title(self): - return self.news_feed_settings.news_title - - def description(self): - return self.news_feed_settings.news_description - - def link(self): - news_index = NewsIndex.objects.live().public().first() - if news_index: - return news_index.full_url - return self.site.root_url - - def items(self): - return ( - NewsPage.objects.live() - .public() - .annotate(date=Coalesce("publication_date", "first_published_at")) - .order_by("-date")[:20] - ) - - def item_title(self, item): - return item.title - - def item_description(self, item): - return item.body - - def item_pubdate(self, item): - return item.display_date - - -class NewsTypeFeed(NewsFeed): - def get_object(self, request, news_type): - return NewsType.objects.get(id=news_type) - - def title(self, obj): - return self.news_feed_settings.news_per_type_title.format(news_type=obj) - - def description(self, obj): - return self.news_feed_settings.news_per_type_description.format(news_type=obj) - - def link(self, obj): - news_index = NewsIndex.objects.live().public().first() - if news_index: - return f"{news_index.full_url}?news_type={obj.id}" - return self.site.root_url - - def items(self, obj): - return ( - NewsPage.objects.live() - .public() - .filter(news_types__news_type=obj) - .annotate(date=Coalesce("publication_date", "first_published_at")) - .order_by("-date")[:20] - ) diff --git a/hypha/public/news/management/commands/__init__.py b/hypha/public/news/management/commands/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/hypha/public/news/management/commands/migrate_news.py b/hypha/public/news/management/commands/migrate_news.py deleted file mode 100644 index 2edc0cc0aa..0000000000 --- a/hypha/public/news/management/commands/migrate_news.py +++ /dev/null @@ -1,157 +0,0 @@ -import argparse -import json -from datetime import datetime, timezone - -from django.core.management.base import BaseCommand -from django.db import transaction -from django.db.utils import IntegrityError -from wagtail.admin.rich_text.converters.editor_html import EditorHTMLConverter -from wagtail.rich_text import RichText - -from hypha.apply.categories.categories_seed import CATEGORIES -from hypha.apply.categories.models import Category, Option -from hypha.apply.users.models import User -from hypha.public.news.models import ( - NewsIndex, - NewsPage, - NewsPageAuthor, - NewsPageNewsType, - NewsProjectRelatedPage, - NewsType, -) -from hypha.public.people.models import PersonPage -from hypha.public.projects.models import ProjectPage - - -class Command(BaseCommand): - help = "News migration script. Requires a source JSON file." - data = [] - terms = {} - whitelister = EditorHTMLConverter().whitelister - - def add_arguments(self, parser): - parser.add_argument( - "source", type=argparse.FileType("r"), help="Migration source JSON file" - ) - - @transaction.atomic - def handle(self, *args, **options): - # Prepare the list of categories. - for item in CATEGORIES: - category, _ = Category.objects.get_or_create(name=item["category"]) - option, _ = Option.objects.get_or_create( - value=item["name"], category=category - ) - self.terms[item["tid"]] = option - - self.parent_page = NewsIndex.objects.first() - - if not self.parent_page: - raise NewsIndex.DoesNotExist("News Index Page must exist to import News") - - self.types = { - "4": NewsType.objects.get_or_create(title="Press Clip")[0], - "5": NewsType.objects.get_or_create(title="Program Update")[0], - "388": NewsType.objects.get_or_create(title="Research")[0], - } - - with options["source"] as json_data: - self.data = json.load(json_data) - - counter = 0 - for id in self.data: - self.process(id) - counter += 1 - - self.stdout.write(f"Imported {counter} submissions.") - - def process(self, id): - node = self.data[id] - - try: - news = NewsPage.objects.get(drupal_id=node["nid"]) - except NewsPage.DoesNotExist: - news = NewsPage(drupal_id=node["nid"]) - - # TODO timezone? - news.submit_time = datetime.fromtimestamp(int(node["created"]), timezone.utc) - news.publication_date = datetime.fromtimestamp( - int(node["created"]), timezone.utc - ) - - news.title = node["title"] - - news.introduction = self.get_field(node, "field_preamble") - - cleaned_body = self.whitelister.clean(self.get_field(node, "body")) - news.body = [("paragraph", RichText(cleaned_body))] - - news.news_types.clear() - for news_type in self.ensure_iterable(node["field_article_type"]): - news.news_types.add( - NewsPageNewsType( - news_type=self.types[news_type["tid"]], - ) - ) - - news.related_projects.clear() - for project in self.ensure_iterable(node["field_article_project"]): - try: - project_page = ProjectPage.objects.get(drupal_id=project["target_id"]) - except ProjectPage.DoesNotExist: - self.stdout.write(f"Missing project ID {project['target_id']}") - else: - news.related_projects.add( - NewsProjectRelatedPage( - page=project_page, - ) - ) - - news.authors.clear() - for author in self.ensure_iterable(node["field_article_authors"]): - user = User.objects.get(drupal_id=author["target_id"]) - news.authors.add( - NewsPageAuthor(author=PersonPage.objects.get(title=user.full_name)) - ) - - try: - user = User.objects.get(drupal_id=node["uid"]) - except User.DoesNotExist: - pass - else: - user_map = {"Dan Blah": 'Dan "Blah" Meredith'} - name = user_map.get(user.full_name, user.full_name) - # missing amin jobran - try: - news.authors.add( - NewsPageAuthor(author=PersonPage.objects.get(title=name)) - ) - except PersonPage.DoesNotExist: - self.stdout.write(f"Missing person page: {name}") - - try: - if not news.get_parent(): - self.parent_page.add_child(instance=news) - news.save_revision().publish() - self.stdout.write( - f"Processed \"{node['title'].encode('utf8')}\" ({node['nid']})" - ) - except IntegrityError: - self.stdout.write( - f"*** Skipped \"{node['title']}\" ({node['nid']}) due to IntegrityError" - ) - - def ensure_iterable(self, value): - if isinstance(value, dict): - value = [value] - return value - - def get_field(self, node, field): - try: - return node[field]["safe_value"] - except TypeError: - pass - try: - return node[field]["value"] - except TypeError: - return "" diff --git a/hypha/public/news/migrations/0016_remove_newsindex_header_image_and_more.py b/hypha/public/news/migrations/0016_remove_newsindex_header_image_and_more.py new file mode 100644 index 0000000000..8759fea6e5 --- /dev/null +++ b/hypha/public/news/migrations/0016_remove_newsindex_header_image_and_more.py @@ -0,0 +1,92 @@ +# Generated by Django 4.2.9 on 2024-01-10 07:24 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("news", "0015_remove_newsindex_social_image_and_more"), + ] + + operations = [ + migrations.RemoveField( + model_name="newsindex", + name="header_image", + ), + migrations.RemoveField( + model_name="newsindex", + name="listing_image", + ), + migrations.RemoveField( + model_name="newsindex", + name="page_ptr", + ), + migrations.RemoveField( + model_name="newspage", + name="header_image", + ), + migrations.RemoveField( + model_name="newspage", + name="listing_image", + ), + migrations.RemoveField( + model_name="newspage", + name="page_ptr", + ), + migrations.RemoveField( + model_name="newspageauthor", + name="author", + ), + migrations.RemoveField( + model_name="newspageauthor", + name="source_page", + ), + migrations.RemoveField( + model_name="newspagenewstype", + name="news_type", + ), + migrations.RemoveField( + model_name="newspagenewstype", + name="page", + ), + migrations.RemoveField( + model_name="newspagerelatedpage", + name="page", + ), + migrations.RemoveField( + model_name="newspagerelatedpage", + name="source_page", + ), + migrations.RemoveField( + model_name="newsprojectrelatedpage", + name="page", + ), + migrations.RemoveField( + model_name="newsprojectrelatedpage", + name="source_page", + ), + migrations.DeleteModel( + name="NewsFeedSettings", + ), + migrations.DeleteModel( + name="NewsIndex", + ), + migrations.DeleteModel( + name="NewsPage", + ), + migrations.DeleteModel( + name="NewsPageAuthor", + ), + migrations.DeleteModel( + name="NewsPageNewsType", + ), + migrations.DeleteModel( + name="NewsPageRelatedPage", + ), + migrations.DeleteModel( + name="NewsProjectRelatedPage", + ), + migrations.DeleteModel( + name="NewsType", + ), + ] diff --git a/hypha/public/news/models.py b/hypha/public/news/models.py index 99636040df..e69de29bb2 100644 --- a/hypha/public/news/models.py +++ b/hypha/public/news/models.py @@ -1,180 +0,0 @@ -from django.conf import settings -from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator -from django.db import models -from django.db.models.functions import Coalesce -from django.utils.translation import gettext_lazy as _ -from modelcluster.fields import ParentalKey -from pagedown.widgets import PagedownWidget -from wagtail.admin.panels import FieldPanel, InlinePanel, PageChooserPanel -from wagtail.contrib.settings.models import BaseSiteSetting -from wagtail.fields import StreamField -from wagtail.models import Orderable -from wagtail.search import index - -from hypha.core.wagtail.admin import register_public_site_setting -from hypha.public.utils.models import BasePage, RelatedPage - -from .blocks import NewsStoryBlock - - -class NewsType(models.Model): - title = models.CharField(max_length=128) - - def __str__(self): - return self.title - - -class NewsPageNewsType(models.Model): - page = ParentalKey("news.NewsPage", related_name="news_types") - news_type = models.ForeignKey( - "NewsType", related_name="+", on_delete=models.CASCADE - ) - - panels = [FieldPanel("news_type")] - - def __str__(self): - return self.news_type.title - - -class NewsPageRelatedPage(RelatedPage): - source_page = ParentalKey("news.NewsPage", related_name="related_pages") - - -class NewsProjectRelatedPage(RelatedPage): - page = models.ForeignKey( - "wagtailcore.Page", - on_delete=models.CASCADE, - related_name="news_mentions", - ) - source_page = ParentalKey("news.NewsPage", related_name="related_projects") - - panels = [ - PageChooserPanel("page", "projects.ProjectPage"), - ] - - -class NewsPageAuthor(Orderable): - source_page = ParentalKey("news.NewsPage", related_name="authors") - author = models.ForeignKey( - "wagtailcore.Page", - on_delete=models.PROTECT, - related_name="+", - ) - - panels = [PageChooserPanel("author", "people.PersonPage")] - - -class NewsPage(BasePage): - subpage_types = [] - parent_page_types = ["NewsIndex"] - - drupal_id = models.IntegerField(null=True, blank=True, editable=False) - - # It's datetime for easy comparison with first_published_at - publication_date = models.DateTimeField( - null=True, - blank=True, - help_text=_( - "Use this field to override the date that the news item appears to have been published." - ), - ) - introduction = models.TextField(blank=True) - body = StreamField( - NewsStoryBlock(block_counts={"awesome_table_widget": {"max_num": 1}}), - use_json_field=True, - ) - - search_fields = BasePage.search_fields + [ - index.SearchField("introduction"), - index.SearchField("body"), - ] - - content_panels = BasePage.content_panels + [ - FieldPanel("publication_date"), - InlinePanel("authors", label=_("Authors")), - FieldPanel("introduction"), - FieldPanel("body"), - InlinePanel("news_types", label=_("News types")), - InlinePanel("related_projects", label=_("Mentioned project")), - InlinePanel("related_pages", label=_("Related pages")), - ] - - @property - def display_date(self): - if self.publication_date: - return self.publication_date - else: - return self.first_published_at - - def get_absolute_url(self): - return self.full_url - - -class NewsIndex(BasePage): - subpage_types = ["NewsPage"] - parent_page_types = ["home.HomePage"] - - introduction = models.TextField(blank=True) - - content_panels = BasePage.content_panels + [ - FieldPanel("introduction", widget=PagedownWidget()) - ] - - def get_context(self, request, *args, **kwargs): - news = ( - NewsPage.objects.live() - .public() - .descendant_of(self) - .annotate(date=Coalesce("publication_date", "first_published_at")) - .order_by("-date") - .prefetch_related( - "news_types__news_type", - "authors__author", - ) - ) - - if request.GET.get("news_type") and request.GET.get("news_type").isdigit(): - news = news.filter(news_types__news_type=request.GET.get("news_type")) - - # Pagination - page = request.GET.get("page", 1) - paginator = Paginator(news, settings.DEFAULT_PER_PAGE) - try: - news = paginator.page(page) - except PageNotAnInteger: - news = paginator.page(1) - except EmptyPage: - news = paginator.page(paginator.num_pages) - - context = super().get_context(request, *args, **kwargs) - context.update( - news=news, - # Only show news types that have been used - news_types=NewsPageNewsType.objects.all() - .values_list("news_type__pk", "news_type__title") - .distinct(), - ) - return context - - -@register_public_site_setting -class NewsFeedSettings(BaseSiteSetting): - news_title = models.CharField( - max_length=255, help_text=_("The title of the main news feed.") - ) - news_description = models.CharField( - max_length=255, help_text=_("The description of the main news feed.") - ) - - news_per_type_title = models.CharField( - max_length=255, - help_text=_( - "The title of the news feed by type. Use {news_type} to insert the type name." - ), - ) - news_per_type_description = models.CharField( - max_length=255, - help_text=_( - "The description of the news feed by type. Use {news_type} to insert the type name." - ), - ) diff --git a/hypha/public/news/templates/news/blocks/awesome_table_widget_block.html b/hypha/public/news/templates/news/blocks/awesome_table_widget_block.html deleted file mode 100644 index 8b26c0ab0e..0000000000 --- a/hypha/public/news/templates/news/blocks/awesome_table_widget_block.html +++ /dev/null @@ -1,2 +0,0 @@ -
- diff --git a/hypha/public/news/templates/news/news_index.html b/hypha/public/news/templates/news/news_index.html deleted file mode 100644 index 5120015874..0000000000 --- a/hypha/public/news/templates/news/news_index.html +++ /dev/null @@ -1,56 +0,0 @@ -{% extends "base.html" %} -{% load wagtailcore_tags wagtailimages_tags static markdown_tags bleach_tags %} -{% block feedlinks %}{% endblock %} -{% block body_class %}light-grey-bg{% endblock %} - -{% block content %} -
- - {% if page.introduction %} -

{{ page.introduction|markdown|bleach }}

- {% endif %} - -
-
- -
- -
- - {% if news %} - - {% include "includes/pagination.html" with paginator_page=news %} - {% else %} - {# no items #} - {% endif %} - -
-{% endblock %} diff --git a/hypha/public/news/templates/news/news_page.html b/hypha/public/news/templates/news/news_page.html deleted file mode 100644 index 2164a308ef..0000000000 --- a/hypha/public/news/templates/news/news_page.html +++ /dev/null @@ -1,46 +0,0 @@ -{% extends "base.html" %} -{% load wagtailcore_tags wagtailimages_tags static %} - -{% block content %} -
- -
- - {% if page.authors.all %} - | By: - {% for author in page.authors.all %} - {{ author.author }} - {% endfor %} - {% endif %} -
- - {% if page.introduction %} -

{{ page.introduction }}

- {% endif %} - -
- {% include_block page.body %} -
- - {% if page.news_types.all %} - - {% endif %} - - {% if page.related_projects.all %} -

Projects Mentioned

- - {% endif %} - -
- - {% include "includes/relatedcontent.html" with related_documents=page.related_documents.all related_pages=page.related_pages.all %} - -{% endblock %} diff --git a/hypha/public/standardpages/templates/standardpages/index_page.html b/hypha/public/standardpages/templates/standardpages/index_page.html index 30b50ecfcf..c26a2c8a34 100644 --- a/hypha/public/standardpages/templates/standardpages/index_page.html +++ b/hypha/public/standardpages/templates/standardpages/index_page.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load wagtailcore_tags wagtailimages_tags navigation_tags static markdown_tags bleach_tags %} +{% load wagtailcore_tags wagtailimages_tags static markdown_tags bleach_tags %} {% block body_class %}light-grey-bg{% endblock %} {% block main_class %}wrapper--bottom-space{% endblock %} {% block content %} diff --git a/hypha/public/standardpages/templates/standardpages/information_page.html b/hypha/public/standardpages/templates/standardpages/information_page.html index 53f0ceda8a..4796c8aae7 100644 --- a/hypha/public/standardpages/templates/standardpages/information_page.html +++ b/hypha/public/standardpages/templates/standardpages/information_page.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load wagtailcore_tags wagtailimages_tags navigation_tags static %} +{% load wagtailcore_tags wagtailimages_tags static %} {% block content %} diff --git a/hypha/public/urls.py b/hypha/public/urls.py index 4c9a378fa1..0c4ee88379 100644 --- a/hypha/public/urls.py +++ b/hypha/public/urls.py @@ -1,13 +1,8 @@ from django.urls import path -from .news import feeds as news_feeds from .partner import views as partner_views urlpatterns = [ - path("news/feed/", news_feeds.NewsFeed(), name="news_feed"), - path( - "news//feed/", news_feeds.NewsTypeFeed(), name="news_type_feed" - ), path( "about/portfolio/", partner_views.InvestmentTableView.as_view(), diff --git a/hypha/public/utils/wagtail_hooks.py b/hypha/public/utils/wagtail_hooks.py index d6d603b409..95262046b2 100644 --- a/hypha/public/utils/wagtail_hooks.py +++ b/hypha/public/utils/wagtail_hooks.py @@ -1,33 +1,6 @@ from wagtail import hooks -from wagtail.contrib.modeladmin.options import ( - ModelAdmin, - ModelAdminGroup, - modeladmin_register, -) from wagtailcache.cache import clear_cache -from hypha.public.news.models import NewsType -from hypha.public.people.models import PersonType - - -class NewsTypeModelAdmin(ModelAdmin): - model = NewsType - menu_icon = "tag" - - -class PersonTypeModelAdmin(ModelAdmin): - model = PersonType - menu_icon = "tag" - - -class TaxonomiesModelAdminGroup(ModelAdminGroup): - menu_label = "Taxonomies" - items = (NewsTypeModelAdmin, PersonTypeModelAdmin) - menu_icon = "tag" - - -modeladmin_register(TaxonomiesModelAdminGroup) - @hooks.register("after_create_page") @hooks.register("after_edit_page") diff --git a/hypha/templates/base-apply.html b/hypha/templates/base-apply.html index c0416d1030..c27ea7c5f1 100644 --- a/hypha/templates/base-apply.html +++ b/hypha/templates/base-apply.html @@ -1,4 +1,4 @@ -{% load i18n static wagtailcore_tags wagtailimages_tags navigation_tags util_tags hijack cookieconsent_tags %} +{% load i18n static wagtailcore_tags wagtailimages_tags util_tags hijack cookieconsent_tags %} {% wagtail_site as current_site %} {% get_current_language as LANGUAGE_CODE %} diff --git a/hypha/templates/base.html b/hypha/templates/base.html index a4dff98fe0..fe80084c3d 100644 --- a/hypha/templates/base.html +++ b/hypha/templates/base.html @@ -1,4 +1,4 @@ -{% load static cache wagtailcore_tags wagtailimages_tags navigation_tags util_tags cookieconsent_tags i18n %} +{% load static cache wagtailcore_tags wagtailimages_tags util_tags cookieconsent_tags i18n %} {% wagtail_site as current_site %} {% get_current_language as LANGUAGE_CODE %} @@ -116,10 +116,6 @@
{% if settings.utils.SystemMessagesSettings.nav_content %} {{ settings.utils.SystemMessagesSettings.nav_content|safe }} - {% else %} - {% cache 3600 navigation__primary current_site %} - {% primarynav %} - {% endcache %} {% endif %}
@@ -145,10 +141,6 @@
{% if settings.utils.SystemMessagesSettings.nav_content %} {{ settings.utils.SystemMessagesSettings.nav_content|safe }} - {% else %} - {% cache 3600 navigation__primary current_site %} - {% primarynav %} - {% endcache %} {% endif %} diff --git a/public/sandbox_db.dump b/public/sandbox_db.dump index 95411895d2..ec648b1d11 100644 Binary files a/public/sandbox_db.dump and b/public/sandbox_db.dump differ