Skip to content

Commit

Permalink
Merge pull request #21 from Qwizi/feature
Browse files Browse the repository at this point in the history
fix: create offer now need login
  • Loading branch information
Qwizi authored Jun 11, 2024
2 parents e7ebb75 + 5d46881 commit 2b96d8d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
DEBUG=True
SECRET_KEY=django-insecure
CSRF_TRUSTED_ORIGINS=http://localhost
DB_ENGINE=django.db.backends.postgresql
DB_HOST=db
DB_PORT=5432
POSTGRES_DB=dealhub_db
POSTGRES_USER=dealhub_user
POSTGRES_PASSWORD=dealhub_password
PEXELS_API_KEY=api_key
PEXELS_API_KEY=api_key
15 changes: 12 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Publish Backend Docker image

on:
release:
types: [published]
release:
types: [ published ]


jobs:
Expand Down Expand Up @@ -39,4 +39,13 @@ jobs:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: '${{ github.repository }} successfully built and pushed Docker image.'
args: '${{ github.repository }} successfully built and pushed Docker image.'
- name: Send deploy Webhook
run: |
curl --request GET --url '${{secrets.COOLIFY_WEBHOOK}}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_API_KEY }}'
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: '${{ github.repository }} successfully send deploy webhook.'
4 changes: 4 additions & 0 deletions src/dealhub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.environ.get("DEBUG", "True") == "True"

CSRF_TRUSTED_ORIGINS = os.environ.get(
"CSRF_TRUSTED_ORIGINS", "http://localhost:8000"
).split(",")

ALLOWED_HOSTS = ["*"]

# Application definition
Expand Down
3 changes: 2 additions & 1 deletion src/offers/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import render
from django.urls import reverse_lazy
from django.views.generic import ListView, CreateView
Expand Down Expand Up @@ -31,7 +32,7 @@ def get_context_data(self, **kwargs):
return context


class CreateOfferView(CreateView):
class CreateOfferView(LoginRequiredMixin, CreateView):
model = Offer
form_class = CreateOfferForm
template_name = "offers/create_offer.html"
Expand Down

0 comments on commit 2b96d8d

Please sign in to comment.