From c146aa9fe156829b92c58bd5168e65480a96a17b Mon Sep 17 00:00:00 2001 From: Neil Muller Date: Sat, 7 Oct 2023 18:37:01 +0200 Subject: [PATCH 01/24] Add initial setting list --- wafer/settings.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/wafer/settings.py b/wafer/settings.py index c0b5437f..bb33a890 100644 --- a/wafer/settings.py +++ b/wafer/settings.py @@ -341,3 +341,20 @@ # Specify DEFAULT_AUTO_FIELD to make Django >= 3.2 happy DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' + +# List of social media sites that can be added to the user profile +# We assume people will enter approriate urls +# FIXME: Validation would be nice +SOCIAL_MEDIA_ENTRIES = [ + 'twitter', + 'massadon', + 'other', +] + +# List of code hosting sites that can be added to the user profile +# See above +CODE_HOSTING_ENTRIES = [ + 'github', + 'gitlab', + 'bitbucket', +] From 0bf7ee6d01e9a746812f5bd692815b7be6087cd2 Mon Sep 17 00:00:00 2001 From: Neil Muller Date: Sat, 7 Oct 2023 18:42:06 +0200 Subject: [PATCH 02/24] Strip out old social media bits --- .../templates/wafer.schedule/penta_schedule.xml | 6 ------ wafer/schedule/views.py | 2 -- wafer/users/forms.py | 4 ---- wafer/users/models.py | 11 ----------- wafer/users/templates/wafer.users/profile.html | 12 ------------ .../wafer.users/snippets/profile_20-bio.html | 14 -------------- 6 files changed, 49 deletions(-) diff --git a/wafer/schedule/templates/wafer.schedule/penta_schedule.xml b/wafer/schedule/templates/wafer.schedule/penta_schedule.xml index 5677d04f..669fde44 100644 --- a/wafer/schedule/templates/wafer.schedule/penta_schedule.xml +++ b/wafer/schedule/templates/wafer.schedule/penta_schedule.xml @@ -64,9 +64,6 @@ {% if user.is_staff %} {# We will want finer grained control off this eventually, but staff will do for now #} {{ author.userprofile.display_name }} {% else %} {{ author.userprofile.display_name }} @@ -100,9 +97,6 @@ {% if user.is_staff %} {# We will want finer grained control off this eventually, but staff will do for now #} {{ person.userprofile.display_name }} {% else %} {{ person.userprofile.display_name }} diff --git a/wafer/schedule/views.py b/wafer/schedule/views.py index 7312873c..5fc1e639 100644 --- a/wafer/schedule/views.py +++ b/wafer/schedule/views.py @@ -522,8 +522,6 @@ def get(self, request): 'name': person.userprofile.display_name(), 'email': person.email } - if person.userprofile.twitter_handle: - person_data['twitter'] = person.userprofile.twitter_handle sched_event['authors'].append(person_data) sched_event['license'] = settings.WAFER_VIDEO_LICENSE sched_event['license_url'] = settings.WAFER_VIDEO_LICENSE_URL diff --git a/wafer/users/forms.py b/wafer/users/forms.py index aa4797e4..df585f94 100644 --- a/wafer/users/forms.py +++ b/wafer/users/forms.py @@ -42,10 +42,6 @@ def __init__(self, *args, **kwargs): username = kwargs['instance'].user.username self.helper.form_action = reverse('wafer_user_edit_profile', args=(username,)) - self.helper['twitter_handle'].wrap(PrependedText, - '@', placeholder=_('handle')) - self.helper['github_username'].wrap(PrependedText, - '@', placeholder=_('username')) self.helper.add_input(Submit('submit', _('Save'))) class Meta: diff --git a/wafer/users/models.py b/wafer/users/models.py index 41e885db..293fbde6 100644 --- a/wafer/users/models.py +++ b/wafer/users/models.py @@ -24,12 +24,6 @@ PROVISIONAL, CANCELLED) -# validate format of twitter handle -# Max 15 characters, alphanumeric and _ only -# Specification taken from https://support.twitter.com/articles/101299 -TwitterValidator = RegexValidator('^[A-Za-z0-9_]{1,15}$', - 'Incorrectly formatted twitter handle') - class UserProfile(models.Model): @@ -44,11 +38,6 @@ class Meta: bio = models.TextField(_('bio'), null=True, blank=True) homepage = models.CharField(_('homepage'), max_length=256, null=True, blank=True) - # We should probably do social auth instead - # And care about other code hosting sites... - twitter_handle = models.CharField(_('Twitter handle'), max_length=15, null=True, blank=True, - validators=[TwitterValidator]) - github_username = models.CharField(_('GitHub username'), max_length=32, null=True, blank=True) def __str__(self): return u'%s' % self.user diff --git a/wafer/users/templates/wafer.users/profile.html b/wafer/users/templates/wafer.users/profile.html index 035b8d13..d9764ba9 100644 --- a/wafer/users/templates/wafer.users/profile.html +++ b/wafer/users/templates/wafer.users/profile.html @@ -12,18 +12,6 @@ {% endblock content %} {% block extra_foot %}