Move the hint message for organisation to its own file
authorMagnus Hagander <magnus@hagander.net>
Thu, 14 Jan 2021 15:49:03 +0000 (16:49 +0100)
committerMagnus Hagander <magnus@hagander.net>
Thu, 14 Jan 2021 15:49:42 +0000 (16:49 +0100)
This is way too much text to duplicate across many places..

pgweb/core/text.py [new file with mode: 0644]
pgweb/events/migrations/0001_initial.py
pgweb/events/models.py
pgweb/news/migrations/0001_initial.py
pgweb/news/models.py
pgweb/profserv/migrations/0001_initial.py
pgweb/profserv/models.py

diff --git a/pgweb/core/text.py b/pgweb/core/text.py
new file mode 100644 (file)
index 0000000..862252d
--- /dev/null
@@ -0,0 +1 @@
+ORGANISATION_HINT_TEXT = "If no organisations are listed, please check the <a href=\"/account/orglist/\">organisation list</a> and contact the organisation manager or <a href=\"mailto:webmaster@postgresql.org\">webmaster@postgresql.org</a> if none are listed."
index 55af97ba0d29503998ab3c8b1ef8a9ce4bf80129..e7822a72b93caeff0e4ff2df0f45a9e45f43954a 100644 (file)
@@ -3,6 +3,8 @@ from __future__ import unicode_literals
 
 from django.db import migrations, models
 
+from pgweb.core.text import ORGANISATION_HINT_TEXT
+
 
 class Migration(migrations.Migration):
 
@@ -27,7 +29,7 @@ class Migration(migrations.Migration):
                 ('details', models.TextField(help_text='Complete event description')),
                 ('country', models.ForeignKey(blank=True, to='core.Country', null=True, on_delete=models.CASCADE)),
                 ('language', models.ForeignKey(default='eng', blank=True, to='core.Language', help_text='Primary language for event. When multiple languages, specify this in the event description', null=True, on_delete=models.CASCADE)),
-                ('org', models.ForeignKey(verbose_name='Organisation', to='core.Organisation', help_text='If no organisations are listed, please check the <a href="/account/orglist/">organisation list</a> and contact the organisation manager or <a href="mailto:webmaster@postgresql.org">webmaster@postgresql.org</a> if none are listed.', on_delete=models.CASCADE)),
+                ('org', models.ForeignKey(verbose_name='Organisation', to='core.Organisation', help_text=ORGANISATION_HINT_TEXT, on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('-startdate', '-enddate'),
index c7f48085b7a45ee3cc3a434b63755fe49f119ffd..2c9a17acc1951fc94e753a1c34dccebc00905a7d 100644 (file)
@@ -1,11 +1,12 @@
 from django.db import models
 
 from pgweb.core.models import Country, Language, Organisation
+from pgweb.core.text import ORGANISATION_HINT_TEXT
 from pgweb.util.moderation import TwostateModerateModel
 
 
 class Event(TwostateModerateModel):
-    org = models.ForeignKey(Organisation, null=False, blank=False, verbose_name="Organisation", help_text="If no organisations are listed, please check the <a href=\"/account/orglist/\">organisation list</a> and contact the organisation manager or <a href=\"mailto:webmaster@postgresql.org\">webmaster@postgresql.org</a> if none are listed.", on_delete=models.CASCADE)
+    org = models.ForeignKey(Organisation, null=False, blank=False, verbose_name="Organisation", help_text=ORGANISATION_HINT_TEXT, on_delete=models.CASCADE)
     title = models.CharField(max_length=100, null=False, blank=False)
     isonline = models.BooleanField(null=False, default=False, verbose_name="Online event")
     city = models.CharField(max_length=50, null=False, blank=True)
index 825e576d6e2bff8df87375beef166acf8082892e..43635c0cdb1ab074b657fd1134a95dc7e3a14636 100644 (file)
@@ -4,6 +4,8 @@ from __future__ import unicode_literals
 from django.db import migrations, models
 import datetime
 
+from pgweb.core.text import ORGANISATION_HINT_TEXT
+
 
 class Migration(migrations.Migration):
 
@@ -20,7 +22,7 @@ class Migration(migrations.Migration):
                 ('date', models.DateField(default=datetime.date.today)),
                 ('title', models.CharField(max_length=200)),
                 ('content', models.TextField()),
-                ('org', models.ForeignKey(verbose_name='Organisation', to='core.Organisation', help_text='If no organisations are listed, please check the <a href="/account/orglist/">organisation list</a> and contact the organisation manager or <a href="mailto:webmaster@postgresql.org">webmaster@postgresql.org</a> if none are listed.', on_delete=models.CASCADE)),
+                ('org', models.ForeignKey(verbose_name='Organisation', to='core.Organisation', help_text=ORGANISATION_HINT_TEXT, on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('-date',),
index 9e750777cf363f1a85dd12472c1a6370ccf9b881..bbfa4d9c74ce4b4803951a31f978d1c154511b04 100644 (file)
@@ -1,6 +1,7 @@
 from django.db import models
 from datetime import date
 from pgweb.core.models import Organisation, OrganisationEmail
+from pgweb.core.text import ORGANISATION_HINT_TEXT
 from pgweb.util.moderation import TristateModerateModel, ModerationState, TwoModeratorsMixin
 from django.template.defaultfilters import slugify
 
@@ -26,7 +27,7 @@ class NewsTag(models.Model):
 
 
 class NewsArticle(TwoModeratorsMixin, TristateModerateModel):
-    org = models.ForeignKey(Organisation, null=False, blank=False, verbose_name="Organisation", help_text="If no organisations are listed, please check the <a href=\"/account/orglist/\">organisation list</a> and contact the organisation manager or <a href=\"mailto:webmaster@postgresql.org\">webmaster@postgresql.org</a> if none are listed.", on_delete=models.CASCADE)
+    org = models.ForeignKey(Organisation, null=False, blank=False, verbose_name="Organisation", help_text=ORGANISATION_HINT_TEXT, on_delete=models.CASCADE)
     email = models.ForeignKey(OrganisationEmail, null=True, blank=True, verbose_name="Reply email", help_text="Pick a confirmed email associated with the organisation. This will be used as the reply address of posted news.", on_delete=models.PROTECT)
     date = models.DateField(null=False, blank=False, default=date.today, db_index=True)
     title = models.CharField(max_length=200, null=False, blank=False)
index 23f7270b7cd4099c84e5b6927f8100ccd3608928..6ec9248f2925b264b9338dd4dfcb04d038f5b112 100644 (file)
@@ -3,6 +3,8 @@ from __future__ import unicode_literals
 
 from django.db import migrations, models
 
+from pgweb.core.text import ORGANISATION_HINT_TEXT
+
 
 class Migration(migrations.Migration):
 
@@ -34,7 +36,7 @@ class Migration(migrations.Migration):
                 ('provides_support', models.BooleanField(default=False)),
                 ('provides_hosting', models.BooleanField(default=False)),
                 ('interfaces', models.CharField(max_length=512, null=True, verbose_name='Interfaces (for hosting)', blank=True)),
-                ('org', models.OneToOneField(db_column='organisation_id', to='core.Organisation', help_text='If no organisations are listed, please check the <a href="/account/orglist/">organisation list</a> and contact the organisation manager or <a href="mailto:webmaster@postgresql.org">webmaster@postgresql.org</a> if none are listed.', verbose_name='organisation', on_delete=models.CASCADE)),
+                ('org', models.OneToOneField(db_column='organisation_id', to='core.Organisation', help_text=ORGANISATION_HINT_TEXT, verbose_name='organisation', on_delete=models.CASCADE)),
             ],
             options={
                 'ordering': ('org__name',),
index 016b4d74a4e5be08978677dcfce7050881aa56d5..b68419cdfaf8da384ecd2ba915aa4e454eb68a08 100644 (file)
@@ -1,6 +1,7 @@
 from django.db import models
 
 from pgweb.core.models import Organisation
+from pgweb.core.text import ORGANISATION_HINT_TEXT
 from pgweb.util.moderation import TwostateModerateModel
 
 
@@ -8,7 +9,7 @@ class ProfessionalService(TwostateModerateModel):
     org = models.OneToOneField(Organisation, null=False, blank=False,
                                db_column="organisation_id", on_delete=models.CASCADE,
                                verbose_name="organisation",
-                               help_text="If no organisations are listed, please check the <a href=\"/account/orglist/\">organisation list</a> and contact the organisation manager or <a href=\"mailto:webmaster@postgresql.org\">webmaster@postgresql.org</a> if none are listed.")
+                               help_text=ORGANISATION_HINT_TEXT)
     description = models.TextField(null=False, blank=False)
     employees = models.CharField(max_length=32, null=True, blank=True)
     locations = models.CharField(max_length=128, null=True, blank=True)