Skip to content

Commit

Permalink
Fix Wagtail 3 warnings (#39)
Browse files Browse the repository at this point in the history
Use new module paths and edit handlers/panels.
  • Loading branch information
vsalvino authored Aug 1, 2022
1 parent 34bbf5b commit 07b373c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
12 changes: 6 additions & 6 deletions testproject/home/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from django.db import migrations, models
import django.db.models.deletion
import django.forms.widgets
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields
import wagtailseo.blocks


Expand Down Expand Up @@ -42,8 +42,8 @@ class Migration(migrations.Migration):
('struct_org_address_country', models.CharField(blank=True, help_text='For example, USA. Two-letter ISO 3166-1 alpha-2 country code is also acceptable https://en.wikipedia.org/wiki/ISO_3166-1', max_length=255, verbose_name='Country')),
('struct_org_geo_lat', models.DecimalField(blank=True, decimal_places=8, max_digits=10, null=True, verbose_name='Geographic latitude')),
('struct_org_geo_lng', models.DecimalField(blank=True, decimal_places=8, max_digits=10, null=True, verbose_name='Geographic longitude')),
('struct_org_hours', wagtail.core.fields.StreamField([('hours', wagtail.core.blocks.StructBlock([('days', wagtail.core.blocks.MultipleChoiceBlock(choices=[('Monday', 'Monday'), ('Tuesday', 'Tuesday'), ('Wednesday', 'Wednesday'), ('Thursday', 'Thursday'), ('Friday', 'Friday'), ('Saturday', 'Saturday'), ('Sunday', 'Sunday')], help_text='For late night hours past 23:59, define each day in a separate block.', required=True, verbose_name='Days', widget=django.forms.widgets.CheckboxSelectMultiple)), ('start_time', wagtail.core.blocks.TimeBlock(verbose_name='Opening time')), ('end_time', wagtail.core.blocks.TimeBlock(verbose_name='Closing time'))]))], blank=True, verbose_name='Hours of operation')),
('struct_org_actions', wagtail.core.fields.StreamField([('actions', wagtail.core.blocks.StructBlock([('action_type', wagtail.core.blocks.ChoiceBlock(choices=[('OrderAction', 'OrderAction'), ('ReserveAction', 'ReserveAction')], verbose_name='Action Type')), ('target', wagtail.core.blocks.URLBlock(verbose_name='Target URL')), ('language', wagtail.core.blocks.CharBlock(default='en-US', help_text='If the action is offered in multiple languages, create separate actions for each language.', verbose_name='Language')), ('result_type', wagtail.core.blocks.ChoiceBlock(choices=[('Reservation', 'Reservation'), ('BusReservation', 'BusReservation'), ('EventReservation', 'EventReservation'), ('FlightReservation', 'FlightReservation'), ('FoodEstablishmentReservation', 'FoodEstablishmentReservation'), ('LodgingReservation', 'LodgingReservation'), ('RentalCarReservation', 'RentalCarReservation'), ('ReservationPackage', 'ReservationPackage'), ('TaxiReservation', 'TaxiReservation'), ('TrainReservation', 'TrainReservation')], help_text='Leave blank for OrderAction', required=False, verbose_name='Result Type')), ('result_name', wagtail.core.blocks.CharBlock(help_text='Example: "Reserve a table", "Book an appointment", etc.', required=False, verbose_name='Result Name')), ('extra_json', wagtail.core.blocks.RawHTMLBlock(classname='monospace', help_text='Additional JSON-LD inserted into the Action dictionary. Must be properties of https://schema.org/Action.', required=False, verbose_name='Additional action markup'))]))], blank=True, verbose_name='Actions')),
('struct_org_hours', wagtail.fields.StreamField([('hours', wagtail.blocks.StructBlock([('days', wagtail.blocks.MultipleChoiceBlock(choices=[('Monday', 'Monday'), ('Tuesday', 'Tuesday'), ('Wednesday', 'Wednesday'), ('Thursday', 'Thursday'), ('Friday', 'Friday'), ('Saturday', 'Saturday'), ('Sunday', 'Sunday')], help_text='For late night hours past 23:59, define each day in a separate block.', required=True, verbose_name='Days', widget=django.forms.widgets.CheckboxSelectMultiple)), ('start_time', wagtail.blocks.TimeBlock(verbose_name='Opening time')), ('end_time', wagtail.blocks.TimeBlock(verbose_name='Closing time'))]))], blank=True, verbose_name='Hours of operation')),
('struct_org_actions', wagtail.fields.StreamField([('actions', wagtail.blocks.StructBlock([('action_type', wagtail.blocks.ChoiceBlock(choices=[('OrderAction', 'OrderAction'), ('ReserveAction', 'ReserveAction')], verbose_name='Action Type')), ('target', wagtail.blocks.URLBlock(verbose_name='Target URL')), ('language', wagtail.blocks.CharBlock(default='en-US', help_text='If the action is offered in multiple languages, create separate actions for each language.', verbose_name='Language')), ('result_type', wagtail.blocks.ChoiceBlock(choices=[('Reservation', 'Reservation'), ('BusReservation', 'BusReservation'), ('EventReservation', 'EventReservation'), ('FlightReservation', 'FlightReservation'), ('FoodEstablishmentReservation', 'FoodEstablishmentReservation'), ('LodgingReservation', 'LodgingReservation'), ('RentalCarReservation', 'RentalCarReservation'), ('ReservationPackage', 'ReservationPackage'), ('TaxiReservation', 'TaxiReservation'), ('TrainReservation', 'TrainReservation')], help_text='Leave blank for OrderAction', required=False, verbose_name='Result Type')), ('result_name', wagtail.blocks.CharBlock(help_text='Example: "Reserve a table", "Book an appointment", etc.', required=False, verbose_name='Result Name')), ('extra_json', wagtail.blocks.RawHTMLBlock(classname='monospace', help_text='Additional JSON-LD inserted into the Action dictionary. Must be properties of https://schema.org/Action.', required=False, verbose_name='Additional action markup'))]))], blank=True, verbose_name='Actions')),
('struct_org_extra_json', models.TextField(blank=True, help_text='Additional JSON-LD inserted into the Organization dictionary. Must be properties of https://schema.org/Organization or the selected organization type.', verbose_name='Additional Organization markup')),
('og_image', models.ForeignKey(blank=True, help_text='Shown when linking to this page on social media.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Preview image')),
('struct_org_image', models.ForeignKey(blank=True, help_text='A photo of the facility. This photo will be cropped to 1:1, 4:3, and 16:9 aspect ratios automatically.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Photo of Organization')),
Expand All @@ -69,8 +69,8 @@ class Migration(migrations.Migration):
('struct_org_address_country', models.CharField(blank=True, help_text='For example, USA. Two-letter ISO 3166-1 alpha-2 country code is also acceptable https://en.wikipedia.org/wiki/ISO_3166-1', max_length=255, verbose_name='Country')),
('struct_org_geo_lat', models.DecimalField(blank=True, decimal_places=8, max_digits=10, null=True, verbose_name='Geographic latitude')),
('struct_org_geo_lng', models.DecimalField(blank=True, decimal_places=8, max_digits=10, null=True, verbose_name='Geographic longitude')),
('struct_org_hours', wagtail.core.fields.StreamField([('hours', wagtail.core.blocks.StructBlock([('days', wagtail.core.blocks.MultipleChoiceBlock(choices=[('Monday', 'Monday'), ('Tuesday', 'Tuesday'), ('Wednesday', 'Wednesday'), ('Thursday', 'Thursday'), ('Friday', 'Friday'), ('Saturday', 'Saturday'), ('Sunday', 'Sunday')], help_text='For late night hours past 23:59, define each day in a separate block.', required=True, verbose_name='Days', widget=django.forms.widgets.CheckboxSelectMultiple)), ('start_time', wagtail.core.blocks.TimeBlock(verbose_name='Opening time')), ('end_time', wagtail.core.blocks.TimeBlock(verbose_name='Closing time'))]))], blank=True, verbose_name='Hours of operation')),
('struct_org_actions', wagtail.core.fields.StreamField([('actions', wagtail.core.blocks.StructBlock([('action_type', wagtail.core.blocks.ChoiceBlock(choices=[('OrderAction', 'OrderAction'), ('ReserveAction', 'ReserveAction')], verbose_name='Action Type')), ('target', wagtail.core.blocks.URLBlock(verbose_name='Target URL')), ('language', wagtail.core.blocks.CharBlock(default='en-US', help_text='If the action is offered in multiple languages, create separate actions for each language.', verbose_name='Language')), ('result_type', wagtail.core.blocks.ChoiceBlock(choices=[('Reservation', 'Reservation'), ('BusReservation', 'BusReservation'), ('EventReservation', 'EventReservation'), ('FlightReservation', 'FlightReservation'), ('FoodEstablishmentReservation', 'FoodEstablishmentReservation'), ('LodgingReservation', 'LodgingReservation'), ('RentalCarReservation', 'RentalCarReservation'), ('ReservationPackage', 'ReservationPackage'), ('TaxiReservation', 'TaxiReservation'), ('TrainReservation', 'TrainReservation')], help_text='Leave blank for OrderAction', required=False, verbose_name='Result Type')), ('result_name', wagtail.core.blocks.CharBlock(help_text='Example: "Reserve a table", "Book an appointment", etc.', required=False, verbose_name='Result Name')), ('extra_json', wagtail.core.blocks.RawHTMLBlock(classname='monospace', help_text='Additional JSON-LD inserted into the Action dictionary. Must be properties of https://schema.org/Action.', required=False, verbose_name='Additional action markup'))]))], blank=True, verbose_name='Actions')),
('struct_org_hours', wagtail.fields.StreamField([('hours', wagtail.blocks.StructBlock([('days', wagtail.blocks.MultipleChoiceBlock(choices=[('Monday', 'Monday'), ('Tuesday', 'Tuesday'), ('Wednesday', 'Wednesday'), ('Thursday', 'Thursday'), ('Friday', 'Friday'), ('Saturday', 'Saturday'), ('Sunday', 'Sunday')], help_text='For late night hours past 23:59, define each day in a separate block.', required=True, verbose_name='Days', widget=django.forms.widgets.CheckboxSelectMultiple)), ('start_time', wagtail.blocks.TimeBlock(verbose_name='Opening time')), ('end_time', wagtail.blocks.TimeBlock(verbose_name='Closing time'))]))], blank=True, verbose_name='Hours of operation')),
('struct_org_actions', wagtail.fields.StreamField([('actions', wagtail.blocks.StructBlock([('action_type', wagtail.blocks.ChoiceBlock(choices=[('OrderAction', 'OrderAction'), ('ReserveAction', 'ReserveAction')], verbose_name='Action Type')), ('target', wagtail.blocks.URLBlock(verbose_name='Target URL')), ('language', wagtail.blocks.CharBlock(default='en-US', help_text='If the action is offered in multiple languages, create separate actions for each language.', verbose_name='Language')), ('result_type', wagtail.blocks.ChoiceBlock(choices=[('Reservation', 'Reservation'), ('BusReservation', 'BusReservation'), ('EventReservation', 'EventReservation'), ('FlightReservation', 'FlightReservation'), ('FoodEstablishmentReservation', 'FoodEstablishmentReservation'), ('LodgingReservation', 'LodgingReservation'), ('RentalCarReservation', 'RentalCarReservation'), ('ReservationPackage', 'ReservationPackage'), ('TaxiReservation', 'TaxiReservation'), ('TrainReservation', 'TrainReservation')], help_text='Leave blank for OrderAction', required=False, verbose_name='Result Type')), ('result_name', wagtail.blocks.CharBlock(help_text='Example: "Reserve a table", "Book an appointment", etc.', required=False, verbose_name='Result Name')), ('extra_json', wagtail.blocks.RawHTMLBlock(classname='monospace', help_text='Additional JSON-LD inserted into the Action dictionary. Must be properties of https://schema.org/Action.', required=False, verbose_name='Additional action markup'))]))], blank=True, verbose_name='Actions')),
('struct_org_extra_json', models.TextField(blank=True, help_text='Additional JSON-LD inserted into the Organization dictionary. Must be properties of https://schema.org/Organization or the selected organization type.', verbose_name='Additional Organization markup')),
('og_image', models.ForeignKey(blank=True, help_text='Shown when linking to this page on social media.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Preview image')),
('struct_org_image', models.ForeignKey(blank=True, help_text='A photo of the facility. This photo will be cropped to 1:1, 4:3, and 16:9 aspect ratios automatically.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Photo of Organization')),
Expand Down
2 changes: 1 addition & 1 deletion testproject/home/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from wagtail.core.models import Page
from wagtail.models import Page
from wagtailseo.models import SeoMixin, SeoType, TwitterCard


Expand Down
4 changes: 2 additions & 2 deletions testproject/home/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from django.utils import timezone
from django.utils.text import capfirst
from django.contrib.auth.models import User
from wagtail.core.models import Page
from wagtail.models import Page
from wagtail.images.tests.utils import Image, get_test_image_file
from wagtail.tests.utils import WagtailTestUtils
from wagtail.test.utils import WagtailTestUtils
from wagtailseo import schema
from wagtailseo import utils
from wagtailseo.models import SeoSettings
Expand Down
2 changes: 1 addition & 1 deletion testproject/testproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"wagtail.images",
"wagtail.search",
"wagtail.admin",
"wagtail.core",
"wagtail",
"modelcluster",
"taggit",
"django.contrib.admin",
Expand Down
2 changes: 1 addition & 1 deletion testproject/testproject/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.urls import include, path

from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls


Expand Down
2 changes: 1 addition & 1 deletion wagtailseo/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django import forms
from django.utils.translation import gettext_lazy as _
from wagtail.core import blocks
from wagtail import blocks

from wagtailseo import schema

Expand Down
18 changes: 8 additions & 10 deletions wagtailseo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@

from django.db import models
from django.utils.translation import gettext_lazy as _
from wagtail.admin.edit_handlers import (
from wagtail.admin.panels import (
HelpPanel,
FieldPanel,
MultiFieldPanel,
StreamFieldPanel,
)
from wagtail.contrib.settings.models import BaseSetting, register_setting
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from wagtail.fields import StreamField
from wagtail.models import Page
from wagtail.images import get_image_model_string
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.images.models import AbstractImage

from wagtailseo import settings, schema, utils
Expand Down Expand Up @@ -506,7 +504,7 @@ def seo_struct_article_json(self) -> str:
FieldPanel("seo_title"),
FieldPanel("search_description"),
FieldPanel("canonical_url"),
ImageChooserPanel("og_image"),
FieldPanel("og_image"),
],
_("Search and Social Previews"),
),
Expand All @@ -530,8 +528,8 @@ def seo_struct_article_json(self) -> str:
),
FieldPanel("struct_org_type"),
FieldPanel("struct_org_name"),
ImageChooserPanel("struct_org_logo"),
ImageChooserPanel("struct_org_image"),
FieldPanel("struct_org_logo"),
FieldPanel("struct_org_image"),
FieldPanel("struct_org_phone"),
FieldPanel("struct_org_address_street"),
FieldPanel("struct_org_address_locality"),
Expand All @@ -540,8 +538,8 @@ def seo_struct_article_json(self) -> str:
FieldPanel("struct_org_address_country"),
FieldPanel("struct_org_geo_lat"),
FieldPanel("struct_org_geo_lng"),
StreamFieldPanel("struct_org_hours"),
StreamFieldPanel("struct_org_actions"),
FieldPanel("struct_org_hours"),
FieldPanel("struct_org_actions"),
FieldPanel("struct_org_extra_json"),
],
_("Structured Data - Organization"),
Expand Down
2 changes: 1 addition & 1 deletion wagtailseo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import List, Union

from django.conf import settings
from wagtail.core.models import Site
from wagtail.models import Site
from wagtail.images.models import AbstractImage


Expand Down

0 comments on commit 07b373c

Please sign in to comment.