def post(self, request): if request.user.is_authenticated: content = request.POST.get('content') hashtag = request.POST.get('hashtag').upper().replace(" ", "") feeling = request.POST.get('feeling') tag_friends = request.POST.get('tag_friends') public = request.POST.get('public') photo = '' try: photo = request.FILES['photo'] except: pass new_post = Post() new_post.content = content new_post.photo = photo new_post.hashtag = hashtag new_post.feeling = feeling new_post.tag_friends = tag_friends new_post.public = public new_post.user = request.user new_post.save() return redirect('post:ShowPost', new_post.post)