diff --git a/jarbas/chamber_of_deputies/migrations/0013_add_instagram_field_social_media.py b/jarbas/chamber_of_deputies/migrations/0013_add_instagram_field_social_media.py new file mode 100644 index 000000000..8daf9f584 --- /dev/null +++ b/jarbas/chamber_of_deputies/migrations/0013_add_instagram_field_social_media.py @@ -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), + ), + ] diff --git a/jarbas/chamber_of_deputies/models.py b/jarbas/chamber_of_deputies/models.py index 3ea3d4be5..d96f51de6 100644 --- a/jarbas/chamber_of_deputies/models.py +++ b/jarbas/chamber_of_deputies/models.py @@ -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): diff --git a/jarbas/dashboard/admin/__init__.py b/jarbas/dashboard/admin/__init__.py index 0541531c9..b8b1abef4 100644 --- a/jarbas/dashboard/admin/__init__.py +++ b/jarbas/dashboard/admin/__init__.py @@ -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 = ''.format( + insta_profile, insta_img + ) + + return mark_safe(f'{tw_link} {fb_link} {insta_link}') social_profile.short_description = 'Social' diff --git a/jarbas/layers/static/image/Instagram-icon.png b/jarbas/layers/static/image/Instagram-icon.png new file mode 100644 index 000000000..61ec1aa61 Binary files /dev/null and b/jarbas/layers/static/image/Instagram-icon.png differ