This commit is contained in:
Oleksii S. Malakhov 2020-09-06 18:37:32 +03:00 committed by GitHub
commit 3064bdcc20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -10,6 +10,6 @@ class TwitterProfile(models.Model):
oauth_secret in relation to a user. Adapt this if you have a current oauth_secret in relation to a user. Adapt this if you have a current
setup, there's really nothing special going on here. setup, there's really nothing special going on here.
""" """
user = models.OneToOneField(User) user = models.OneToOneField(User, on_delete=models.CASCADE)
oauth_token = models.CharField(max_length=200) oauth_token = models.CharField(max_length=200)
oauth_secret = models.CharField(max_length=200) oauth_secret = models.CharField(max_length=200)

View file

@ -1,9 +1,9 @@
from django.contrib.auth import authenticate, login, logout as django_logout from django.contrib.auth import authenticate, login, logout as django_logout
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response from django.shortcuts import render
from django.conf import settings from django.conf import settings
from django.core.urlresolvers import reverse from django.urls import reverse
from twython import Twython from twython import Twython
@ -90,4 +90,4 @@ def user_timeline(request):
twitter = Twython(settings.TWITTER_KEY, settings.TWITTER_SECRET, twitter = Twython(settings.TWITTER_KEY, settings.TWITTER_SECRET,
user.oauth_token, user.oauth_secret) user.oauth_token, user.oauth_secret)
user_tweets = twitter.get_home_timeline() user_tweets = twitter.get_home_timeline()
return render_to_response('tweets.html', {'tweets': user_tweets}) return render(None, 'tweets.html', {'tweets': user_tweets})