Learning Django Web Development by 2015

Learning Django Web Development by 2015

Author:2015
Language: eng
Format: mobi, epub
Publisher: Packt Publishing


To render the updated view, class Profile() has also been updated as follows:

class Profile(LoginRequiredMixin, View): """User Profile page reachable from /user/<username> URL""" def get(self, request, username): params = dict() userProfile = User.objects.get(username=username)) userFollower = UserFollower.objects.get(user=userProfile) if userFollower.followers.filter(username=request.user.username).exists(): params["following"] = True else: params["following"] = False form = TweetForm(initial={'country': 'Global'}) search_form = SearchForm() tweets = Tweet.objects.filter(user=userProfile).order_by('-created_date') params["tweets"] = tweets params["profile"] = userProfile params["form"] = form params["search"] = search_form return render(request, 'profile.html', params)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.