Skip to content

Commit

Permalink
Merge pull request #61 from rpl-auto-a/Iqbal
Browse files Browse the repository at this point in the history
add: csrf
  • Loading branch information
iqbaldwitama authored Dec 4, 2023
2 parents 770ee1f + e9069a7 commit 967164b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion RentAcross/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['*']

CSRF_TRUSTED_ORIGINS = ['http://35.223.49.63/']

# Application definition

Expand Down
7 changes: 6 additions & 1 deletion reviewrating/templates/reviews.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@

{% block content %}
<div class="flex justify-center items-center min-h-screen py-10">

<div class="md:w-3/5 w-3/4 px-10 flex flex-col gap-2 p-5 bg-white text-white rounded-2xl shadow-lg">
<h1 class="py-5 text-2xl text-black font-bold">Reviews</h1>

{% include 'user_reviews.html' %}

{% if messages %}
{% for message in messages %}
<p class="text-black">{{message}}</p>
{% endfor %}
{% endif %}
<!-- Item Container -->
<div class="flex flex-col gap-3 mt-5">
{% if reviews %}
Expand Down
3 changes: 2 additions & 1 deletion reviewrating/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ def add_review(request, id):
review.user = request.user
review.post = PostProperti.objects.get(pk=id)
review.save()
messages.success(request, 'Your review has been successfully added!')
return HttpResponseRedirect(reverse('review:show_reviews', kwargs={"id": id}))

context = {'form': form}
return render(request, "add_review.html", context)

Expand Down

0 comments on commit 967164b

Please sign in to comment.