From a445a225e17f75fe1759a4a824911bf6ab8d831e Mon Sep 17 00:00:00 2001 From: Saurabh Kumar <theskumar@users.noreply.github.com> Date: Tue, 26 Jul 2022 12:30:35 +0530 Subject: [PATCH] =?UTF-8?q?Update=20=E2=80=9CStreamFieldPanel=E2=80=9D=20a?= =?UTF-8?q?nd=20=E2=80=9CImageChoosePanel=E2=80=9D=20with=20=E2=80=9CField?= =?UTF-8?q?Panel=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hypha/apply/determinations/models.py | 3 +-- hypha/apply/funds/models/forms.py | 4 ++-- hypha/apply/funds/models/reviewer_role.py | 3 +-- hypha/apply/projects/models/project.py | 4 ++-- hypha/apply/review/models.py | 4 ++-- hypha/public/funds/models.py | 8 +++----- hypha/public/home/models.py | 3 +-- hypha/public/navigation/models.py | 4 ++-- hypha/public/news/models.py | 9 ++------- hypha/public/partner/models.py | 3 +-- hypha/public/people/models.py | 6 ++---- hypha/public/projects/models.py | 6 ++---- hypha/public/standardpages/models.py | 4 ++-- hypha/public/utils/models.py | 16 +++++++--------- 14 files changed, 30 insertions(+), 47 deletions(-) diff --git a/hypha/apply/determinations/models.py b/hypha/apply/determinations/models.py index 60311ca5f..6525724b7 100644 --- a/hypha/apply/determinations/models.py +++ b/hypha/apply/determinations/models.py @@ -8,7 +8,6 @@ from wagtail.admin.panels import ( FieldPanel, MultiFieldPanel, ObjectList, - StreamFieldPanel, TabbedInterface, ) from wagtail.contrib.settings.models import BaseSetting, register_setting @@ -85,7 +84,7 @@ class DeterminationForm(DeterminationFormFieldsMixin, models.Model): panels = [ FieldPanel('name'), - StreamFieldPanel('form_fields'), + FieldPanel('form_fields'), ] def __str__(self): diff --git a/hypha/apply/funds/models/forms.py b/hypha/apply/funds/models/forms.py index c0889cfbd..369c557a3 100644 --- a/hypha/apply/funds/models/forms.py +++ b/hypha/apply/funds/models/forms.py @@ -1,6 +1,6 @@ from django.db import models from modelcluster.fields import ParentalKey -from wagtail.admin.panels import FieldPanel, StreamFieldPanel +from wagtail.admin.panels import FieldPanel from wagtail.fields import StreamField from wagtail.models import Orderable @@ -14,7 +14,7 @@ class ApplicationForm(models.Model): panels = [ FieldPanel('name'), - StreamFieldPanel('form_fields'), + FieldPanel('form_fields'), ] def __str__(self): diff --git a/hypha/apply/funds/models/reviewer_role.py b/hypha/apply/funds/models/reviewer_role.py index 413af02f8..d90e6ea5e 100644 --- a/hypha/apply/funds/models/reviewer_role.py +++ b/hypha/apply/funds/models/reviewer_role.py @@ -2,7 +2,6 @@ from django.db import models from django.utils.translation import gettext_lazy as _ from wagtail.admin.panels import FieldPanel from wagtail.contrib.settings.models import BaseSetting, register_setting -from wagtail.images.edit_handlers import ImageChooserPanel from hypha.apply.utils.image import generate_image_url @@ -24,7 +23,7 @@ class ReviewerRole(models.Model): panels = [ FieldPanel('name'), - ImageChooserPanel('icon'), + FieldPanel('icon'), FieldPanel('order'), ] diff --git a/hypha/apply/projects/models/project.py b/hypha/apply/projects/models/project.py index dd9ea6434..c1441746d 100644 --- a/hypha/apply/projects/models/project.py +++ b/hypha/apply/projects/models/project.py @@ -16,7 +16,7 @@ from django.dispatch.dispatcher import receiver from django.urls import reverse from django.utils import timezone from django.utils.translation import gettext_lazy as _ -from wagtail.admin.panels import FieldPanel, StreamFieldPanel +from wagtail.admin.panels import FieldPanel from wagtail.contrib.settings.models import BaseSetting, register_setting from wagtail.fields import StreamField @@ -379,7 +379,7 @@ class ProjectApprovalForm(BaseStreamForm, models.Model): panels = [ FieldPanel('name'), - StreamFieldPanel('form_fields'), + FieldPanel('form_fields'), ] def __str__(self): diff --git a/hypha/apply/review/models.py b/hypha/apply/review/models.py index 7cedb235d..332bc68fd 100644 --- a/hypha/apply/review/models.py +++ b/hypha/apply/review/models.py @@ -3,7 +3,7 @@ from django.db import models from django.urls import reverse from django.utils.functional import cached_property from django.utils.translation import gettext_lazy as _ -from wagtail.admin.panels import FieldPanel, StreamFieldPanel +from wagtail.admin.panels import FieldPanel from wagtail.fields import StreamField from hypha.apply.funds.models.mixins import AccessFormData @@ -82,7 +82,7 @@ class ReviewForm(ReviewFormFieldsMixin, models.Model): panels = [ FieldPanel('name'), - StreamFieldPanel('form_fields'), + FieldPanel('form_fields'), ] def __str__(self): diff --git a/hypha/public/funds/models.py b/hypha/public/funds/models.py index 0864d98d3..d8be4c3a4 100644 --- a/hypha/public/funds/models.py +++ b/hypha/public/funds/models.py @@ -13,10 +13,8 @@ from wagtail.admin.panels import ( InlinePanel, MultiFieldPanel, PageChooserPanel, - StreamFieldPanel, ) from wagtail.fields import StreamField -from wagtail.images.edit_handlers import ImageChooserPanel from wagtail.search import index from hypha.apply.funds.models import ApplicationSubmission @@ -53,7 +51,7 @@ class BaseApplicationPage(BasePage): content_panels = BasePage.content_panels + [ FieldPanel('introduction', widget=PagedownWidget()), - StreamFieldPanel('body'), + FieldPanel('body'), InlinePanel('related_pages', label=_('Related pages')), ] @@ -158,7 +156,7 @@ class LabPage(BasePage): ] content_panels = BasePage.content_panels + [ - ImageChooserPanel('icon'), + FieldPanel('icon'), FieldPanel('introduction'), MultiFieldPanel([ PageChooserPanel('lab_type', 'funds.LabType'), @@ -167,7 +165,7 @@ class LabPage(BasePage): FieldPanel('link_text'), ]), ], heading=_('Link for lab application')), - StreamFieldPanel('body'), + FieldPanel('body'), InlinePanel('related_pages', label=_('Related pages')), ] diff --git a/hypha/public/home/models.py b/hypha/public/home/models.py index 8b5706588..af4bcf34c 100644 --- a/hypha/public/home/models.py +++ b/hypha/public/home/models.py @@ -8,7 +8,6 @@ from wagtail.admin.panels import ( InlinePanel, MultiFieldPanel, PageChooserPanel, - StreamFieldPanel, ) from wagtail.fields import StreamField from wagtail.search import index @@ -112,7 +111,7 @@ class HomePage(BasePage): ], heading=_('News')), MultiFieldPanel([ FieldPanel('our_work_title'), - StreamFieldPanel('our_work'), + FieldPanel('our_work'), PageChooserPanel('our_work_link'), FieldPanel('our_work_link_text'), ], heading=_('Our Work')), diff --git a/hypha/public/navigation/models.py b/hypha/public/navigation/models.py index 79fa4a4d2..b5570ec6e 100644 --- a/hypha/public/navigation/models.py +++ b/hypha/public/navigation/models.py @@ -1,7 +1,7 @@ from django.utils.translation import gettext_lazy as _ from modelcluster.models import ClusterableModel from wagtail import blocks -from wagtail.admin.panels import StreamFieldPanel +from wagtail.admin.panels import FieldPanel from wagtail.contrib.settings.models import BaseSetting, register_setting from wagtail.fields import StreamField @@ -24,5 +24,5 @@ class NavigationSettings(BaseSetting, ClusterableModel): ) panels = [ - StreamFieldPanel('primary_navigation'), + FieldPanel('primary_navigation'), ] diff --git a/hypha/public/news/models.py b/hypha/public/news/models.py index a80ef038c..a5d558045 100644 --- a/hypha/public/news/models.py +++ b/hypha/public/news/models.py @@ -5,12 +5,7 @@ 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, - StreamFieldPanel, -) +from wagtail.admin.panels import FieldPanel, InlinePanel, PageChooserPanel from wagtail.contrib.settings.models import BaseSetting, register_setting from wagtail.fields import StreamField from wagtail.models import Orderable @@ -112,7 +107,7 @@ class NewsPage(BasePage): FieldPanel('publication_date'), InlinePanel('authors', label=_('Authors')), FieldPanel('introduction'), - StreamFieldPanel('body'), + FieldPanel('body'), InlinePanel('news_types', label=_('News types')), InlinePanel('related_projects', label=_('Mentioned project')), InlinePanel('related_pages', label=_('Related pages')), diff --git a/hypha/public/partner/models.py b/hypha/public/partner/models.py index 4c7d128fb..2f002914f 100644 --- a/hypha/public/partner/models.py +++ b/hypha/public/partner/models.py @@ -12,7 +12,6 @@ from wagtail.admin.forms import WagtailAdminModelForm from wagtail.admin.panels import FieldPanel from wagtail.contrib.settings.models import BaseSetting, register_setting from wagtail.fields import RichTextField -from wagtail.images.edit_handlers import ImageChooserPanel from wagtail.models import Page from wagtail.search import index @@ -70,7 +69,7 @@ class PartnerPage(BasePage): FieldPanel('public'), FieldPanel('description'), FieldPanel('web_url'), - ImageChooserPanel('logo'), + FieldPanel('logo'), ] def __str__(self): diff --git a/hypha/public/people/models.py b/hypha/public/people/models.py index 9f7183b1a..5e01d02a1 100644 --- a/hypha/public/people/models.py +++ b/hypha/public/people/models.py @@ -11,10 +11,8 @@ from wagtail.admin.panels import ( InlinePanel, MultiFieldPanel, PageChooserPanel, - StreamFieldPanel, ) from wagtail.fields import StreamField -from wagtail.images.edit_handlers import ImageChooserPanel from wagtail.models import Orderable, PageManager from wagtail.query import PageQuerySet from wagtail.search import index @@ -180,7 +178,7 @@ class PersonPage(FundingMixin, BasePage): FieldPanel('last_name'), ], heading=_('Name')), FieldPanel('active'), - ImageChooserPanel('photo'), + FieldPanel('photo'), FieldPanel('job_title'), InlinePanel('social_media_profile', label=_('Social accounts')), FieldPanel('website'), @@ -190,7 +188,7 @@ class PersonPage(FundingMixin, BasePage): ], heading=_('Contact information')), InlinePanel('person_types', label=_('Person types')), FieldPanel('introduction'), - StreamFieldPanel('biography'), + FieldPanel('biography'), InlinePanel('funds_reviewed', label=_('Funds Reviewed')), ] + FundingMixin.content_panels diff --git a/hypha/public/projects/models.py b/hypha/public/projects/models.py index 0d5fc0aa2..2b0934be5 100644 --- a/hypha/public/projects/models.py +++ b/hypha/public/projects/models.py @@ -13,10 +13,8 @@ from wagtail.admin.panels import ( InlinePanel, MultiFieldPanel, PageChooserPanel, - StreamFieldPanel, ) from wagtail.fields import StreamField -from wagtail.images.edit_handlers import ImageChooserPanel from wagtail.search import index from hypha.apply.categories.models import Option @@ -122,10 +120,10 @@ class ProjectPage(FundingMixin, BasePage): ] content_panels = BasePage.content_panels + [ - ImageChooserPanel('icon'), + FieldPanel('icon'), FieldPanel('status'), FieldPanel('introduction'), - StreamFieldPanel('body'), + FieldPanel('body'), InlinePanel('contact_details', label=_('Contact Details')), ] + FundingMixin.content_panels + [ InlinePanel('related_pages', label=_('Related Projects')), diff --git a/hypha/public/standardpages/models.py b/hypha/public/standardpages/models.py index 1f23410c4..b6ba9cc22 100644 --- a/hypha/public/standardpages/models.py +++ b/hypha/public/standardpages/models.py @@ -4,7 +4,7 @@ from django.db import models 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, StreamFieldPanel +from wagtail.admin.panels import FieldPanel, InlinePanel from wagtail.fields import StreamField from wagtail.search import index @@ -27,7 +27,7 @@ class InformationPage(BasePage): content_panels = BasePage.content_panels + [ FieldPanel('introduction'), - StreamFieldPanel('body'), + FieldPanel('body'), InlinePanel('related_pages', label=_('Related pages')), ] diff --git a/hypha/public/utils/models.py b/hypha/public/utils/models.py index 48ceca076..431487798 100644 --- a/hypha/public/utils/models.py +++ b/hypha/public/utils/models.py @@ -10,11 +10,9 @@ from wagtail.admin.panels import ( InlinePanel, MultiFieldPanel, PageChooserPanel, - StreamFieldPanel, ) from wagtail.contrib.settings.models import BaseSetting, register_setting from wagtail.fields import RichTextField, StreamField -from wagtail.images.edit_handlers import ImageChooserPanel from wagtail.models import Orderable, Page from wagtail.snippets.models import register_snippet from wagtailcache.cache import WagtailCacheMixin, cache_page @@ -108,7 +106,7 @@ class SocialFields(models.Model): promote_panels = [ MultiFieldPanel([ - ImageChooserPanel('social_image'), + FieldPanel('social_image'), FieldPanel('social_text'), ], 'Social networks'), ] @@ -132,7 +130,7 @@ class ListingFields(models.Model): promote_panels = [ MultiFieldPanel([ - ImageChooserPanel('listing_image'), + FieldPanel('listing_image'), FieldPanel('listing_title'), FieldPanel('listing_summary'), ], 'Listing information'), @@ -167,8 +165,8 @@ class CallToActionSnippet(models.Model): panels = [ FieldPanel('title'), FieldPanel('summary'), - ImageChooserPanel('image'), - StreamFieldPanel('link'), + FieldPanel('image'), + FieldPanel('link'), ] def get_link_text(self): @@ -270,8 +268,8 @@ class SystemMessagesSettings(BaseSetting): panels = [ MultiFieldPanel([ - ImageChooserPanel('site_logo_default'), - ImageChooserPanel('site_logo_mobile'), + FieldPanel('site_logo_default'), + FieldPanel('site_logo_mobile'), FieldPanel('site_logo_link'), ], 'Site logo'), FieldPanel('footer_content'), @@ -298,7 +296,7 @@ class BasePage(WagtailCacheMixin, SocialFields, ListingFields, Page): abstract = True content_panels = Page.content_panels + [ - ImageChooserPanel('header_image') + FieldPanel('header_image') ] promote_panels = ( -- GitLab