Skip to content

Commit

Permalink
Methods to extract facebook and instagram username
Browse files Browse the repository at this point in the history
  • Loading branch information
VirginiaDooley committed Feb 12, 2021
1 parent 9e7d943 commit 07aa2d5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
16 changes: 16 additions & 0 deletions wcivf/apps/people/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,22 @@ def get_max_facebook_ad_spend(self):
)
)

@property
def facebook_personal_username(self):
facebook_personal_url = self.facebook_personal_url
facebook_split = list(filter(None, facebook_personal_url.split("/")))
facebook_personal_username = facebook_split[-1]

return facebook_personal_username

@property
def instagram_username(self):
instagram_url = self.instagram_url
instagram_split = list(filter(None, instagram_url.split("/")))
instagram_username = instagram_split[-1]

return instagram_username

@cached_property
def current_or_future_candidacies(self):
"""
Expand Down
27 changes: 12 additions & 15 deletions wcivf/apps/people/templates/people/person_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,19 @@ <h3>Associated companies</h3>

<div>
{% if object.facebook_page_url or object.facebook_personal_url %}
<dt>Facebook</dt>
<dd>
{% if object.facebook_personal_url %}
{% if object.facebook_page_url and object.facebook_personal_url %}Personal profile: {% endif %}<a
href="{{ object.facebook_personal_url }}" title="{{ object.name }}'s Facebook page">
{{ object. }}
</a><br />
{% endif %}
{% if object.facebook_page_url %}
{% if object.facebook_page_url and object.facebook_personal_url %}Public page: {% endif %}<a
href="{{ object.facebook_page_url }}" title="{{ object.name }}'s Facebook profile">
<dt>Facebook</dt>
<dd>
{% if object.facebook_personal_url %}
<a href="{{ object.facebook_personal_url }}" title="{{ object.name }}'s Facebook page">
{{ object.facebook_personal_username }}
</a><br />
{% endif %}
{% if object.facebook_page_url %}
<a href="{{ object.facebook_page_url }}" title="{{ object.name }}'s Facebook profile">
{{ object.facebook_page_url }}
</a>
</a>
{% endif %}
{% endif %
</dd>
</dd>
{% endif %}
</div>
<div>
Expand All @@ -218,7 +215,7 @@ <h3>Associated companies</h3>
<dt>Instagram</dt>
<dd>
<a href="{{ object.instagram_url }}" title="{{ object.name }}'s instagram">
{{ object.instagram_url }}
{{ object.instagram_username }}
</a>
</dd>
{% endif %}
Expand Down

0 comments on commit 07aa2d5

Please sign in to comment.