Skip to content

Commit

Permalink
apps/measures: use url field not charfield for website fixes #878
Browse files Browse the repository at this point in the history
  • Loading branch information
philli-m authored and goapunk committed Oct 31, 2023
1 parent bc82559 commit 5662679
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
28 changes: 28 additions & 0 deletions apps/measures/migrations/0012_use_urlfield_for_website.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 3.2.19 on 2023-10-26 14:57

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('apps_measures', '0011_alter_measuresdetailpage_districts'),
]

operations = [
migrations.AlterField(
model_name='measuresdetailpage',
name='contact_website_de',
field=models.URLField(blank=True, max_length=2000),
),
migrations.AlterField(
model_name='measuresdetailpage',
name='contact_website_de_ls',
field=models.URLField(blank=True, max_length=2000),
),
migrations.AlterField(
model_name='measuresdetailpage',
name='contact_website_en',
field=models.URLField(blank=True, max_length=2000),
),
]
6 changes: 3 additions & 3 deletions apps/measures/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,15 +461,15 @@ class MeasuresDetailPage(TranslatedMetadataPageMixin, Page):
contact_phone = models.CharField(max_length=20, blank=True)

contact_organisation_name_de = models.CharField(max_length=80, blank=False)
contact_website_de = models.CharField(max_length=2000, blank=True)
contact_website_de = models.URLField(max_length=2000, blank=True)

contact_organisation_name_en = models.CharField(max_length=80, blank=True)
contact_website_en = models.CharField(max_length=2000, blank=True)
contact_website_en = models.URLField(max_length=2000, blank=True)

contact_organisation_name_de_ls = models.CharField(
max_length=80, blank=True
)
contact_website_de_ls = models.CharField(max_length=2000, blank=True)
contact_website_de_ls = models.URLField(max_length=2000, blank=True)

page_title = TranslatedField(
'page_title_de',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h2 class="title">{% translate 'Contact' %}</h2>
<li class="tel"><a href="tel:{{page.contact_phone}}">{{ page.contact_phone }}</a></li>
{% endif %}
{% if page.contact_website %}
<li class="homepage"><a href="{{page.contact_website}}">{{ page.contact_website }}</a></li>
<li class="homepage"><a href="{{page.contact_website}}" target="_blank">{{ page.contact_website }}</a></li>
{% endif %}
</ul>
</section>
Expand Down
3 changes: 3 additions & 0 deletions changelog/878.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Changed

- changed CharField to URLField for measure detail website to ensure links works fixes 878

0 comments on commit 5662679

Please sign in to comment.