Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Rename is_visible, published_date to is_published, publication_date on page model
Michał Jelonek1b68885d2eae
diff --git a/saleor/core/sitemaps.py b/saleor/core/sitemaps.pyindex d1d0fd422c..2880434285 100644--- a/saleor/core/sitemaps.py+++ b/saleor/core/sitemaps.py@@ -33,7 +33,7 @@ class CollectionSitemap(I18nSitemap):class PageSitemap(I18nSitemap):def items(self):- posts = Page.objects.public()+ posts = Page.objects.available()return posts.only('id', 'title', 'slug')diff --git a/saleor/core/templatetags/status.py b/saleor/core/templatetags/status.pyindex 642036802c..da71378e3b 100644--- a/saleor/core/templatetags/status.py+++ b/saleor/core/templatetags/status.py@@ -59,8 +59,8 @@ def render_variant_availability_status(variant):@register.inclusion_tag('dashboard/includes/_page_availability.html')def render_page_availability(page):- ctx = {'is_published': page.is_published, 'page': page}- if page.is_published:+ ctx = {'is_available': page.is_available, 'page': page}+ if page.is_available:label_cls = LABEL_SUCCESSctx.update({'label_cls': label_cls})return ctxdiff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.pyindex 6c2874510d..8160fee198 100644--- a/saleor/core/utils/random_data.py+++ b/saleor/core/utils/random_data.py@@ -575,7 +575,7 @@ def create_page():<h3>A modular, high performance e-commerce storefront built with GraphQL, Django, and ReactJS.</h3><p>Saleor is a rapidly-growing open source e-commerce platform that has served high-volume companies from branches like publishing and apparel since 2012. Based on Python and Django, the latest major update introduces a modular front end with a GraphQL API and storefront and dashboard written in React to make Saleor a full-functionality open source e-commerce.</p>"""- page_data = {'content': content, 'title': 'About', 'is_visible': True}+ page_data = {'content': content, 'title': 'About', 'is_published': True}page, dummy = Page.objects.get_or_create(slug='about', **page_data)yield 'Page %s created' % page.slugdiff --git a/saleor/dashboard/menu/utils.py b/saleor/dashboard/menu/utils.pyindex 0f7225fc5b..428e5de059 100644--- a/saleor/dashboard/menu/utils.py+++ b/saleor/dashboard/menu/utils.py@@ -95,15 +95,15 @@ def get_menus_that_needs_update(collection=None, categories=None, page=None):def get_menu_obj_text(obj):- if getattr(obj, 'is_published', True):- return str(obj)- elif isinstance(obj, Page) and obj.is_visible and obj.available_on:+ if isinstance(obj, Page) and obj.is_published and obj.publication_date:return pgettext('Menu item page hidden status','%(menu_item_name)s is hidden ''(will become visible on %(available_on_date)s)' % ({- 'available_on_date': localize(obj.available_on),+ 'available_on_date': localize(obj.publication_date),'menu_item_name': str(obj)}))+ if getattr(obj, 'is_published', True):+ return str(obj)return pgettext('Menu item published status','%(menu_item_name)s (Not published)' % {diff --git a/saleor/dashboard/page/forms.py b/saleor/dashboard/page/forms.pyindex 72cc639c2a..d894df995f 100644--- a/saleor/dashboard/page/forms.py+++ b/saleor/dashboard/page/forms.py@@ -22,8 +22,8 @@ class PageForm(forms.ModelForm):'slug': pgettext_lazy('Page form: slug field', 'Slug'),'available_on': pgettext_lazy('Page form: available on which date field', 'Available on'),- 'is_visible': pgettext_lazy(- 'Page form: visibility status indicator', 'Is visible')}+ 'is_published': pgettext_lazy(+ 'Page form: publication status indicator', 'Is published')}help_texts = {'slug': pgettext_lazy('Form field help text',diff --git a/saleor/graphql/page/mutations.py b/saleor/graphql/page/mutations.pyindex 3b9fa158a3..6ef1997da0 100644--- a/saleor/graphql/page/mutations.py+++ b/saleor/graphql/page/mutations.py@@ -15,9 +15,9 @@ class PageInput(graphene.InputObjectType):content = graphene.String(description=dedent("""Page content.May consists of ordinary text, HTML and images."""))- is_visible = graphene.Boolean(+ is_published = graphene.Boolean(description='Determines if page is visible in the storefront')- available_on = graphene.String(+ publication_date = graphene.String(description='Publication date. ISO 8601 standard.')seo = SeoInput(description='Search engine optimization fields.')diff --git a/saleor/graphql/page/resolvers.py b/saleor/graphql/page/resolvers.pyindex 4294e8a245..0d60125f16 100644--- a/saleor/graphql/page/resolvers.py+++ b/saleor/graphql/page/resolvers.py@@ -20,7 +20,9 @@ def resolve_page(info, id=None, slug=None):page = graphene.Node.get_node_from_global_id(info, id, Page)# Resolve to null if page is not published and user has no permission# to manage pages.- if page and not (page.is_visible or user.has_perm('page.manage_pages')):+ is_available_to_user = (+ page.is_published or user.has_perm('page.manage_pages'))+ if page and not is_available_to_user:page = Nonereturn pagediff --git a/saleor/graphql/page/types.py b/saleor/graphql/page/types.pyindex 3502d4eaff..942052278b 100644--- a/saleor/graphql/page/types.py+++ b/saleor/graphql/page/types.py@@ -1,5 +1,6 @@from textwrap import dedent+import graphenefrom graphene import relayfrom ...page import models@@ -7,9 +8,22 @@ from ..core.connection import CountableDjangoObjectTypeclass Page(CountableDjangoObjectType):+ available_on = graphene.Date(+ deprecation_reason=(+ 'availableOn is deprecated, use publicationDate instead'))+ is_visible = graphene.Boolean(+ deprecation_reason=(+ 'isVisible is deprecated, use isPublished instead'))+class Meta:description = dedent("""A static page that can be manually added by a shopoperator through the dashboard.""")exclude_fields = ['voucher_set', 'sale_set', 'menuitem_set']interfaces = [relay.Node]model = models.Page++ def resolve_available_on(self, info):+ return self.publication_date++ def resolve_is_visible(self, info):+ return self.is_publisheddiff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 529d7a0fbf..d0ccd91308 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -1178,8 +1178,10 @@ type Page implements Node {title: String!content: String!created: DateTime!- isVisible: Boolean!- availableOn: Date+ isPublished: Boolean!+ publicationDate: Date+ availableOn: Date @deprecated(reason: "availableOn is deprecated, use publicationDate instead")+ isVisible: Boolean @deprecated(reason: "isVisible is deprecated, use isPublished instead")}type PageCountableConnection {@@ -1214,8 +1216,8 @@ input PageInput {slug: Stringtitle: Stringcontent: String- isVisible: Boolean- availableOn: String+ isPublished: Boolean+ publicationDate: Stringseo: SeoInput}diff --git a/saleor/page/migrations/0005_auto_20190208_0456.py b/saleor/page/migrations/0005_auto_20190208_0456.pynew file mode 100644index 0000000000..05cfcb9678--- /dev/null+++ b/saleor/page/migrations/0005_auto_20190208_0456.py@@ -0,0 +1,23 @@+# Generated by Django 2.1.5 on 2019-02-08 10:56++from django.db import migrations+++class Migration(migrations.Migration):++ dependencies = [+ ('page', '0004_auto_20180803_0528'),+ ]++ operations = [+ migrations.RenameField(+ model_name='page',+ old_name='is_visible',+ new_name='is_published',+ ),+ migrations.RenameField(+ model_name='page',+ old_name='available_on',+ new_name='publication_date',+ ),+ ]diff --git a/saleor/page/models.py b/saleor/page/models.pyindex 66015cd919..ac3bc97738 100644--- a/saleor/page/models.py+++ b/saleor/page/models.py@@ -1,29 +1,20 @@import datetimefrom django.db import models-from django.db.models import Qfrom django.urls import reversefrom django.utils.translation import pgettext_lazyfrom ..core.utils import build_absolute_urifrom ..core.utils.translations import TranslationProxyfrom ..seo.models import SeoModel, SeoModelTranslation+from ..product.models import PublishedQuerySet-class PageQuerySet(models.QuerySet):+class PagePublishedQuerySet(PublishedQuerySet):- def public(self):- today = datetime.date.today()- return self.filter(- Q(is_visible=True),- Q(available_on__lte=today) | Q(available_on__isnull=True))-- def visible_to_user(self, user):- has_access_to_all = (- user.is_active and user.has_perm('page.manage_pages'))- if has_access_to_all:- return self.all()- return self.public()+ @staticmethod+ def user_has_access_to_all(user):+ return user.is_active and user.has_perm('page.manage_pages')class Page(SeoModel):@@ -31,10 +22,10 @@ class Page(SeoModel):title = models.CharField(max_length=200)content = models.TextField()created = models.DateTimeField(auto_now_add=True)- is_visible = models.BooleanField(default=False)- available_on = models.DateField(blank=True, null=True)+ is_published = models.BooleanField(default=False)+ publication_date = models.DateField(blank=True, null=True)- objects = PageQuerySet.as_manager()+ objects = PagePublishedQuerySet.as_manager()translated = TranslationProxy()class Meta:@@ -53,10 +44,10 @@ class Page(SeoModel):return build_absolute_uri(self.get_absolute_url())@property- def is_published(self):+ def is_available(self):today = datetime.date.today()- return self.is_visible and (- self.available_on is None or self.available_on <= today)+ return self.is_published and (+ self.publication_date is None or self.publication_date <= today)class PageTranslation(SeoModelTranslation):diff --git a/saleor/page/utils.py b/saleor/page/utils.pyindex df9f223d40..f9f4b2cb16 100644--- a/saleor/page/utils.py+++ b/saleor/page/utils.py@@ -5,4 +5,4 @@ def pages_visible_to_user(user):qs = Page.objects.prefetch_related('translations')if user.is_authenticated and user.is_active and user.is_staff:return qs- return qs.public()+ return qs.available()diff --git a/saleor/page/views.py b/saleor/page/views.pyindex 46810e7ca2..28ecc7fc8b 100644--- a/saleor/page/views.py+++ b/saleor/page/views.py@@ -11,7 +11,7 @@ def page_details(request, slug):pages_visible_to_user(user=request.user).filter(slug=slug))today = datetime.date.today()is_visible = (- page.available_on is None or page.available_on <= today)+ page.publication_date is None or page.publication_date <= today)return TemplateResponse(request, 'page/details.html', {'page': page, 'is_visible': is_visible})diff --git a/saleor/product/models.py b/saleor/product/models.pyindex 0338be7458..50eb18647f 100644--- a/saleor/product/models.py+++ b/saleor/product/models.py@@ -39,11 +39,11 @@ class PublishedQuerySet(models.QuerySet):is_published=True)@staticmethod- def user_has_access(user):+ def user_has_access_to_all(user):return user.is_active and user.has_perm('product.manage_products')def visible_to_user(self, user):- if self.user_has_access(user):+ if self.user_has_access_to_all(user):return self.all()return self.available()diff --git a/saleor/static/dashboard-next/gql-types.ts b/saleor/static/dashboard-next/gql-types.tsindex 1445435b92..ae2aab30e9 100644--- a/saleor/static/dashboard-next/gql-types.ts+++ b/saleor/static/dashboard-next/gql-types.ts@@ -1609,8 +1609,8 @@ export interface PageUpdateMutationVariables {title: string;content: string;slug: string;- isVisible: boolean;- availableOn?: string | null;+ isPublished: boolean;+ publicationDate?: string | null;}export interface PageUpdateMutation {@@ -1621,8 +1621,8 @@ export interface PageUpdateMutation {slug: string;title: string;content: string;- isVisible: boolean;- availableOn: string | null;+ isPublished: boolean;+ publicationDate: string | null;} | null;// List of errors that occurred executing the mutation.errors: Array<{@@ -1640,8 +1640,8 @@ export interface PageCreateMutationVariables {title: string;content: string;slug: string;- isVisible: boolean;- availableOn?: string | null;+ isPublished: boolean;+ publicationDate?: string | null;}export interface PageCreateMutation {@@ -1652,8 +1652,8 @@ export interface PageCreateMutation {slug: string;title: string;content: string;- isVisible: boolean;- availableOn: string | null;+ isPublished: boolean;+ publicationDate: string | null;created: string;} | null;// List of errors that occurred executing the mutation.@@ -1687,7 +1687,7 @@ export interface PageListQuery {id: string;slug: string;title: string;- isVisible: boolean;+ isPublished: boolean;};}>;pageInfo: {@@ -1716,8 +1716,8 @@ export interface PageDetailsQuery {title: string;content: string;created: string;- isVisible: boolean;- availableOn: string | null;+ isPublished: boolean;+ publicationDate: string | null;} | null;}diff --git a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsxindex 1f238b9d28..c8cf932859 100644--- a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx+++ b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx@@ -15,14 +15,14 @@ interface PageInput {title: string;content: string;slug: string;- availableOn: string;- isVisible: boolean;+ publicationDate: string;+ isPublished: boolean;}const defaultPage = {- availableOn: "",content: "",- isVisible: false,+ isPublished: false,+ publicationDate: "",slug: "",title: ""};@@ -79,9 +79,9 @@ const PageDetailsPage: React.StatelessComponent<PageDetailsPageProps> = ({</div><div><PageProperties- availableOn={data.availableOn}+ publicationDate={data.publicationDate}created={page ? page.created : undefined}- isVisible={data.isVisible}+ isPublished={data.isPublished}loading={disabled}onChange={change}slug={data.slug}diff --git a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsxindex 3690007a28..deeb1a40cc 100644--- a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx+++ b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx@@ -37,7 +37,7 @@ interface PageListProps extends ListProps, WithStyles<typeof styles> {id: string;title: string;slug: string;- isVisible: boolean;+ isPublished: boolean;}>;}@@ -89,11 +89,11 @@ export const PageList = withStyles(styles, { name: "PageList" })({page ? (<StatusLabellabel={- page.isVisible+ page.isPublished? i18n.t("Published", { context: "object" }): i18n.t("Not published", { context: "object" })}- status={page.isVisible ? "success" : "error"}+ status={page.isPublished ? "success" : "error"}/>) : (<Skeleton />diff --git a/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx b/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsxindex 3eee4cb17f..1ce41b7ac9 100644--- a/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx+++ b/saleor/static/dashboard-next/pages/components/PageListPage/PageListPage.tsx@@ -13,7 +13,7 @@ interface PageListPageProps extends PageListProps {id: string;title: string;slug: string;- isVisible: boolean;+ isPublished: boolean;}>;}diff --git a/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsx b/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsxindex 6d9cfc10e8..db3184faed 100644--- a/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsx+++ b/saleor/static/dashboard-next/pages/components/PageProperties/PageProperties.tsx@@ -10,10 +10,10 @@ import FormSpacer from "../../../components/FormSpacer";import i18n from "../../../i18n";interface PagePropertiesProps {- availableOn: string;+ publicationDate: string;created?: string;errors?: Array<{ field: string; message: string }>;- isVisible: boolean;+ isPublished: boolean;loading?: boolean;slug?: string;onChange?(event: React.ChangeEvent<any>);@@ -23,9 +23,9 @@ const PageProperties: React.StatelessComponent<PagePropertiesProps> = ({created,errors,slug,- availableOn,+ publicationDate,loading,- isVisible,+ isPublished,onChange}) => {const errorList: { [key: string]: string } = errors@@ -56,18 +56,18 @@ const PageProperties: React.StatelessComponent<PagePropertiesProps> = ({<FormSpacer /><TextFielddisabled={loading}- name="availableOn"- label={i18n.t("Available on", { context: "label" })}+ name="publicationDate"+ label={i18n.t("Publication date", { context: "label" })}type="date"- value={availableOn}+ value={publicationDate}onChange={onChange}InputLabelProps={{shrink: true}}helperText={- errorList && errorList.availableOn ? errorList.availableOn : ""+ errorList && errorList.publicationDate ? errorList.publicationDate : ""}- error={!!(errorList && errorList.availableOn)}+ error={!!(errorList && errorList.publicationDate)}fullWidth/><FormSpacer />@@ -80,10 +80,10 @@ const PageProperties: React.StatelessComponent<PagePropertiesProps> = ({)}<FormSpacer /><ControlledCheckbox- checked={isVisible}+ checked={isPublished}disabled={loading}label={i18n.t("Published", { context: "label" })}- name="isVisible"+ name="isPublished"onChange={onChange}/></CardContent>diff --git a/saleor/static/dashboard-next/pages/fixtures.ts b/saleor/static/dashboard-next/pages/fixtures.tsindex c3c41ea8f9..2d51044fb3 100644--- a/saleor/static/dashboard-next/pages/fixtures.ts+++ b/saleor/static/dashboard-next/pages/fixtures.ts@@ -1,23 +1,23 @@export const pages = [{id: "UGFnZTox",- isVisible: true,+ isPublished: true,slug: "about",title: "About"},{id: "UGFnZToy",- isVisible: false,+ isPublished: false,slug: "terms-of-use",title: "Terms of use"}];export const page = {- availableOn: "2018-03-20T16:39:08.850105+00:00",+ publicationDate: "2018-03-20T16:39:08.850105+00:00",content:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin bibendum et justo sit amet viverra. Maecenas euismod auctor nisi et tincidunt. Maecenas ante urna, aliquet at odio sed, gravida efficitur purus. Morbi ut dapibus ante. Nulla eu neque sit amet odio tincidunt porttitor eu quis purus. Aliquam at diam sit amet turpis varius semper vitae non lectus. Vivamus lectus ligula, molestie eu augue eu, cursus tincidunt sem. Nam ornare egestas tincidunt.",createdAt: "2018-03-13T16:39:08.850105+00:00",- isVisible: true,+ isPublished: true,slug: "lorem-ipsum-dolor",title: "Lorem Ipsum"};diff --git a/saleor/static/dashboard-next/pages/mutations.ts b/saleor/static/dashboard-next/pages/mutations.tsindex 6f89502a8f..24c1a51344 100644--- a/saleor/static/dashboard-next/pages/mutations.ts+++ b/saleor/static/dashboard-next/pages/mutations.ts@@ -27,8 +27,8 @@ export const pageUpdateMutation = gql`$title: String!$content: String!$slug: String!- $isVisible: Boolean!- $availableOn: String+ $isPublished: Boolean!+ $publicationDate: String) {pageUpdate(id: $id@@ -36,8 +36,8 @@ export const pageUpdateMutation = gql`title: $titlecontent: $contentslug: $slug- isVisible: $isVisible- availableOn: $availableOn+ isPublished: $isPublished+ publicationDate: $publicationDate}) {page {@@ -45,8 +45,8 @@ export const pageUpdateMutation = gql`slugtitlecontent- isVisible- availableOn+ isPublished+ publicationDate}errors {field@@ -65,16 +65,16 @@ export const pageCreateMutation = gql`$title: String!$content: String!$slug: String!- $isVisible: Boolean!- $availableOn: String+ $isPublished: Boolean!+ $publicationDate: String) {pageCreate(input: {title: $titlecontent: $contentslug: $slug- isVisible: $isVisible- availableOn: $availableOn+ isPublished: $isPublished+ publicationDate: $publicationDate}) {page {@@ -82,8 +82,8 @@ export const pageCreateMutation = gql`slugtitlecontent- isVisible- availableOn+ isPublished+ publicationDatecreated}errors {diff --git a/saleor/static/dashboard-next/pages/queries.ts b/saleor/static/dashboard-next/pages/queries.tsindex a9da0995f9..566caf3b26 100644--- a/saleor/static/dashboard-next/pages/queries.ts+++ b/saleor/static/dashboard-next/pages/queries.ts@@ -13,7 +13,7 @@ const pageListQuery = gql`idslugtitle- isVisible+ isPublished}}pageInfo {@@ -37,8 +37,8 @@ const pageDetailsQuery = gql`titlecontentcreated- isVisible- availableOn+ isPublished+ publicationDate}}`;diff --git a/saleor/static/dashboard-next/pages/types/PageCreate.ts b/saleor/static/dashboard-next/pages/types/PageCreate.tsindex 70354f96ab..5fe7bec0ae 100644--- a/saleor/static/dashboard-next/pages/types/PageCreate.ts+++ b/saleor/static/dashboard-next/pages/types/PageCreate.ts@@ -11,8 +11,8 @@ export interface PageCreate_pageCreate_page {slug: string;title: string;content: string;- isVisible: boolean;- availableOn: any | null;+ isPublished: boolean;+ publicationDate: any | null;created: any;}@@ -36,6 +36,6 @@ export interface PageCreateVariables {title: string;content: string;slug: string;- isVisible: boolean;- availableOn?: string | null;+ isPublished: boolean;+ publicationDate?: string | null;}diff --git a/saleor/static/dashboard-next/pages/types/PageDetails.ts b/saleor/static/dashboard-next/pages/types/PageDetails.tsindex ecebbf5fbf..431ffe1c6c 100644--- a/saleor/static/dashboard-next/pages/types/PageDetails.ts+++ b/saleor/static/dashboard-next/pages/types/PageDetails.ts@@ -12,8 +12,8 @@ export interface PageDetails_page {title: string;content: string;created: any;- isVisible: boolean;- availableOn: any | null;+ isPublished: boolean;+ publicationDate: any | null;}export interface PageDetails {diff --git a/saleor/static/dashboard-next/pages/types/PageList.ts b/saleor/static/dashboard-next/pages/types/PageList.tsindex 20378e4685..eb9001a2c4 100644--- a/saleor/static/dashboard-next/pages/types/PageList.ts+++ b/saleor/static/dashboard-next/pages/types/PageList.ts@@ -10,7 +10,7 @@ export interface PageList_pages_edges_node {id: string;slug: string;title: string;- isVisible: boolean;+ isPublished: boolean;}export interface PageList_pages_edges {diff --git a/saleor/static/dashboard-next/pages/types/PageUpdate.ts b/saleor/static/dashboard-next/pages/types/PageUpdate.tsindex 8e1bbe0267..3f44bdd4f2 100644--- a/saleor/static/dashboard-next/pages/types/PageUpdate.ts+++ b/saleor/static/dashboard-next/pages/types/PageUpdate.ts@@ -11,8 +11,8 @@ export interface PageUpdate_pageUpdate_page {slug: string;title: string;content: string;- isVisible: boolean;- availableOn: any | null;+ isPublished: boolean;+ publicationDate: any | null;}export interface PageUpdate_pageUpdate_errors {@@ -36,6 +36,6 @@ export interface PageUpdateVariables {title: string;content: string;slug: string;- isVisible: boolean;- availableOn?: string | null;+ isPublished: boolean;+ publicationDate?: string | null;}diff --git a/saleor/static/dashboard-next/pages/views/PageCreate.tsx b/saleor/static/dashboard-next/pages/views/PageCreate.tsxindex 679074aae7..38fa9c1953 100644--- a/saleor/static/dashboard-next/pages/views/PageCreate.tsx+++ b/saleor/static/dashboard-next/pages/views/PageCreate.tsx@@ -28,9 +28,9 @@ export const PageCreateForm: React.StatelessComponent = () => (<PageDetailsPagedisabled={loading}page={{- availableOn: "",+ publicationDate: "",content: "",- isVisible: false,+ isPublished: false,slug: "",title: ""}}diff --git a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snapindex 0877dcf375..9ca0f57f14 100644--- a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap+++ b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap@@ -5908,7 +5908,7 @@ exports[`Storyshots Pages / PageProperties when loaded 1`] = `class="MuiFormLabel-root-id MuiFormLabel-filled-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id"data-shrink="true">- Available on+ Publication date</label><divclass="MuiInputBase-root-id MuiInput-root-id MuiInput-underline-id MuiInputBase-fullWidth-id MuiInput-fullWidth-id MuiInputBase-formControl-id MuiInput-formControl-id"@@ -5916,7 +5916,7 @@ exports[`Storyshots Pages / PageProperties when loaded 1`] = `<inputaria-invalid="false"class="MuiInputBase-input-id MuiInput-input-id MuiInputBase-inputType-id MuiInput-inputType-id"- name="availableOn"+ name="publicationDate"type="date"value="2018-03-20T16:39:08.850105+00:00"/>@@ -5952,7 +5952,7 @@ exports[`Storyshots Pages / PageProperties when loaded 1`] = `checked=""class="MuiPrivateSwitchBase-input-id"data-indeterminate="false"- name="isVisible"+ name="isPublished"type="checkbox"/></span>@@ -6012,7 +6012,7 @@ exports[`Storyshots Pages / PageProperties when loading 1`] = `class="MuiFormLabel-root-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id"data-shrink="true">- Available on+ Publication date</label><divclass="MuiInputBase-root-id MuiInput-root-id MuiInput-underline-id MuiInputBase-disabled-id MuiInput-disabled-id MuiInputBase-fullWidth-id MuiInput-fullWidth-id MuiInputBase-formControl-id MuiInput-formControl-id"@@ -6021,7 +6021,7 @@ exports[`Storyshots Pages / PageProperties when loading 1`] = `aria-invalid="false"class="MuiInputBase-input-id MuiInput-input-id MuiInputBase-disabled-id MuiInput-disabled-id MuiInputBase-inputType-id MuiInput-inputType-id"disabled=""- name="availableOn"+ name="publicationDate"type="date"value=""/>@@ -6058,7 +6058,7 @@ exports[`Storyshots Pages / PageProperties when loading 1`] = `class="MuiPrivateSwitchBase-input-id"data-indeterminate="false"disabled=""- name="isVisible"+ name="isPublished"type="checkbox"/></span>@@ -40836,7 +40836,7 @@ exports[`Storyshots Views / Pages / Page details when loading 1`] = `class="MuiFormLabel-root-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id"data-shrink="true">- Available on+ Publication date</label><divclass="MuiInputBase-root-id MuiInput-root-id MuiInput-underline-id MuiInputBase-disabled-id MuiInput-disabled-id MuiInputBase-fullWidth-id MuiInput-fullWidth-id MuiInputBase-formControl-id MuiInput-formControl-id"@@ -40845,7 +40845,7 @@ exports[`Storyshots Views / Pages / Page details when loading 1`] = `aria-invalid="false"class="MuiInputBase-input-id MuiInput-input-id MuiInputBase-disabled-id MuiInput-disabled-id MuiInputBase-inputType-id MuiInput-inputType-id"disabled=""- name="availableOn"+ name="publicationDate"type="date"value=""/>@@ -40882,7 +40882,7 @@ exports[`Storyshots Views / Pages / Page details when loading 1`] = `class="MuiPrivateSwitchBase-input-id"data-indeterminate="false"disabled=""- name="isVisible"+ name="isPublished"type="checkbox"/></span>@@ -41154,7 +41154,7 @@ exports[`Storyshots Views / Pages / Page details with initial data 1`] = `class="MuiFormLabel-root-id MuiFormLabel-filled-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-shrink-id"data-shrink="true">- Available on+ Publication date</label><divclass="MuiInputBase-root-id MuiInput-root-id MuiInput-underline-id MuiInputBase-fullWidth-id MuiInput-fullWidth-id MuiInputBase-formControl-id MuiInput-formControl-id"@@ -41162,7 +41162,7 @@ exports[`Storyshots Views / Pages / Page details with initial data 1`] = `<inputaria-invalid="false"class="MuiInputBase-input-id MuiInput-input-id MuiInputBase-inputType-id MuiInput-inputType-id"- name="availableOn"+ name="publicationDate"type="date"value="2018-03-20T16:39:08.850105+00:00"/>@@ -41198,7 +41198,7 @@ exports[`Storyshots Views / Pages / Page details with initial data 1`] = `checked=""class="MuiPrivateSwitchBase-input-id"data-indeterminate="false"- name="isVisible"+ name="isPublished"type="checkbox"/></span>diff --git a/saleor/static/dashboard-next/storybook/stories/pages/PageProperties.tsx b/saleor/static/dashboard-next/storybook/stories/pages/PageProperties.tsxindex 788c848f44..0a9aae3762 100644--- a/saleor/static/dashboard-next/storybook/stories/pages/PageProperties.tsx+++ b/saleor/static/dashboard-next/storybook/stories/pages/PageProperties.tsx@@ -9,5 +9,5 @@ storiesOf("Pages / PageProperties", module).addDecorator(Decorator).add("when loaded", () => <PageProperties {...page} />).add("when loading", () => (- <PageProperties loading={true} availableOn="" isVisible={false} />+ <PageProperties loading={true} publicationDate="" isPublished={false} />));diff --git a/templates/dashboard/includes/_page_availability.html b/templates/dashboard/includes/_page_availability.htmlindex 92180fb224..2cd26e8019 100644--- a/templates/dashboard/includes/_page_availability.html+++ b/templates/dashboard/includes/_page_availability.html@@ -1,14 +1,14 @@{% load i18n %}-{% if is_published %}+{% if is_available %}<div class="label label-{{ label_cls }}">{% trans "Published" context "Page availability status" %}</div>-{% elif not page.is_visible %}+{% elif not page.is_published %}<div class="label">{% trans "Hidden" context "Page availability status" %}</div>-{% elif page.available_on %}+{% elif page.publication_date %}<div class="label">{% blocktrans with date=page.available_on context "Page availability status" %}Hidden (will become visible on {{ date }})diff --git a/templates/dashboard/page/form.html b/templates/dashboard/page/form.htmlindex 79c526d2e5..b6a56aeee9 100644--- a/templates/dashboard/page/form.html+++ b/templates/dashboard/page/form.html@@ -70,8 +70,8 @@</div><div class="col s12 l4">{{ form.slug|materializecss }}- {{ form.available_on|materializecss }}- {{ form.is_visible|materializecss }}+ {{ form.publication_date|materializecss }}+ {{ form.is_published|materializecss }}</div></div></div>diff --git a/templates/page/details.html b/templates/page/details.htmlindex 83ef3e0cd8..e01c3d1e64 100644--- a/templates/page/details.html+++ b/templates/page/details.html@@ -36,7 +36,7 @@{% endblock breadcrumb %}{% block content %}- {% if not page.is_visible %}+ {% if not page.is_published %}<div class="alert alert-warning" role="alert">{% blocktrans context "Unavailable page detail text" %}<strong>Warning!</strong>@@ -45,7 +45,7 @@</div>{% elif not is_visible %}<div class="alert alert-warning" role="alert">- {% blocktrans trimmed with date=page.available_on|date context "Unpublished page details text" %}+ {% blocktrans trimmed with date=page.publication_date|date context "Unpublished page details text" %}<strong>Warning!</strong>You are previewing a page that will become visible on <strong>{{ date }}</strong>.{% endblocktrans %}diff --git a/tests/api/test_page.py b/tests/api/test_page.pyindex c7924e1265..ba23ad3312 100644--- a/tests/api/test_page.py+++ b/tests/api/test_page.py@@ -15,7 +15,7 @@ PAGE_QUERY = """def test_query_published_page(user_api_client, page):- page.is_visible = True+ page.is_published = Truepage.save()# query by ID@@ -34,7 +34,7 @@ def test_query_published_page(user_api_client, page):def test_customer_query_unpublished_page(user_api_client, page):- page.is_visible = False+ page.is_published = Falsepage.save()# query by ID@@ -52,7 +52,7 @@ def test_customer_query_unpublished_page(user_api_client, page):def test_staff_query_unpublished_page(staff_api_client, page, permission_manage_pages):- page.is_visible = False+ page.is_published = Falsepage.save()# query by ID@@ -86,17 +86,17 @@ def test_page_create_mutation(staff_api_client, permission_manage_pages):query = """mutation CreatePage($slug: String!, $title: String!, $content: String!,- $isVisible: Boolean!) {+ $isPublished: Boolean!) {pageCreate(input: {slug: $slug, title: $title,- content: $content, isVisible: $isVisible}) {+ content: $content, isPublished: $isPublished}) {page {idtitlecontentslug- isVisible+ isPublished}errors {field@@ -108,12 +108,12 @@ def test_page_create_mutation(staff_api_client, permission_manage_pages):page_slug = 'test-slug'page_content = 'test content'page_title = 'test title'- page_isVisible = True+ page_isPublished = True# test creating root pagevariables = {'title': page_title, 'content': page_content,- 'isVisible': page_isVisible, 'slug': page_slug}+ 'isPublished': page_isPublished, 'slug': page_slug}response = staff_api_client.post_graphql(query, variables, permissions=[permission_manage_pages])content = get_graphql_content(response)@@ -122,7 +122,7 @@ def test_page_create_mutation(staff_api_client, permission_manage_pages):assert data['page']['title'] == page_titleassert data['page']['content'] == page_contentassert data['page']['slug'] == page_slug- assert data['page']['isVisible'] == page_isVisible+ assert data['page']['isPublished'] == page_isPublisheddef test_page_delete_mutation(staff_api_client, page, permission_manage_pages):@@ -151,17 +151,17 @@ def test_page_delete_mutation(staff_api_client, page, permission_manage_pages):def test_paginate_pages(user_api_client, page):- page.is_visible = True+ page.is_published = Truedata_02 = {'slug': 'test02-url','title': 'Test page','content': 'test content',- 'is_visible': True}+ 'is_published': True}data_03 = {'slug': 'test03-url','title': 'Test page','content': 'test content',- 'is_visible': True}+ 'is_published': True}page2 = Page.objects.create(**data_02)page3 = Page.objects.create(**data_03)diff --git a/tests/dashboard/test_menu.py b/tests/dashboard/test_menu.pyindex a18da1df10..5f396a27dd 100644--- a/tests/dashboard/test_menu.py+++ b/tests/dashboard/test_menu.py@@ -263,8 +263,8 @@ def test_view_ajax_reorder_menu_items_with_parent(def test_view_ajax_menu_links(admin_client, collection, category, page):collection.is_published = Falsecollection.save()- page.is_visible = True- page.available_on = timezone.now() + timezone.timedelta(days=1)+ page.is_published = True+ page.publication_date = timezone.now() + timezone.timedelta(days=1)page.save()page.refresh_from_db()@@ -278,7 +278,7 @@ def test_view_ajax_menu_links(admin_client, collection, category, page):'id': str(page.pk) + '_' + 'Page','text': '%(menu_item_name)s is hidden ''(will become visible on %(available_on_date)s)' % ({- 'available_on_date': localize(page.available_on),+ 'available_on_date': localize(page.publication_date),'menu_item_name': str(page)})}groups = [{'text': 'Collection', 'children': [collection_repr]},@@ -395,7 +395,7 @@ def test_menu_item_status(menu, category, collection, page):item = MenuItem.objects.create(name='Name', menu=menu, page=page)assert not item.is_public()- page.is_visible = True+ page.is_published = Truepage.save()item.refresh_from_db()assert item.is_public()diff --git a/tests/test_page.py b/tests/test_page.pyindex 0e1d71c505..ca89b58dea 100644--- a/tests/test_page.py+++ b/tests/test_page.py@@ -7,7 +7,7 @@ def test_draft_page_details(client, admin_client, page):def test_public_page_details(client, admin_client, page):- page.is_visible = True+ page.is_published = Truepage.save()page_url = page.get_absolute_url()response = client.get(page_url)diff --git a/tests/test_templatetags.py b/tests/test_templatetags.pyindex 0160332726..d15e81dfa1 100644--- a/tests/test_templatetags.py+++ b/tests/test_templatetags.py@@ -35,10 +35,10 @@ def test_menu(menu_with_items):def test_render_page_availability(page):page_ctx = render_page_availability(page)- assert page_ctx == {'page': page, 'is_published': False}+ assert page_ctx == {'page': page, 'is_available': False}- page.is_visible = True+ page.is_published = Truepage.save()page_ctx = render_page_availability(page)assert page_ctx == {- 'page': page, 'is_published': True, 'label_cls': LABEL_SUCCESS}+ 'page': page, 'is_available': True, 'label_cls': LABEL_SUCCESS}