diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..e69de29b diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..6dc24a35 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +backend/venv/ + +**/__pycache__/ +*.pyc +.env \ No newline at end of file diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 00000000..674aeef6 --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1,8 @@ +venv/ +env/ +.venv/ + +__pycache__/ +*.pyc + + diff --git a/backend/bookings/__init__.py b/backend/bookings/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/bookings/admin.py b/backend/bookings/admin.py new file mode 100644 index 00000000..f1e5e419 --- /dev/null +++ b/backend/bookings/admin.py @@ -0,0 +1,4 @@ +from django.contrib import admin +from bookings.models import Booking + +admin.site.register(Booking) diff --git a/backend/bookings/apps.py b/backend/bookings/apps.py new file mode 100644 index 00000000..63907ab3 --- /dev/null +++ b/backend/bookings/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class BookingsConfig(AppConfig): + name = 'bookings' diff --git a/backend/bookings/migrations/0001_initial.py b/backend/bookings/migrations/0001_initial.py new file mode 100644 index 00000000..ff7e7110 --- /dev/null +++ b/backend/bookings/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 6.0.5 on 2026-05-30 09:05 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('venues', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Booking', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('booking_date', models.DateField()), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('venue', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='venues.venue')), + ], + ), + ] diff --git a/backend/bookings/migrations/__init__.py b/backend/bookings/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/bookings/models.py b/backend/bookings/models.py new file mode 100644 index 00000000..7ae905c0 --- /dev/null +++ b/backend/bookings/models.py @@ -0,0 +1,13 @@ +from django.db import models +from django.contrib.auth.models import User +from venues.models import Venue + + +class Booking(models.Model): + user = models.ForeignKey(User, on_delete=models.CASCADE) + venue = models.ForeignKey(Venue, on_delete=models.CASCADE) + booking_date = models.DateField() + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"{self.user.username} - {self.venue.name}" \ No newline at end of file diff --git a/backend/bookings/tests.py b/backend/bookings/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/backend/bookings/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/backend/bookings/views.py b/backend/bookings/views.py new file mode 100644 index 00000000..91ea44a2 --- /dev/null +++ b/backend/bookings/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/backend/bookmyvenue/__init__.py b/backend/bookmyvenue/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/bookmyvenue/asgi.py b/backend/bookmyvenue/asgi.py new file mode 100644 index 00000000..4e122052 --- /dev/null +++ b/backend/bookmyvenue/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for bookmyvenue project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/6.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bookmyvenue.settings') + +application = get_asgi_application() diff --git a/backend/bookmyvenue/settings.py b/backend/bookmyvenue/settings.py new file mode 100644 index 00000000..3d14458d --- /dev/null +++ b/backend/bookmyvenue/settings.py @@ -0,0 +1,116 @@ + + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-pp#bcu6kn88bq@v95klpb2mx9recrayeue=iao+)c-gy1qv%cf' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'venues', + 'bookings', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'bookmyvenue.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'bookmyvenue.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/6.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'bookmyvenue', + 'USER': 'postgres', + 'PASSWORD': '9292', + 'HOST': 'localhost', + + } +} + + +# Password validation +# https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/6.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/6.0/howto/static-files/ + +STATIC_URL = 'static/' + +MEDIA_URL = "/media/" +MEDIA_ROOT = BASE_DIR / "media" diff --git a/backend/bookmyvenue/urls.py b/backend/bookmyvenue/urls.py new file mode 100644 index 00000000..1eff36de --- /dev/null +++ b/backend/bookmyvenue/urls.py @@ -0,0 +1,12 @@ +from django.conf import settings +from django.conf.urls.static import static +from django.contrib import admin +from django.urls import path + + +urlpatterns = [ + path('admin/', admin.site.urls), +] + +if settings.DEBUG: + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file diff --git a/backend/bookmyvenue/wsgi.py b/backend/bookmyvenue/wsgi.py new file mode 100644 index 00000000..10580939 --- /dev/null +++ b/backend/bookmyvenue/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for bookmyvenue project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/6.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bookmyvenue.settings') + +application = get_wsgi_application() diff --git a/backend/manage.py b/backend/manage.py new file mode 100644 index 00000000..012c9f67 --- /dev/null +++ b/backend/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bookmyvenue.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/backend/requirements.txt b/backend/requirements.txt new file mode 100644 index 00000000..fb5c9870 Binary files /dev/null and b/backend/requirements.txt differ diff --git a/backend/venues/__init__.py b/backend/venues/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/venues/admin.py b/backend/venues/admin.py new file mode 100644 index 00000000..c4c941fd --- /dev/null +++ b/backend/venues/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin +from venues.models import Venue + +admin.site.register(Venue) + diff --git a/backend/venues/apps.py b/backend/venues/apps.py new file mode 100644 index 00000000..9d33cfd1 --- /dev/null +++ b/backend/venues/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class VenuesConfig(AppConfig): + name = 'venues' diff --git a/backend/venues/migrations/0001_initial.py b/backend/venues/migrations/0001_initial.py new file mode 100644 index 00000000..96c1c035 --- /dev/null +++ b/backend/venues/migrations/0001_initial.py @@ -0,0 +1,29 @@ +# Generated by Django 6.0.5 on 2026-05-30 09:05 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Venue', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ('location', models.CharField(max_length=200)), + ('description', models.TextField(blank=True)), + ('capacity', models.PositiveIntegerField(default=1)), + ('price_per_hour', models.DecimalField(decimal_places=2, max_digits=10)), + ('image', models.ImageField(blank=True, null=True, upload_to='venues/')), + ('is_available', models.BooleanField(default=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ], + ), + ] diff --git a/backend/venues/migrations/__init__.py b/backend/venues/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/venues/models.py b/backend/venues/models.py new file mode 100644 index 00000000..92b2963e --- /dev/null +++ b/backend/venues/models.py @@ -0,0 +1,16 @@ +from django.db import models + + +class Venue(models.Model): + name = models.CharField(max_length=100) + location = models.CharField(max_length=200) + description = models.TextField(blank=True) + capacity = models.PositiveIntegerField(default=1) + price_per_hour = models.DecimalField(max_digits=10, decimal_places=2) + image = models.ImageField(upload_to="venues/", blank=True, null=True) + is_available = models.BooleanField(default=True) + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + + def __str__(self): + return self.name diff --git a/backend/venues/tests.py b/backend/venues/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/backend/venues/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/backend/venues/views.py b/backend/venues/views.py new file mode 100644 index 00000000..91ea44a2 --- /dev/null +++ b/backend/venues/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.