def review_add(request, book_id): book = Book.objects.get(id=book_id) review = Review() review.rating = request.POST.get('rating') review.review = request.POST.get('review') review.created_at = timezone.now() review.user = User.objects.get(id=request.session['user_id']) review.book = book review.save() return redirect('/dashboard')
def add_review(request): book = Book() review = Review() book.title = request.POST.get('title') # book.author = request.POST.get('author') # book.created_at = timezone.now() book.save() print book.author review.user = User.objects.get(id=request.session['user_id']) review.book = book review.review = request.POST.get('review') review.rating = request.POST.get('rating') review.created_at = timezone.now() review.save() return redirect('/dashboard')
def add_review(request): book = Book() review = Review() book.title = request.POST.get('title') book.author = request.POST.get('author') book.created_at = timezone.now() book.save() print book.author review.user = User.objects.get(id=request.session['user_id']) review.book = book review.review = request.POST.get('review') review.rating = request.POST.get('rating') review.created_at = timezone.now() review.save() return redirect('/dashboard')