Skip to content

Commit

Permalink
added pre commit and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Omarmoatz committed Sep 19, 2024
1 parent 7f0cb2f commit 31080bd
Show file tree
Hide file tree
Showing 66 changed files with 3,346 additions and 3,005 deletions.
4 changes: 2 additions & 2 deletions .envs/.local/.postgres
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=hotel_hub
POSTGRES_USER=debug
POSTGRES_PASSWORD=debug
POSTGRES_USER=debug
POSTGRES_PASSWORD=debug
186 changes: 93 additions & 93 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ __pycache__
db.sqlite3
media

# Backup files #
*.bak
# Backup files #
*.bak

# If you are using PyCharm #
# If you are using PyCharm #
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
Expand Down Expand Up @@ -45,94 +45,94 @@ out/
# JIRA plugin
atlassian-ide-plugin.xml

# Python #
*.py[cod]
*$py.class

# Distribution / packaging
.Python build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
# Python #
*.py[cod]
*$py.class

# Distribution / packaging
.Python build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.whl
*.egg-info/
.installed.cfg
*.egg
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
.pytest_cache/
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery
celerybeat-schedule.*

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mkdocs documentation
/site

# mypy
.mypy_cache/

# Sublime Text #
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project

# sftp configuration file
sftp-config.json

# Package control specific files Package
Control.last-run
Control.ca-list
Control.ca-bundle
Control.system-ca-bundle
GitHub.sublime-settings

# Visual Studio Code #
.vscode/*
.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history
*.egg-info/
.installed.cfg
*.egg
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
.pytest_cache/
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery
celerybeat-schedule.*

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mkdocs documentation
/site

# mypy
.mypy_cache/

# Sublime Text #
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project

# sftp configuration file
sftp-config.json

# Package control specific files Package
Control.last-run
Control.ca-list
Control.ca-bundle
Control.system-ca-bundle
GitHub.sublime-settings

# Visual Studio Code #
.vscode/*
.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history
49 changes: 49 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
exclude: '^docs/|/migrations/|devcontainer.json'
default_stages: [commit]

default_language_version:
python: python3.12

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: detect-private-key

- repo: https://github.com/adamchainz/django-upgrade
rev: '1.21.0'
hooks:
- id: django-upgrade
args: ['--target-version', '5.0']

# Run the Ruff linter.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.4
hooks:
# Linter
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
# Formatter
- id: ruff-format

- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.35.2
hooks:
- id: djlint-reformat-django
- id: djlint-django

# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
ci:
autoupdate_schedule: weekly
skip: []
submodules: false
20 changes: 20 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: '3.12'

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Python requirements required to build your docs
python:
install:
- requirements: requirements/local.txt
9 changes: 6 additions & 3 deletions apps/booking/admin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from django.contrib import admin

from apps.booking.models import Booking,Coupon
from apps.booking.models import Booking
from apps.booking.models import Coupon


@admin.register(Booking)
class HotelAdmin(admin.ModelAdmin):
list_display = ('user', 'hotel', 'full_name')
search_fields = ('hotel', 'user')
list_display = ("user", "hotel", "full_name")
search_fields = ("hotel", "user")


admin.site.register(Coupon)
4 changes: 2 additions & 2 deletions apps/booking/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class BookingConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.booking'
default_auto_field = "django.db.models.BigAutoField"
name = "apps.booking"
13 changes: 9 additions & 4 deletions apps/booking/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

from apps.booking.models import Booking


class BokingForm(forms.ModelForm):
class Meta:
model = Booking
fields = ('full_name', 'email',
'check_in_date', 'check_out_date',
'num_adults', 'num_children' )
fields = (
"full_name",
"email",
"check_in_date",
"check_out_date",
"num_adults",
"num_children",
)
# widgets = {
# 'user': forms.Select(attrs={'class': 'form-control'}),
# 'event': forms.Select(attrs={'class': 'form-control'}),
Expand All @@ -18,4 +24,3 @@ class Meta:
# # 'invoice_id': forms.TextInput(attrs={'class': 'form-control'}),
# 'payment_url': forms.URLInput(attrs={'class': 'form-control'}),
# }

Loading

0 comments on commit 31080bd

Please sign in to comment.