Skip to content

Commit

Permalink
Add mastodon username to contact card
Browse files Browse the repository at this point in the history
  • Loading branch information
VirginiaDooley committed Jul 6, 2023
1 parent eb85fc1 commit 5627662
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions wcivf/apps/people/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

VALUE_TYPES_TO_IMPORT = [
"twitter_username",
"mastodon_username",
"facebook_page_url",
"facebook_personal_url",
"linkedin_url",
Expand All @@ -17,6 +18,7 @@
"wikipedia_url",
"theyworkforyou",
"youtube_profile",
"mastodon_username",
"instagram_url",
]

Expand Down
14 changes: 14 additions & 0 deletions wcivf/apps/people/migrations/0043_add_mastodon_username.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [("people", "0042_personpost_previous_party_affiliations")]

operations = [
migrations.AddField(
model_name="person",
name="mastodon_username",
field=models.CharField(blank=True, max_length=800, null=True),
),
]
9 changes: 9 additions & 0 deletions wcivf/apps/people/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class Person(models.Model):
instagram_url = models.CharField(blank=True, null=True, max_length=800)
instagram_id = models.CharField(blank=True, null=True, max_length=800)
youtube_profile = models.CharField(blank=True, null=True, max_length=800)
mastodon_username = models.CharField(blank=True, null=True, max_length=800)

# Bios
wikipedia_url = models.CharField(blank=True, null=True, max_length=800)
Expand Down Expand Up @@ -267,6 +268,14 @@ def youtube_username(self):
youtube_username = youtube_split[-1]
return youtube_username

@property
def mastodon_profile(self):
mastodon_url = self.mastodon_profile
mastodon_split = list(filter(None, mastodon_url.split("/")))
mastodon_username = mastodon_split[-1]

return mastodon_username

@property
def long_statement(self):
return self.statement_count > 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ <h2 class="ds-candidate-name ds-h3">
</dd>
</div>
{% endif %}
{% if object.mastodon_username %}
<div>
<dt>{% trans "Mastodon" %}</dt>
<dd>
<a href="{{ object.mastodon_username}}" title="{% blocktrans trimmed with person_name=object.name%}{{ person_name }}'s Twitter profile{% endblocktrans%}">
{{ object.mastodon_username}}
</a>
</dd>
</div>
{% endif %}


{% if object.linkedin_url %}
<div>
Expand Down

0 comments on commit 5627662

Please sign in to comment.