Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding Instagram account to social media profile #490

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.0.8 on 2019-07-11 08:48

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('chamber_of_deputies', '0012_make_party_field_longer'),
]

operations = [
migrations.AddField(
model_name="SocialMedia",
name="instagram_profile",
field=models.CharField(blank=True, max_length=255, null=True),
),
]
1 change: 1 addition & 0 deletions jarbas/chamber_of_deputies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class SocialMedia(models.Model):
twitter_profile = models.CharField(max_length=255, blank=True, default='')
secondary_twitter_profile = models.CharField(max_length=255, blank=True, default='')
facebook_page = models.CharField(max_length=255, blank=True, default='')
instagram_profile = models.CharField(max_length=255, blank=True, default='')

@property
def twitter(self):
Expand Down
10 changes: 9 additions & 1 deletion jarbas/dashboard/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ def social_profile(self, obj):
social_media.facebook_page, fb_img
)

return mark_safe(f'{tw_link} {fb_link}')
insta_link = ''
insta_img = '/static/image/instagram-icon.png'
insta_profile = social_media.instagram_profile
if insta_profile:
insta_link = '<a href="http://instagram.com/{}"><img src="{}" width="16"></a>'.format(
insta_profile, insta_img
)

return mark_safe(f'{tw_link} {fb_link} {insta_link}')

social_profile.short_description = 'Social'

Expand Down
Binary file added jarbas/layers/static/image/Instagram-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.