-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addition of separate page for twitter feed
- Loading branch information
Showing
4 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from django.http import HttpResponse | ||
import requests | ||
import json | ||
|
||
from .gitorg import get_logo | ||
|
||
|
||
def index(request): | ||
s = [] | ||
|
||
org_name = open('org_name.txt', 'r').read() | ||
s.append('<link rel="shortcut icon" type="image/png" ' | ||
'href="../static/favicon.png"/>') | ||
|
||
api_data_dump = json.loads( | ||
requests.get('https://gci-leaders.netlify.com/data.json').content) | ||
for item in api_data_dump: | ||
if item['name'] == org_name: | ||
org_twitter_handle = item['twitter_url'].split( | ||
'twitter.com/')[-1] | ||
if org_twitter_handle is not None: | ||
s.append('<a class="twitter-timeline" data-height="1000" ' | ||
'data-link-color="#2B7BB9" ' | ||
'href="https://twitter.com/{twitter_handle}">' | ||
'Tweets by {twitter_handle}</a> <script async ' | ||
'src="https://platform.twitter.com/widgets.js" ' | ||
'charset="utf-8"></script>'.format( | ||
twitter_handle=org_twitter_handle)) | ||
|
||
return HttpResponse('\n'.join(s)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters