From df8a333d06d3c29515d9e339561f629a1201ea8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Farka?= <stepanfarka11@gmail.com> Date: Wed, 9 Mar 2022 11:15:33 +0100 Subject: [PATCH] [ADD] custom web url, longer text for job and job function --- .../migrations/0041_auto_20220309_1109.py | 42 +++++++++++++++++++ district/models.py | 10 ++++- .../district/district_person_page.html | 5 +++ region/migrations/0016_auto_20220309_1109.py | 42 +++++++++++++++++++ region/models.py | 10 ++++- .../templates/region/region_person_page.html | 10 +++++ 6 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 district/migrations/0041_auto_20220309_1109.py create mode 100644 region/migrations/0016_auto_20220309_1109.py diff --git a/district/migrations/0041_auto_20220309_1109.py b/district/migrations/0041_auto_20220309_1109.py new file mode 100644 index 00000000..6dc9d414 --- /dev/null +++ b/district/migrations/0041_auto_20220309_1109.py @@ -0,0 +1,42 @@ +# Generated by Django 3.2.11 on 2022-03-09 10:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("district", "0040_districthomepage_menu"), + ] + + operations = [ + migrations.AddField( + model_name="districtpersonpage", + name="custom_web_url", + field=models.URLField( + blank=True, null=True, verbose_name="Odkaz na vlastní web" + ), + ), + migrations.AlterField( + model_name="districtpersonpage", + name="job", + field=models.CharField( + blank=True, + help_text="Např. 'Informatik'", + max_length=128, + null=True, + verbose_name="Povolání", + ), + ), + migrations.AlterField( + model_name="districtpersonpage", + name="job_function", + field=models.CharField( + blank=True, + help_text="Např. 'Předseda'", + max_length=128, + null=True, + verbose_name="Funkce", + ), + ), + ] diff --git a/district/models.py b/district/models.py index 539bc68a..905e64ba 100644 --- a/district/models.py +++ b/district/models.py @@ -438,10 +438,14 @@ class DistrictPersonPage(SubpageMixin, MetadataPageMixin, Page): ### FIELDS job = models.CharField( - "Povolání", max_length=64, blank=True, null=True, help_text="Např. 'Informatik'" + "Povolání", + max_length=128, + blank=True, + null=True, + help_text="Např. 'Informatik'", ) job_function = models.CharField( - "Funkce", max_length=64, blank=True, null=True, help_text="Např. 'Předseda'" + "Funkce", max_length=128, blank=True, null=True, help_text="Např. 'Předseda'" ) background_photo = models.ForeignKey( "wagtailimages.Image", @@ -472,6 +476,7 @@ class DistrictPersonPage(SubpageMixin, MetadataPageMixin, Page): twitter_url = models.URLField("Odkaz na Twitter", blank=True, null=True) youtube_url = models.URLField("Odkaz na Youtube kanál", blank=True, null=True) flickr_url = models.URLField("Odkaz na Flickr", blank=True, null=True) + custom_web_url = models.URLField("Odkaz na vlastní web", blank=True, null=True) other_urls = StreamField( [("other_url", blocks.PersonUrlBlock())], verbose_name="Další odkaz", @@ -513,6 +518,7 @@ class DistrictPersonPage(SubpageMixin, MetadataPageMixin, Page): FieldPanel("twitter_url"), FieldPanel("youtube_url"), FieldPanel("flickr_url"), + FieldPanel("custom_web_url"), StreamFieldPanel("other_urls"), ], "Sociální sítě", diff --git a/district/templates/district/district_person_page.html b/district/templates/district/district_person_page.html index 79a75a9e..d9a36d3a 100644 --- a/district/templates/district/district_person_page.html +++ b/district/templates/district/district_person_page.html @@ -62,6 +62,11 @@ <i class="ico--flickr"></i> </a> {% endif %} + {% if page.custom_web_url %} + <a href="{{ page.custom_web_url }}" target="_blank" class="social-icon" rel="noreferrer noopener"> + <i class="ico--globe"></i> + </a> + {% endif %} {% for person_link_block in page.other_urls %} <a href="{{ person_link_block.value.url }}" diff --git a/region/migrations/0016_auto_20220309_1109.py b/region/migrations/0016_auto_20220309_1109.py new file mode 100644 index 00000000..635a6e34 --- /dev/null +++ b/region/migrations/0016_auto_20220309_1109.py @@ -0,0 +1,42 @@ +# Generated by Django 3.2.11 on 2022-03-09 10:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("region", "0015_regionhomepage_menu"), + ] + + operations = [ + migrations.AddField( + model_name="regionpersonpage", + name="custom_web_url", + field=models.URLField( + blank=True, null=True, verbose_name="Odkaz na vlastní web" + ), + ), + migrations.AlterField( + model_name="regionpersonpage", + name="job", + field=models.CharField( + blank=True, + help_text="Např. 'Informatik'", + max_length=128, + null=True, + verbose_name="Povolání", + ), + ), + migrations.AlterField( + model_name="regionpersonpage", + name="job_function", + field=models.CharField( + blank=True, + help_text="Např. 'Předseda'", + max_length=128, + null=True, + verbose_name="Funkce", + ), + ), + ] diff --git a/region/models.py b/region/models.py index b3d86dcc..f661c87f 100644 --- a/region/models.py +++ b/region/models.py @@ -431,10 +431,14 @@ class RegionPersonPage(SubpageMixin, MetadataPageMixin, Page): ### FIELDS job = models.CharField( - "Povolání", max_length=64, blank=True, null=True, help_text="Např. 'Informatik'" + "Povolání", + max_length=128, + blank=True, + null=True, + help_text="Např. 'Informatik'", ) job_function = models.CharField( - "Funkce", max_length=64, blank=True, null=True, help_text="Např. 'Předseda'" + "Funkce", max_length=128, blank=True, null=True, help_text="Např. 'Předseda'" ) background_photo = models.ForeignKey( "wagtailimages.Image", @@ -465,6 +469,7 @@ class RegionPersonPage(SubpageMixin, MetadataPageMixin, Page): twitter_url = models.URLField("Odkaz na Twitter", blank=True, null=True) youtube_url = models.URLField("Odkaz na Youtube kanál", blank=True, null=True) flickr_url = models.URLField("Odkaz na Flickr", blank=True, null=True) + custom_web_url = models.URLField("Odkaz na vlastní web", blank=True, null=True) other_urls = StreamField( [("other_url", blocks.PersonUrlBlock())], verbose_name="Další odkaz", @@ -506,6 +511,7 @@ class RegionPersonPage(SubpageMixin, MetadataPageMixin, Page): FieldPanel("twitter_url"), FieldPanel("youtube_url"), FieldPanel("flickr_url"), + FieldPanel("custom_web_url"), ], "Sociální sítě", ), diff --git a/region/templates/region/region_person_page.html b/region/templates/region/region_person_page.html index 95d287d8..b09c579e 100644 --- a/region/templates/region/region_person_page.html +++ b/region/templates/region/region_person_page.html @@ -62,6 +62,16 @@ <i class="ico--flickr"></i> </a> {% endif %} + {% if page.flickr_url %} + <a href="{{ page.flickr_url }}" target="_blank" class="social-icon" rel="noreferrer noopener"> + <i class="ico--flickr"></i> + </a> + {% endif %} + {% if page.custom_web_url %} + <a href="{{ page.custom_web_url }}" target="_blank" class="social-icon" rel="noreferrer noopener"> + <i class="ico--globe"></i> + </a> + {% endif %} {% for person_link_block in page.other_urls %} <a href="{{ person_link_block.value.url }}" -- GitLab