Skip to content

Dbms simple html #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.env
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for DBMSProjectMovieBookingSystem 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/3.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DBMSProjectMovieBookingSystem.settings')

application = get_asgi_application()
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
"""

Generated by 'django-admin startproject' using Django 2.2.3.

For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

import os
import django_heroku
from decouple import config

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY')

# 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',
'accounts.apps.AccountsConfig',
'main.apps.MainConfig',
]

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 = 'DBMSProjectMovieBookingSystem.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR,'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'DBMSProjectMovieBookingSystem.wsgi.application'

#Messages custom
from django.contrib.messages import constants as message_constants
MESSAGE_TAGS = {message_constants.DEBUG: 'debug',
message_constants.INFO: 'info',
message_constants.SUCCESS: 'success',
message_constants.WARNING: 'warning',
message_constants.ERROR: 'danger',
}

# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': config('DB_NAME'),
'USER': config('DB_USER'),
'PASSWORD': config('DB_PASSWORD'),
'HOST': config('DB_HOST'),
'PORT': config('DB_PORT'),
}
}


# Password validation
# https://docs.djangoproject.com/en/2.2/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/2.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]

#for MEDIA
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

django_heroku.settings(locals())
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
""""
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
path('admin/', admin.site.urls),
path('',include('main.urls')),
path('accounts/',include('accounts.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for DBMSProjectMovieBookingSystem 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/3.2/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DBMSProjectMovieBookingSystem.settings')

application = get_wsgi_application()
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions DBMSProject/DBMSProjectMovieBookingSystem/accounts/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.contrib import admin
from . models import *
# Register your models here.
admin.site.register(Cinema),
admin.site.register(Movie),
admin.site.register(Shows),
admin.site.register(Bookings),
6 changes: 6 additions & 0 deletions DBMSProject/DBMSProjectMovieBookingSystem/accounts/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class AccountsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'accounts'
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Generated by Django 3.2.9 on 2021-12-08 14:50

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Cinema',
fields=[
('cinema', models.AutoField(primary_key=True, serialize=False)),
('role', models.CharField(default='cinema_manager', max_length=30)),
('cinema_name', models.CharField(max_length=50)),
('phoneno', models.CharField(max_length=15)),
('city', models.CharField(max_length=100)),
('address', models.CharField(max_length=100)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Movie',
fields=[
('movie', models.AutoField(primary_key=True, serialize=False)),
('movie_name', models.CharField(max_length=50)),
('movie_trailer', models.CharField(default='null', max_length=300)),
('movie_rdate', models.CharField(default='null', max_length=20)),
('movie_des', models.TextField()),
('movie_rating', models.DecimalField(decimal_places=1, max_digits=3)),
('movie_poster', models.ImageField(default='movies/poster/not.jpg', upload_to='movies/poster')),
('movie_genre', models.CharField(default='Action | Comedy | Romance', max_length=50)),
('movie_duration', models.CharField(default='2hr 45min', max_length=10)),
],
),
migrations.CreateModel(
name='Shows',
fields=[
('shows', models.AutoField(primary_key=True, serialize=False)),
('time', models.CharField(max_length=100)),
('date', models.CharField(default='', max_length=15)),
('price', models.IntegerField()),
('cinema', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cinema_show', to='accounts.cinema')),
('movie', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='movie_show', to='accounts.movie')),
],
),
migrations.CreateModel(
name='Bookings',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('useat', models.CharField(max_length=100)),
('total_seats', models.IntegerField()),
('shows', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accounts.shows')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
Binary file not shown.
Binary file not shown.
53 changes: 53 additions & 0 deletions DBMSProject/DBMSProjectMovieBookingSystem/accounts/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from django.db import models
from django.contrib.auth.models import User


# Create your models here

class Cinema(models.Model):
cinema=models.AutoField(primary_key=True)
role=models.CharField(max_length=30,default='cinema_manager')
cinema_name=models.CharField(max_length=50)
phoneno=models.CharField(max_length=15)
city=models.CharField(max_length=100)
address=models.CharField(max_length=100)
user = models.OneToOneField(User,on_delete=models.CASCADE)

def __str__(self):
return self.cinema_name

class Movie(models.Model):
movie=models.AutoField(primary_key=True)
movie_name=models.CharField(max_length=50)
movie_trailer=models.CharField(max_length=300, default="null")
movie_rdate=models.CharField(max_length=20, default="null")
movie_des=models.TextField()
movie_rating=models.DecimalField(max_digits=3, decimal_places=1)
movie_poster=models.ImageField(upload_to='movies/poster', default="movies/poster/not.jpg")
movie_genre=models.CharField(max_length=50,default="Action | Comedy | Romance")
movie_duration=models.CharField(max_length=10, default="2hr 45min")

def __str__(self):
return self.movie_name

class Shows(models.Model):
shows=models.AutoField(primary_key=True)
cinema=models.ForeignKey('Cinema',on_delete=models.CASCADE, related_name='cinema_show')
movie=models.ForeignKey('Movie',on_delete=models.CASCADE, related_name='movie_show')
time=models.CharField(max_length=100)
date=models.CharField(max_length=15, default="")
price=models.IntegerField()

def __str__(self):
return self.cinema.cinema_name +" | "+ self.movie.movie_name +" | "+ self.time

class Bookings(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
shows = models.ForeignKey(Shows, on_delete=models.CASCADE)
useat = models.CharField(max_length=100)
total_seats = models.IntegerField()
@property

def __str__(self):
return self.user.username +" | "+ self.shows.movie.movie_name +" | "+ self.useat

3 changes: 3 additions & 0 deletions DBMSProject/DBMSProjectMovieBookingSystem/accounts/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
16 changes: 16 additions & 0 deletions DBMSProject/DBMSProjectMovieBookingSystem/accounts/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.contrib import admin
from django.urls import path,include
from . import views
from django.conf import settings
from django.conf.urls.static import static

urlpatterns=[
path('login',views.login,name='login'),
path('logout',views.logout,name='logout'),
path('register',views.register,name='register'),
path('register_cinema',views.register_cinema, name='register_cinema'),
path('bookings',views.bookings, name='bookings'),
path('profile',views.profile, name='profile'),
path('dashboard',views.dashboard, name='dashboard'),
path('add_shows',views.add_shows, name='add_shows'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Loading