Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.1.11 on 2021-09-24 20:02

from django.db import migrations, models
import wagtail.core.fields


class Migration(migrations.Migration):

dependencies = [
('wagtailpages', '0037_productpage_mozilla_says'),
]

operations = [
migrations.AddField(
model_name='generalproductpage',
name='ai_is_untrustworthy',
field=models.BooleanField(blank=True, help_text='Is the AI untrustworthy?', null=True),
),
migrations.AddField(
model_name='generalproductpage',
name='ai_is_untrustworthy_ding',
field=models.BooleanField(default=False, help_text='Tick this box if the AI invades privacy or behaves unethically.'),
),
migrations.AddField(
model_name='generalproductpage',
name='ai_what_can_it_do',
field=wagtail.core.fields.RichTextField(blank=True, help_text='What kind of decisions does this AI make about you or for you?'),
),
]
27 changes: 27 additions & 0 deletions network-api/networkapi/wagtailpages/pagemodels/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
from django.utils.text import slugify
from django.utils.translation import gettext, pgettext


from modelcluster.fields import ParentalKey

from wagtail.admin.edit_handlers import InlinePanel, FieldPanel, MultiFieldPanel, PageChooserPanel
from wagtail.contrib.routable_page.models import RoutablePageMixin, route
from wagtail.core.models import Locale, Orderable, Page, TranslatableMixin
from wagtail.core.fields import RichTextField

from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.search import index
Expand Down Expand Up @@ -1120,6 +1122,19 @@ class GeneralProductPage(ProductPage):
blank=True,
help_text='Helpful text around AI to show on the product page',
)
ai_is_untrustworthy = models.BooleanField(
null=True,
blank=True,
help_text='Is the AI untrustworthy?',
)
ai_is_untrustworthy_ding = models.BooleanField(
help_text='Tick this box if the AI invades privacy or behaves unethically.',
default=False,
)
ai_what_can_it_do = RichTextField(
blank=True,
help_text='What kind of decisions does this AI make about you or for you?'
)

@classmethod
def map_import_fields(cls):
Expand All @@ -1143,6 +1158,9 @@ def map_import_fields(cls):
"AI uses personal data": "ai_uses_personal_data",
"AI help text": "ai_helptext",
"AI is transparent": "ai_is_transparent",
"AI is untrustworthy": "ai_is_untrustworthy",
"AI is untrustworthy ding": "ai_is_untrustworthy_ding",
"AI What can it do": "ai_what_can_it_do",
}
# Return the merged fields
return {**generic_product_import_fields, **general_product_mappings}
Expand Down Expand Up @@ -1172,6 +1190,9 @@ def get_export_fields(self):
"AI uses personal data": self.ai_uses_personal_data,
"AI is transparent": self.ai_uses_personal_data,
"AI help text": self.ai_helptext,
"AI is untrustworthy": self.ai_is_untrustworthy,
"AI is untrustworthy ding": self.ai_is_untrustworthy_ding,
"AI What can it do": self.ai_what_can_it_do,
}
# Merge the two dicts together.
data = {**generic_product_data, **general_product_data}
Expand Down Expand Up @@ -1256,6 +1277,9 @@ def get_export_fields(self):
FieldPanel('ai_uses_personal_data'),
FieldPanel('ai_is_transparent'),
FieldPanel('ai_helptext'),
FieldPanel('ai_is_untrustworthy'),
FieldPanel('ai_is_untrustworthy_ding'),
FieldPanel('ai_what_can_it_do'),
],
heading='Artificial Intelligence',
classname='collapsible'
Expand All @@ -1278,6 +1302,9 @@ def get_export_fields(self):
SynchronizedField('ai_uses_personal_data'),
SynchronizedField('ai_is_transparent'),
TranslatableField('ai_helptext'),
SynchronizedField('ai_is_untrustworthy'),
SynchronizedField('ai_is_untrustworthy_ding'),
TranslatableField('ai_what_can_it_do'),
]

@property
Expand Down