Skip to content

Commit

Permalink
Upgrade wagtail to 5x (#3627)
Browse files Browse the repository at this point in the history
Notes: 

Wagtail 5x has migrations:
```
You have 11 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): wagtailcore, wagtailsearchpromotions, wagtailusers.
```
  • Loading branch information
theskumar authored and wes-otf committed May 8, 2024
1 parent 4866081 commit 51f4278
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 114 deletions.
1 change: 1 addition & 0 deletions hypha/apply/categories/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def get_categories_as_choices():
class CategoryQuestionBlock(OptionalFormFieldBlock):
class Meta:
template = "stream_forms/render_list_field.html"
icon = "folder-open-1"

category = ModelChooserBlock(required=True, choices=get_categories_as_choices)
multi = BooleanBlock(label=_("Multi select"), required=False)
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/funds/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class ReviewerSettingAdmin(SettingModelAdmin):

class ApplyAdminGroup(ModelAdminGroup):
menu_label = "Apply"
menu_icon = "folder-open-inverse"
menu_icon = "folder-inverse"
items = (
RoundAdmin,
SealedRoundAdmin,
Expand Down
1 change: 1 addition & 0 deletions hypha/apply/funds/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ValueBlock(ApplicationSingleIncludeFieldBlock):

class Meta:
label = _("Requested amount")
icon = "decimal"

def prepare_data(self, value, data, serialize):
return format_number_as_currency(str(data))
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class VendorFormSettingsAdmin(SettingModelAdmin):

class ProjectAdminGroup(ModelAdminGroup):
menu_label = "Projects"
menu_icon = "duplicate"
menu_icon = "folder-open-1"
items = (
ContractDocumentCategoryAdmin,
DocumentCategoryAdmin,
Expand Down
8 changes: 6 additions & 2 deletions hypha/apply/stream_forms/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class CharFieldBlock(OptionalFormFieldBlock):

class Meta:
label = _("Text field (single line)")
icon = "minus"
template = "stream_forms/render_unsafe_field.html"

def get_field_class(self, struct_value):
Expand All @@ -149,6 +150,7 @@ class MultiInputCharFieldBlock(CharFieldBlock):

class Meta:
label = _("Text field (single line) (multiple inputs)")
icon = "bars"


class TextFieldBlock(OptionalFormFieldBlock):
Expand All @@ -159,6 +161,7 @@ class TextFieldBlock(OptionalFormFieldBlock):

class Meta:
label = _("Text field (multi line)")
icon = "edit"
template = "stream_forms/render_unsafe_field.html"

def get_searchable_content(self, value, data):
Expand All @@ -172,6 +175,7 @@ class NumberFieldBlock(OptionalFormFieldBlock):

class Meta:
label = _("Number field")
icon = "decimal"

def get_searchable_content(self, value, data):
return None
Expand Down Expand Up @@ -256,7 +260,7 @@ class DropdownFieldBlock(RadioButtonsFieldBlock):

class Meta:
label = _("Dropdown field")
icon = "arrow-down-big"
icon = "arrow-down"

def get_field_kwargs(self, struct_value):
kwargs = super().get_field_kwargs(struct_value)
Expand All @@ -272,7 +276,7 @@ class CheckboxesFieldBlock(OptionalFormFieldBlock):

class Meta:
label = _("Multiple checkboxes field")
icon = "list-ul"
icon = "tasks"
template = "stream_forms/render_list_field.html"

def get_field_kwargs(self, struct_value):
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/utils/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def clean(self, value):
try:
value = super().clean(value)
except ValidationError as e:
error_dict = e.params
error_dict = e.params or {}
else:
error_dict = {}

Expand Down
8 changes: 0 additions & 8 deletions hypha/public/utils/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from django.templatetags.static import static
from wagtail import hooks
from wagtail.contrib.modeladmin.options import (
ModelAdmin,
Expand Down Expand Up @@ -30,13 +29,6 @@ class TaxonomiesModelAdminGroup(ModelAdminGroup):
modeladmin_register(TaxonomiesModelAdminGroup)


@hooks.register("insert_editor_css")
def editor_css():
link = '<link rel="stylesheet" href="{}">\n'
path = static("css/apply/wagtail_editor.css")
return link.format(path)


@hooks.register("after_create_page")
@hooks.register("after_edit_page")
def clear_wagtailcache(request, page):
Expand Down
98 changes: 0 additions & 98 deletions hypha/static_src/src/sass/apply/wagtail_editor.scss

This file was deleted.

6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ mailchimp3==3.0.17
mistune==2.0.4
more-itertools==9.0.0
phonenumberslite==8.13.23
Pillow==9.4.0
Pillow>=10.0.1
psycopg2-binary
qrcode==7.4.2
reportlab==3.6.13
social_auth_app_django==5.0.0
tablib==3.5.0
tomd==0.1.3
wagtail-cache==2.2.0
wagtail-cache==2.3.0
wagtail-purge==0.3.0
wagtail==4.2.2
wagtail==5.1.3
whitenoise==5.3.0
xhtml2pdf==0.2.11
xmltodict==0.13.0

0 comments on commit 51f4278

Please sign in to comment.