Skip to content

Commit

Permalink
legal stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiboutas committed Jan 7, 2024
1 parent 3fec517 commit 057e662
Show file tree
Hide file tree
Showing 16 changed files with 354 additions and 37 deletions.
82 changes: 82 additions & 0 deletions cms/migrations/0002_links_delete_socialmedialinks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Generated by Django 4.2.5 on 2024-01-07 14:06

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("wagtailcore", "0089_log_entry_data_json_null_to_object"),
("cms", "0001_initial"),
]

operations = [
migrations.CreateModel(
name="Links",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"facebook",
models.URLField(blank=True, help_text="Facebook URL", null=True),
),
(
"twitter",
models.URLField(blank=True, help_text="Twitter URL", null=True),
),
(
"youtube",
models.URLField(
blank=True, help_text="YouTube Channel URL", null=True
),
),
(
"linkedin",
models.URLField(blank=True, help_text="Linkedin URL", null=True),
),
(
"github",
models.URLField(blank=True, help_text="GitHub URL", null=True),
),
(
"instagram",
models.URLField(blank=True, help_text="Instagram URL", null=True),
),
(
"whatsapp",
models.URLField(blank=True, help_text="Whatapp URL", null=True),
),
(
"telegram",
models.URLField(blank=True, help_text="Telegram URL", null=True),
),
(
"email",
models.EmailField(
blank=True, help_text="Email Address", max_length=254, null=True
),
),
(
"site",
models.OneToOneField(
editable=False,
on_delete=django.db.models.deletion.CASCADE,
to="wagtailcore.site",
),
),
],
options={
"abstract": False,
},
),
migrations.DeleteModel(
name="SocialMediaLinks",
),
]
69 changes: 69 additions & 0 deletions cms/migrations/0003_legal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Generated by Django 4.2.5 on 2024-01-07 14:32

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("wagtailcore", "0089_log_entry_data_json_null_to_object"),
("cms", "0002_links_delete_socialmedialinks"),
]

operations = [
migrations.CreateModel(
name="Legal",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"impress_page",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
(
"privacy_policy_page",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
(
"site",
models.OneToOneField(
editable=False,
on_delete=django.db.models.deletion.CASCADE,
to="wagtailcore.site",
),
),
(
"terms_page",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
],
options={
"abstract": False,
},
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Generated by Django 4.2.5 on 2024-01-07 14:36

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("cms", "0003_legal"),
]

operations = [
migrations.AddField(
model_name="legal",
name="impress_page_de",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
migrations.AddField(
model_name="legal",
name="impress_page_en",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
migrations.AddField(
model_name="legal",
name="impress_page_es",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
migrations.AddField(
model_name="legal",
name="privacy_policy_page_de",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
migrations.AddField(
model_name="legal",
name="privacy_policy_page_en",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
migrations.AddField(
model_name="legal",
name="privacy_policy_page_es",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
migrations.AddField(
model_name="legal",
name="terms_page_de",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
migrations.AddField(
model_name="legal",
name="terms_page_en",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
migrations.AddField(
model_name="legal",
name="terms_page_es",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="cms.textpage",
),
),
]
3 changes: 2 additions & 1 deletion cms/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
from .menus import CustomMainMenuItem
from .setttings import Banner
from .setttings import Brand
from .setttings import SocialMediaLinks
from .setttings import Links
from .snippets import FrequentAskedQuestion
from .snippets import Person
from .text import TextPage

# Home page
# Blog pages
# Text page
Expand Down
2 changes: 1 addition & 1 deletion cms/models/djangopages.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DjangoServedPage(Page):
template = "404.html"

subpage_types = []
parent_page_type = ["wagtailcore.Page"]
parent_page_type = ["cms.HomePage"]

content_panels = [
FieldPanel("title"),
Expand Down
2 changes: 2 additions & 0 deletions cms/models/flex.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@

class FlexPage(Page):
template = "cms/flexpage.html"
subpage_types = []
parent_page_type = ["cms.HomePage"]

body = FullStreamBlock()
45 changes: 41 additions & 4 deletions cms/models/setttings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@

from wagtail.images.models import Image


from ..utils import localized_fieldpanel_list
from .text import TextPage


@register_setting(icon="link")
class SocialMediaLinks(BaseSiteSetting):
"""Social media settings for our custom website."""
class Links(BaseSiteSetting):
"""Links settings for our custom website."""

facebook = models.URLField(blank=True, null=True, help_text="Facebook URL")
twitter = models.URLField(blank=True, null=True, help_text="Twitter URL")
youtube = models.URLField(blank=True, null=True, help_text="YouTube Channel URL")
linkedin = models.URLField(blank=True, null=True, help_text="Linkedin URL")
github = models.URLField(blank=True, null=True, help_text="GitHub URL")
instagram = models.URLField(blank=True, null=True, help_text="Instagram URL")
whatsapp = models.URLField(blank=True, null=True, help_text="Whatapp URL")
telegram = models.URLField(blank=True, null=True, help_text="Telegram URL")
email = models.EmailField(blank=True, null=True, help_text="Email Address")

panels = [
MultiFieldPanel(
Expand All @@ -30,8 +33,11 @@ class SocialMediaLinks(BaseSiteSetting):
FieldPanel("youtube"),
FieldPanel("linkedin"),
FieldPanel("instagram"),
FieldPanel("whatsapp"),
FieldPanel("telegram"),
FieldPanel("email"),
],
heading="Social Media Settings",
heading="Links",
)
]

Expand All @@ -58,6 +64,37 @@ class Brand(BaseSiteSetting):
]


@register_setting(icon="user")
class Legal(BaseSiteSetting):
privacy_policy_page = models.ForeignKey(
TextPage,
on_delete=models.CASCADE,
blank=True,
null=True,
related_name="+",
)
terms_page = models.ForeignKey(
TextPage,
on_delete=models.CASCADE,
blank=True,
null=True,
related_name="+",
)
impress_page = models.ForeignKey(
TextPage,
on_delete=models.CASCADE,
blank=True,
null=True,
related_name="+",
)

panels = (
localized_fieldpanel_list("privacy_policy_page")
+ localized_fieldpanel_list("terms_page")
+ localized_fieldpanel_list("impress_page")
)


@register_setting(icon="pick")
class Banner(BaseSiteSetting):
linked_page = models.ForeignKey(
Expand Down
3 changes: 3 additions & 0 deletions cms/models/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
class TextPage(Page):
template = "cms/textpage.html"

subpage_types = []
parent_page_type = ["cms.HomePage"]

body = StreamField(
TextStreamBlock(features=settings.CMS_RICHTEXT_FEATURES),
verbose_name="Home content block",
Expand Down
Loading

0 comments on commit 057e662

Please sign in to comment.