├── ER_1.pdf ├── Project_1 ├── Project_1 │ ├── __init__.py │ ├── __init__.pyc │ ├── settings.py │ ├── settings.pyc │ ├── urls.py │ ├── urls.pyc │ ├── wsgi.py │ └── wsgi.pyc ├── manage.py ├── railway │ ├── __init__.py │ ├── __init__.pyc │ ├── admin.py │ ├── admin.pyc │ ├── apps.py │ ├── migrations │ │ ├── __init__.py │ │ └── __init__.pyc │ ├── models.py │ ├── models.pyc │ ├── tests.py │ ├── views.py │ └── views.pyc ├── static │ ├── css │ │ ├── findtrains.css │ │ ├── form_login.css │ │ ├── home.css │ │ ├── login_success.css │ │ ├── ticket.css │ │ └── traininfo.css │ └── images │ │ └── train.jpg └── templates │ ├── findtrains.html │ ├── form_login.html │ ├── form_signup.html │ ├── home.html │ ├── login_success.html │ ├── ticket.html │ └── traininfo.html ├── RT_1.pdf ├── Requirements.pdf ├── commands.sql ├── readme.Rmd ├── readme.html └── readme.pdf /ER_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/ER_1.pdf -------------------------------------------------------------------------------- /Project_1/Project_1/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/Project_1/__init__.py -------------------------------------------------------------------------------- /Project_1/Project_1/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/Project_1/__init__.pyc -------------------------------------------------------------------------------- /Project_1/Project_1/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for Project_1 project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.10.2. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.10/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.10/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '*(v*w-!b!iu_t(sv9a&zrgi7m4f2%drs&y9*jla1$d65clg+d-' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'railway', 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'Project_1.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR,"templates")], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'Project_1.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/1.10/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.mysql', 80 | 'NAME': 'railway_management', 81 | 'USER': 'root', 82 | 'PASSWORD': 'rankhacker', 83 | 'HOST': 'localhost', 84 | 'PORT': '8080', 85 | } 86 | } 87 | 88 | 89 | # Password validation 90 | # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators 91 | 92 | AUTH_PASSWORD_VALIDATORS = [ 93 | { 94 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 95 | }, 96 | { 97 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 98 | }, 99 | { 100 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 101 | }, 102 | { 103 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 104 | }, 105 | ] 106 | 107 | 108 | # Internationalization 109 | # https://docs.djangoproject.com/en/1.10/topics/i18n/ 110 | 111 | LANGUAGE_CODE = 'en-us' 112 | 113 | TIME_ZONE = 'UTC' 114 | 115 | USE_I18N = True 116 | 117 | USE_L10N = True 118 | 119 | USE_TZ = True 120 | 121 | 122 | # Static files (CSS, JavaScript, Images) 123 | # https://docs.djangoproject.com/en/1.10/howto/static-files/ 124 | 125 | STATIC_URL = '/static/' 126 | 127 | STATICFILES_DIRS = [ 128 | os.path.join(BASE_DIR, "static") 129 | ] 130 | -------------------------------------------------------------------------------- /Project_1/Project_1/settings.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/Project_1/settings.pyc -------------------------------------------------------------------------------- /Project_1/Project_1/urls.py: -------------------------------------------------------------------------------- 1 | """Project_1 URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.10/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url 17 | from django.contrib import admin 18 | from railway import views 19 | 20 | urlpatterns = [ 21 | url(r'^admin/', admin.site.urls), 22 | url(r'^signup/', views.signup), 23 | url(r'^login/', views.login_user), 24 | url(r'^home/', views.home), 25 | url(r'^logout/', views.logout_user), 26 | url(r'^traininfo/', views.traininfo), 27 | url(r'^findtrains/', views.findtrains), 28 | url(r'^ticket/', views.ticket), 29 | ] 30 | -------------------------------------------------------------------------------- /Project_1/Project_1/urls.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/Project_1/urls.pyc -------------------------------------------------------------------------------- /Project_1/Project_1/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Project_1 project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Project_1.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /Project_1/Project_1/wsgi.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/Project_1/wsgi.pyc -------------------------------------------------------------------------------- /Project_1/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Project_1.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError: 10 | # The above import may fail for some other reason. Ensure that the 11 | # issue is really that Django is missing to avoid masking other 12 | # exceptions on Python 2. 13 | try: 14 | import django 15 | except ImportError: 16 | raise ImportError( 17 | "Couldn't import Django. Are you sure it's installed and " 18 | "available on your PYTHONPATH environment variable? Did you " 19 | "forget to activate a virtual environment?" 20 | ) 21 | raise 22 | execute_from_command_line(sys.argv) 23 | -------------------------------------------------------------------------------- /Project_1/railway/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/railway/__init__.py -------------------------------------------------------------------------------- /Project_1/railway/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/railway/__init__.pyc -------------------------------------------------------------------------------- /Project_1/railway/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /Project_1/railway/admin.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/railway/admin.pyc -------------------------------------------------------------------------------- /Project_1/railway/apps.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.apps import AppConfig 4 | 5 | 6 | class RailwayConfig(AppConfig): 7 | name = 'railway' 8 | -------------------------------------------------------------------------------- /Project_1/railway/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/railway/migrations/__init__.py -------------------------------------------------------------------------------- /Project_1/railway/migrations/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/railway/migrations/__init__.pyc -------------------------------------------------------------------------------- /Project_1/railway/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | from django.db import models 4 | 5 | # Create your models here. 6 | -------------------------------------------------------------------------------- /Project_1/railway/models.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/railway/models.pyc -------------------------------------------------------------------------------- /Project_1/railway/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Project_1/railway/views.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import authenticate, login, logout 2 | from django.contrib.auth.decorators import login_required 3 | from django.contrib.auth.models import User 4 | from django.http import HttpResponseRedirect, HttpResponse 5 | from django.shortcuts import render 6 | from django.db import connection 7 | 8 | import MySQLdb 9 | 10 | # Create your views here. 11 | 12 | def home(request): 13 | ''' 14 | render home.html 15 | ''' 16 | return HttpResponse(render(request, "home.html")) 17 | 18 | @login_required 19 | def traininfo(request): 20 | ''' 21 | This method can be called iff user is signed in 22 | Case 1: GET request 23 | render traininfo.html 24 | Case 2: POST request 25 | check for validation of inputs 26 | if valid render modified traininfo.html 27 | ''' 28 | if request.method == "POST": 29 | trainno = request.POST.get('trainno') 30 | if trainno == "" or 'e' in trainno: 31 | return HttpResponse("invalid train number") 32 | trainno = int(trainno) 33 | c = connection.cursor() 34 | c.execute('SELECT * FROM Train WHERE Train_No = %d' %(trainno)) 35 | train = c.fetchone() 36 | c.execute('SELECT * FROM Stoppage WHERE Train_No = %d' %(trainno)) 37 | stoppage = c.fetchall() 38 | 39 | c.execute('SELECT * FROM Station') 40 | scode = {} 41 | for row in c.fetchall(): 42 | scode[str(row[0])] = str(row[1]) 43 | station = {} 44 | for row in stoppage: 45 | station[str(row[1])] = scode[str(row[1])] 46 | 47 | context = {"info":train, "stop":stoppage, "station":station, "show":True} 48 | if train == None: 49 | return HttpResponse("invalid train number") 50 | else: 51 | return HttpResponse(render(request, "traininfo.html", context)) 52 | else: 53 | return HttpResponse(render(request, "traininfo.html", {"show":False,})) 54 | 55 | @login_required 56 | def findtrains(request): 57 | ''' 58 | This method can be called iff user is signed in 59 | Case 1: GET request 60 | render findtrains.html 61 | Case 2: POST request 62 | check for validation of inputs 63 | if valid render modified findtrains.html 64 | ''' 65 | if request.method == "POST": 66 | fstation = request.POST.get('fstation') 67 | sstation = request.POST.get('sstation') 68 | 69 | if len(fstation) == 0 or len(sstation) == 0: 70 | return HttpResponse("station code can't be empty") 71 | 72 | for c in fstation: 73 | if c == " ": 74 | return HttpResponse("space is not allowed") 75 | 76 | for c in sstation: 77 | if c == " ": 78 | return HttpResponse("space is not allowed") 79 | 80 | if fstation == sstation: 81 | return HttpResponse("station code must be different") 82 | 83 | c = connection.cursor() 84 | c.execute('''select a.Train_No from Stoppage as a join Stoppage as b on a.Train_No = b.Train_No 85 | where a.Station_Code = "%s" and b.Station_Code = "%s" ''' %(fstation, sstation)) 86 | 87 | trains = c.fetchall() 88 | 89 | if len(trains) == 0: 90 | return HttpResponse("invalid station code") 91 | 92 | context = {"trains":trains, "show":True} 93 | 94 | return HttpResponse(render(request, "findtrains.html", context)) 95 | 96 | else: 97 | return HttpResponse(render(request, "findtrains.html", {"show":False})) 98 | 99 | @login_required 100 | def ticket(request): 101 | ''' 102 | This method can be called iff user is signed in 103 | Case 1: GET request 104 | render ticket.html 105 | Case 2: POST request 106 | check for validation of inputs 107 | if valid render modified ticket.html 108 | ''' 109 | if request.method == "POST": 110 | tnumber = request.POST.get('tnumber') 111 | fname = request.POST.get('fname') 112 | lname = request.POST.get('lname') 113 | gender = request.POST.get('gender') 114 | age = request.POST.get('age') 115 | tclass = request.POST.get('tclass') 116 | number = request.POST.get('number') 117 | 118 | c = connection.cursor() 119 | c.execute("SELECT * FROM Train where Train_No = '%s' " %(tnumber)) 120 | 121 | train = c.fetchall() 122 | 123 | if len(train) == 0: 124 | return HttpResponse("Incorrect Train Number") 125 | 126 | train = train[0] 127 | 128 | alpha = map(chr, range(97, 123)) 129 | 130 | invalid = False 131 | 132 | if len(fname) == 0: 133 | invalid = True 134 | 135 | for c in fname: 136 | if c not in alpha: 137 | invalid = True 138 | break 139 | 140 | if invalid: 141 | return HttpResponse("invalid fname, characters allowed [a-z]") 142 | 143 | invalid = False 144 | 145 | if len(lname) == 0: 146 | invalid = True 147 | 148 | for c in lname: 149 | if c not in alpha: 150 | invalid = True 151 | break 152 | 153 | if invalid: 154 | return HttpResponse("invalid lname, characters allowed [a-z]") 155 | 156 | if age == "" or 'e' in age or int(age) > 100: 157 | return HttpResponse("invalid age") 158 | 159 | num = map(chr, range(48, 58)) 160 | invalid = False 161 | 162 | if len(number) != 10: 163 | invalid = True 164 | for c in number: 165 | if c not in num: 166 | invalid = True 167 | break 168 | 169 | if invalid: 170 | return HttpResponse("invalid phone number") 171 | 172 | gender = gender[0] 173 | if str(tclass) == "sleeper" and int(train[2]) <= 0: 174 | return HttpResponse("seat not available in sleeper class") 175 | if str(tclass) == "first class ac" and int(train[3]) <= 0: 176 | return HttpResponse("seat not available in first class ac") 177 | if str(tclass) == "second class ac" and int(train[4]) <= 0: 178 | return HttpResponse("seat not available in second class ac") 179 | if str(tclass) == "third class ac" and int(train[5]) <= 0: 180 | return HttpResponse("seat not available in third class ac") 181 | 182 | c = connection.cursor() 183 | c.execute("SELECT * FROM Ticket") 184 | maximum = 0 185 | for row in c.fetchall(): 186 | maximum = max(maximum, int(row[0])) 187 | 188 | ticketno = maximum + 1 189 | import datetime 190 | now = datetime.datetime.now() 191 | now = str(now) 192 | jdate = (now.split())[0] 193 | 194 | c.execute('''INSERT INTO Ticket VALUES("%s", "%s", "%s", "%s") 195 | ''' %(ticketno, tnumber, jdate, request.user)) 196 | 197 | c.execute('''INSERT INTO Passenger(First_name, Last_name, Gender, Phone_No, 198 | Ticket_No, Age, Class) VALUES 199 | ("%s", "%s", "%s", "%s", "%s", "%s", "%s") 200 | ''' %(fname, lname, gender, number, ticketno, age, tclass)) 201 | 202 | if str(tclass) == "sleeper": 203 | c.execute('''UPDATE Train set Seat_Sleeper = "%s" WHERE Train_No = "%s" 204 | ''' %(int(train[2])-1, tnumber)) 205 | if str(tclass) == "first class ac": 206 | c.execute('''UPDATE Train set Seat_First_Class_AC = "%s" WHERE Train_No = "%s" 207 | ''' %(int(train[3])-1, tnumber)) 208 | if str(tclass) == "second class ac": 209 | c.execute('''UPDATE Train set Seat_Second_Class_AC = "%s" WHERE Train_No = "%s" 210 | ''' %(int(train[4])-1, tnumber)) 211 | if str(tclass) == "third class ac": 212 | c.execute('''UPDATE Train set Seat_Third_Class_AC = "%s" WHERE Train_No = "%s" 213 | ''' %(int(train[5])-1, tnumber)) 214 | 215 | return HttpResponse(render(request, "ticket.html", {"show":True})) 216 | else: 217 | return HttpResponse(render(request, "ticket.html", {"show":False})) 218 | 219 | def signup(request): 220 | if request.method == "POST": 221 | username = request.POST.get('username') 222 | password = request.POST.get('password') 223 | email = request.POST.get('email') 224 | address = request.POST.get('address') 225 | fnumber = request.POST.get('fnumber') 226 | snumber = request.POST.get('snumber') 227 | 228 | alphanum = map(chr, range(97, 123)) + map(chr, range(48, 58)) 229 | num = map(chr, range(48, 58)) 230 | 231 | invalid = False 232 | 233 | if len(username) == 0: 234 | invalid = True 235 | 236 | for c in username: 237 | if c not in alphanum: 238 | invalid = True 239 | break 240 | 241 | if invalid: 242 | return HttpResponse("invalid username, characters allowed [a-z] and [0-9]") 243 | 244 | 245 | invalid = False 246 | 247 | if len(password) == 0: 248 | invalid = True 249 | 250 | for c in password: 251 | if c == " ": 252 | invalid = True 253 | break 254 | 255 | if invalid: 256 | return HttpResponse("space not allowed in the password") 257 | 258 | if len(address) == address.count(' '): 259 | return HttpResponse("invalid address") 260 | 261 | 262 | invalidf, invalids = False, False 263 | 264 | if len(fnumber) != 10: 265 | invalidf = True 266 | for c in fnumber: 267 | if c not in num: 268 | invalidf = True 269 | break 270 | 271 | if len(snumber) != 10: 272 | invalids = True 273 | for c in snumber: 274 | if c not in num: 275 | invalids = True 276 | break 277 | 278 | if invalidf and invalids: 279 | return HttpResponse("atleast one contact must be valid") 280 | 281 | try: 282 | user = User.objects.create_user(username, None, password) 283 | c = connection.cursor() 284 | c.execute('INSERT INTO Account VALUES("%s", "%s", "%s", "%s")' %(username, password, email, address)) 285 | if not invalidf: 286 | c.execute('INSERT INTO Contact VALUES("%s", "%s")' %(username, fnumber)) 287 | if not invalids: 288 | c.execute('INSERT INTO Contact VALUES("%s", "%s")' %(username, snumber)) 289 | 290 | return HttpResponse("signup successful! cheers") 291 | 292 | except Exception as e: 293 | print e 294 | finally: 295 | c.close() 296 | else: 297 | return HttpResponse(render(request, "form_signup.html")) 298 | 299 | def login_user(request): 300 | if request.method == "POST": 301 | username = request.POST.get('username') 302 | password = request.POST.get('password') 303 | 304 | user = authenticate(username = username, password = password) 305 | 306 | if user: 307 | login(request, user) 308 | return HttpResponse(render(request, "login_success.html")) 309 | 310 | else: 311 | return HttpResponse("invalid credentials") 312 | 313 | ''' 314 | try: 315 | c = connection.cursor() 316 | c.execute('SELECT * FROM Account WHERE Username = "%s" and Password = "%s"' %(username, password)) 317 | table = c.fetchall() 318 | if len(table) != 1: 319 | return HttpResponse("invalid credentials") 320 | return HttpResponse("login successful! cheers") 321 | 322 | except Exception as e: 323 | print e 324 | finally: 325 | c.close() 326 | ''' 327 | 328 | return HttpResponse(render(request, "form_login.html")) 329 | 330 | @login_required 331 | def logout_user(request): 332 | logout(request) 333 | return HttpResponseRedirect("/home/") -------------------------------------------------------------------------------- /Project_1/railway/views.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/railway/views.pyc -------------------------------------------------------------------------------- /Project_1/static/css/findtrains.css: -------------------------------------------------------------------------------- 1 | input[type=submit] 2 | { 3 | background-color: blue; /* Green */ 4 | border: none; 5 | color: white; 6 | padding: 7px 16px; 7 | text-align: center; 8 | text-decoration: none; 9 | display: inline-block; 10 | font-size: 18px; 11 | } 12 | 13 | body { 14 | background-image: url("../images/train.jpg"); 15 | background-repeat: no-repeat; 16 | background-position: right top; 17 | } 18 | 19 | button { 20 | background-color: green; /* Green */ 21 | border: none; 22 | color: white; 23 | padding: 7px 16px; 24 | text-align: center; 25 | text-decoration: none; 26 | display: inline-block; 27 | font-size: 18px; 28 | } 29 | 30 | b { 31 | color: red; 32 | } 33 | 34 | h1 { 35 | text-align: center; 36 | color: white; 37 | font-size: 5vw; 38 | } 39 | 40 | h2 { 41 | text-align: center; 42 | color: red; 43 | font-size: 3vw; 44 | } 45 | 46 | i { 47 | background-color: green; 48 | color: white; 49 | font-size: 30px; 50 | } 51 | 52 | th { 53 | background-color: blue; 54 | color: white; 55 | } 56 | 57 | td { 58 | background-color: green; 59 | color: white; 60 | } 61 | 62 | th, td { 63 | padding: 5px; 64 | text-align: left; 65 | } -------------------------------------------------------------------------------- /Project_1/static/css/form_login.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-image: url("../images/train.jpg"); 3 | background-repeat: no-repeat; 4 | background-position: right top; 5 | } 6 | 7 | h1 { 8 | text-align: center; 9 | color: white; 10 | font-size: 5vw; 11 | } 12 | 13 | form { 14 | display: block; 15 | margin-top: 0em; 16 | } 17 | 18 | input[type=submit] 19 | { 20 | background-color: blue; /* Green */ 21 | border: none; 22 | color: white; 23 | padding: 7px 16px; 24 | text-align: center; 25 | text-decoration: none; 26 | display: inline-block; 27 | font-size: 18px; 28 | } 29 | 30 | b { 31 | color: red; 32 | } -------------------------------------------------------------------------------- /Project_1/static/css/home.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-image: url("../images/train.jpg"); 3 | background-repeat: no-repeat; 4 | background-position: right top; 5 | } 6 | 7 | h1 { 8 | text-align: center; 9 | color: white; 10 | font-size: 5vw; 11 | } 12 | 13 | button { 14 | background-color: green; /* Green */ 15 | border: none; 16 | color: white; 17 | padding: 15px 32px; 18 | text-align: center; 19 | text-decoration: none; 20 | display: inline-block; 21 | font-size: 18px; 22 | } 23 | -------------------------------------------------------------------------------- /Project_1/static/css/login_success.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-image: url("../images/train.jpg"); 3 | background-repeat: no-repeat; 4 | background-position: right top; 5 | } 6 | 7 | h1 { 8 | text-align: center; 9 | color: white; 10 | font-size: 5vw; 11 | } 12 | 13 | button { 14 | background-color: green; /* Green */ 15 | border: none; 16 | color: white; 17 | padding: 1.2vw 3.4vw; 18 | text-align: center; 19 | text-decoration: none; 20 | display: inline-block; 21 | font-size: 1.4vw; 22 | } -------------------------------------------------------------------------------- /Project_1/static/css/ticket.css: -------------------------------------------------------------------------------- 1 | input[type=submit] 2 | { 3 | background-color: blue; /* Green */ 4 | border: none; 5 | color: white; 6 | padding: 7px 16px; 7 | text-align: center; 8 | text-decoration: none; 9 | display: inline-block; 10 | font-size: 18px; 11 | } 12 | 13 | body { 14 | background-image: url("../images/train.jpg"); 15 | background-repeat: no-repeat; 16 | background-position: right top; 17 | } 18 | 19 | button { 20 | background-color: green; /* Green */ 21 | border: none; 22 | color: white; 23 | padding: 7px 16px; 24 | text-align: center; 25 | text-decoration: none; 26 | display: inline-block; 27 | font-size: 18px; 28 | } 29 | 30 | b { 31 | color: red; 32 | } 33 | 34 | h1 { 35 | text-align: center; 36 | color: white; 37 | font-size: 5vw; 38 | } 39 | 40 | th { 41 | background-color: blue; 42 | color: white; 43 | } 44 | 45 | td { 46 | background-color: green; 47 | color: white; 48 | } 49 | 50 | th, td { 51 | padding: 5px; 52 | text-align: left; 53 | } -------------------------------------------------------------------------------- /Project_1/static/css/traininfo.css: -------------------------------------------------------------------------------- 1 | input[type=submit] 2 | { 3 | background-color: blue; /* Green */ 4 | border: none; 5 | color: white; 6 | padding: 7px 16px; 7 | text-align: center; 8 | text-decoration: none; 9 | display: inline-block; 10 | font-size: 18px; 11 | } 12 | 13 | body { 14 | background-image: url("../images/train.jpg"); 15 | background-repeat: no-repeat; 16 | background-position: right top; 17 | } 18 | 19 | button { 20 | background-color: green; /* Green */ 21 | border: none; 22 | color: white; 23 | padding: 7px 16px; 24 | text-align: center; 25 | text-decoration: none; 26 | display: inline-block; 27 | font-size: 18px; 28 | } 29 | 30 | b { 31 | color: red; 32 | } 33 | 34 | h1 { 35 | text-align: center; 36 | color: white; 37 | font-size: 5vw; 38 | } 39 | 40 | th { 41 | background-color: blue; 42 | color: white; 43 | } 44 | 45 | td { 46 | background-color: green; 47 | color: white; 48 | } 49 | 50 | th, td { 51 | padding: 5px; 52 | text-align: left; 53 | } -------------------------------------------------------------------------------- /Project_1/static/images/train.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Project_1/static/images/train.jpg -------------------------------------------------------------------------------- /Project_1/templates/findtrains.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | home 7 | 8 | 9 | 10 |
11 |

Find Trains

12 |
{% csrf_token %} 13 | STATION CODE 1
14 |

15 | STATION CODE 2
16 |

17 | 18 |

19 |
20 |
21 |
22 | {% if show %} 23 |

Trains Available

24 | {% for trainno in trains %} 25 | {{trainno.0}}
26 | {% endfor %}
27 |
28 | {% endif %} 29 |
30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Project_1/templates/form_login.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | home 7 | 8 | 9 | 10 |
11 |

Login

12 |
{% csrf_token %} 13 | USERNAME
14 |

15 | PASSWORD
16 |

17 | 18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /Project_1/templates/form_signup.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | home 7 | 8 | 9 | 10 |
11 |

Signup

12 |
{% csrf_token %} 13 | USERNAME
14 |

15 | PASSWORD
16 |

17 | EMAIL ID
18 |

19 | ADDRESS
20 |

21 | CONTACT
22 |

23 |

24 | 25 |
26 |
27 | 28 | -------------------------------------------------------------------------------- /Project_1/templates/home.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | home 7 | 8 | 9 | 10 |

Railway Management System

11 |
12 |
13 | 14 | 15 |
16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Project_1/templates/login_success.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | home 7 | 8 | 9 | 10 |
11 |

Hi {{user.username}}

12 | 13 | 14 | 15 | 16 |
17 | 18 | -------------------------------------------------------------------------------- /Project_1/templates/ticket.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | home 7 | 8 | 9 | 10 |
11 | 12 | {% if not show %} 13 |

Book Tickets

14 |
{% csrf_token %} 15 | TRAIN NUMBER
16 |

17 | FIRST NAME
18 |

19 | LAST NAME
20 |

21 | GENDER
22 |

26 | AGE
27 |

28 | CLASS
29 |

35 | PHONE NO
36 |

37 | 38 |

39 |
40 | {% endif %} 41 | {% if show %} 42 |

Ticket Booked


43 |

44 |

45 |

46 |

47 | {% endif %} 48 |
49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Project_1/templates/traininfo.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | home 7 | 8 | 9 | 10 |
11 |

Train Info

12 |
{% csrf_token %} 13 | TRAIN NUMBER
14 |

15 |
16 |

17 |
18 |
19 | {% if show %} 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
NumberNamesleeper seatsfirst ac seatssecond ac seatsthird ac seatswififood
{{info.0}}{{info.1}}{{info.2}}{{info.3}}{{info.4}}{{info.5}}{{info.6}}{{info.7}}

43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
SundayMondayTuesdayWednesdayThursdayFridaySaturday
{{info.8}}{{info.9}}{{info.10}}{{info.11}}{{info.12}}{{info.13}}{{info.14}}{{info.15}}

64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | {% for row in stop %} 72 | 73 | 74 | 75 | 76 | 77 | {% endfor %} 78 |
Station Codearrival timedeparture time
{{row.1}}{{row.2}}{{row.3}}

79 | 80 | 81 | 82 | 83 | 84 | {% for key, value in station.items %} 85 | 86 | 87 | 88 | 89 | {% endfor %} 90 |
Station CodeStation Name
{{key}}{{value}}

91 | {% endif %} 92 | 93 | -------------------------------------------------------------------------------- /RT_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/RT_1.pdf -------------------------------------------------------------------------------- /Requirements.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/Requirements.pdf -------------------------------------------------------------------------------- /commands.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 5.5.50, for debian-linux-gnu (x86_64) 2 | -- 3 | -- Host: localhost Database: railway_management 4 | -- ------------------------------------------------------ 5 | -- Server version 5.5.50-0ubuntu0.14.04.1 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `Account` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `Account`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!40101 SET character_set_client = utf8 */; 25 | CREATE TABLE `Account` ( 26 | `Username` varchar(15) NOT NULL, 27 | `Password` varchar(20) NOT NULL, 28 | `Email_Id` varchar(35) NOT NULL, 29 | `Address` varchar(50) DEFAULT NULL, 30 | PRIMARY KEY (`Username`) 31 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 32 | /*!40101 SET character_set_client = @saved_cs_client */; 33 | 34 | -- 35 | -- Dumping data for table `Account` 36 | -- 37 | 38 | LOCK TABLES `Account` WRITE; 39 | /*!40000 ALTER TABLE `Account` DISABLE KEYS */; 40 | INSERT INTO `Account` VALUES ('anantdadu','proxyman','dadu@cmu.ac.in','New York'),('atishay','qwerty','Atishay.jain.cse14@gnail.com','Rangmahal Mall, Panna'),('cryptomanic','eba094d4d15bc478cdc9','deepak.yadav.cse14@iitbhu.ac.in','CB-28 Ring Road Naraina New Delhi-110028'),('divyam310','goyal1002','divyam.goyal@gmail.com','Kota, Rajasthan'),('goku446','dejavu','goku@gmail.com','Kota, Rajasthan'),('prateek1996','ronaldoisgreat','prateek@gmail.com','New Delhi'),('user101','eba094d4d15bc478cdc9','atishay.jain.cse14@iitbhu.ac.in','Madhya Pradesh'); 41 | /*!40000 ALTER TABLE `Account` ENABLE KEYS */; 42 | UNLOCK TABLES; 43 | 44 | -- 45 | -- Table structure for table `Contact` 46 | -- 47 | 48 | DROP TABLE IF EXISTS `Contact`; 49 | /*!40101 SET @saved_cs_client = @@character_set_client */; 50 | /*!40101 SET character_set_client = utf8 */; 51 | CREATE TABLE `Contact` ( 52 | `Username` varchar(15) NOT NULL DEFAULT '', 53 | `Phone_No` char(10) NOT NULL DEFAULT '', 54 | PRIMARY KEY (`Username`,`Phone_No`), 55 | CONSTRAINT `Contact_ibfk_1` FOREIGN KEY (`Username`) REFERENCES `Account` (`Username`) ON DELETE CASCADE 56 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 57 | /*!40101 SET character_set_client = @saved_cs_client */; 58 | 59 | -- 60 | -- Dumping data for table `Contact` 61 | -- 62 | 63 | LOCK TABLES `Contact` WRITE; 64 | /*!40000 ALTER TABLE `Contact` DISABLE KEYS */; 65 | INSERT INTO `Contact` VALUES ('anantdadu','8899887766'),('anantdadu','9876543210'),('atishay','7071475390'),('atishay','8009224040'),('cryptomanic','7411452250'),('cryptomanic','9650367698'),('cryptomanic','9968254144'),('divyam310','8989786765'),('goku446','9232453425'),('goku446','9989786756'),('prateek1996','9898342565'),('user101','7071475390'); 66 | /*!40000 ALTER TABLE `Contact` ENABLE KEYS */; 67 | UNLOCK TABLES; 68 | 69 | -- 70 | -- Table structure for table `Passenger` 71 | -- 72 | 73 | DROP TABLE IF EXISTS `Passenger`; 74 | /*!40101 SET @saved_cs_client = @@character_set_client */; 75 | /*!40101 SET character_set_client = utf8 */; 76 | CREATE TABLE `Passenger` ( 77 | `Passenger_Id` int(11) NOT NULL AUTO_INCREMENT, 78 | `First_Name` varchar(20) NOT NULL, 79 | `Last_Name` varchar(20) NOT NULL, 80 | `Gender` char(1) NOT NULL, 81 | `Phone_No` char(10) DEFAULT NULL, 82 | `Ticket_No` int(10) NOT NULL, 83 | `Age` int(11) NOT NULL, 84 | `Class` varchar(20) NOT NULL, 85 | PRIMARY KEY (`Passenger_Id`), 86 | KEY `Ticket_No` (`Ticket_No`), 87 | CONSTRAINT `Passenger_ibfk_1` FOREIGN KEY (`Ticket_No`) REFERENCES `Ticket` (`Ticket_No`) ON DELETE CASCADE 88 | ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1; 89 | /*!40101 SET character_set_client = @saved_cs_client */; 90 | 91 | -- 92 | -- Dumping data for table `Passenger` 93 | -- 94 | 95 | LOCK TABLES `Passenger` WRITE; 96 | /*!40000 ALTER TABLE `Passenger` DISABLE KEYS */; 97 | /*!40000 ALTER TABLE `Passenger` ENABLE KEYS */; 98 | UNLOCK TABLES; 99 | 100 | -- 101 | -- Table structure for table `Station` 102 | -- 103 | 104 | DROP TABLE IF EXISTS `Station`; 105 | /*!40101 SET @saved_cs_client = @@character_set_client */; 106 | /*!40101 SET character_set_client = utf8 */; 107 | CREATE TABLE `Station` ( 108 | `Station_Code` char(5) NOT NULL DEFAULT '', 109 | `Station_Name` varchar(25) NOT NULL, 110 | PRIMARY KEY (`Station_Code`) 111 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 112 | /*!40101 SET character_set_client = @saved_cs_client */; 113 | 114 | -- 115 | -- Dumping data for table `Station` 116 | -- 117 | 118 | LOCK TABLES `Station` WRITE; 119 | /*!40000 ALTER TABLE `Station` DISABLE KEYS */; 120 | INSERT INTO `Station` VALUES ('ALD','ALLAHABAD JUNCTION'),('CNB','KANPUR CENTRAL'),('GYN','GYANPUR ROAD'),('GZB','GHAZIABAD JUNCTION'),('MUV','MANDUADIH'),('NDLS','NEW DELHI'); 121 | /*!40000 ALTER TABLE `Station` ENABLE KEYS */; 122 | UNLOCK TABLES; 123 | 124 | -- 125 | -- Table structure for table `Stoppage` 126 | -- 127 | 128 | DROP TABLE IF EXISTS `Stoppage`; 129 | /*!40101 SET @saved_cs_client = @@character_set_client */; 130 | /*!40101 SET character_set_client = utf8 */; 131 | CREATE TABLE `Stoppage` ( 132 | `Train_No` int(6) NOT NULL DEFAULT '0', 133 | `Station_Code` char(5) NOT NULL DEFAULT '', 134 | `Arrival_Time` time DEFAULT NULL, 135 | `Departure_Time` time DEFAULT NULL, 136 | PRIMARY KEY (`Train_No`,`Station_Code`), 137 | KEY `Station_Code` (`Station_Code`), 138 | CONSTRAINT `Stoppage_ibfk_1` FOREIGN KEY (`Train_No`) REFERENCES `Train` (`Train_No`) ON DELETE CASCADE ON UPDATE CASCADE, 139 | CONSTRAINT `Stoppage_ibfk_2` FOREIGN KEY (`Station_Code`) REFERENCES `Station` (`Station_Code`) ON DELETE CASCADE ON UPDATE CASCADE 140 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 141 | /*!40101 SET character_set_client = @saved_cs_client */; 142 | 143 | -- 144 | -- Dumping data for table `Stoppage` 145 | -- 146 | 147 | LOCK TABLES `Stoppage` WRITE; 148 | /*!40000 ALTER TABLE `Stoppage` DISABLE KEYS */; 149 | INSERT INTO `Stoppage` VALUES (12559,'ALD','22:05:00','22:30:00'),(12559,'CNB','01:30:00','01:38:00'),(12559,'MUV','19:20:00','19:30:00'),(12559,'NDLS','08:10:00',NULL),(12560,'ALD','03:45:00','04:10:00'),(12560,'CNB','01:00:00','01:05:00'),(12560,'MUV','07:00:00',NULL),(12560,'NDLS','18:35:00','18:55:00'),(12581,'ALD','01:20:00','01:45:00'),(12581,'CNB','04:15:00','04:20:00'),(12581,'GYN','23:31:00','23:33:00'),(12581,'GZB','11:30:00','11:32:00'),(12581,'MUV','22:20:00','22:30:00'),(12581,'NDLS','12:20:00',NULL),(12582,'ALD','07:45:00','08:15:00'),(12582,'CNB','04:55:00','05:00:00'),(12582,'GYN','09:21:00','09:23:00'),(12582,'GZB','23:03:00','23:05:00'),(12582,'MUV','11:20:00',NULL),(12582,'NDLS','22:15:00','22:25:00'); 150 | /*!40000 ALTER TABLE `Stoppage` ENABLE KEYS */; 151 | UNLOCK TABLES; 152 | 153 | -- 154 | -- Table structure for table `Ticket` 155 | -- 156 | 157 | DROP TABLE IF EXISTS `Ticket`; 158 | /*!40101 SET @saved_cs_client = @@character_set_client */; 159 | /*!40101 SET character_set_client = utf8 */; 160 | CREATE TABLE `Ticket` ( 161 | `Ticket_No` int(10) NOT NULL AUTO_INCREMENT, 162 | `Train_No` int(6) NOT NULL, 163 | `Date_of_Journey` date NOT NULL, 164 | `Username` varchar(15) NOT NULL, 165 | PRIMARY KEY (`Ticket_No`), 166 | KEY `Username` (`Username`), 167 | KEY `Train_No` (`Train_No`), 168 | CONSTRAINT `Ticket_ibfk_1` FOREIGN KEY (`Username`) REFERENCES `Account` (`Username`) ON DELETE CASCADE, 169 | CONSTRAINT `Ticket_ibfk_2` FOREIGN KEY (`Train_No`) REFERENCES `Train` (`Train_No`) ON UPDATE CASCADE 170 | ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; 171 | /*!40101 SET character_set_client = @saved_cs_client */; 172 | 173 | -- 174 | -- Dumping data for table `Ticket` 175 | -- 176 | 177 | LOCK TABLES `Ticket` WRITE; 178 | /*!40000 ALTER TABLE `Ticket` DISABLE KEYS */; 179 | /*!40000 ALTER TABLE `Ticket` ENABLE KEYS */; 180 | UNLOCK TABLES; 181 | 182 | -- 183 | -- Table structure for table `Train` 184 | -- 185 | 186 | DROP TABLE IF EXISTS `Train`; 187 | /*!40101 SET @saved_cs_client = @@character_set_client */; 188 | /*!40101 SET character_set_client = utf8 */; 189 | CREATE TABLE `Train` ( 190 | `Train_No` int(6) NOT NULL DEFAULT '0', 191 | `Name` varchar(25) NOT NULL, 192 | `Seat_Sleeper` int(4) NOT NULL, 193 | `Seat_First_Class_AC` int(4) NOT NULL, 194 | `Seat_Second_Class_AC` int(4) NOT NULL, 195 | `Seat_Third_Class_AC` int(4) NOT NULL, 196 | `Wifi` char(1) NOT NULL, 197 | `Food` char(1) NOT NULL, 198 | `Run_On_Sunday` char(1) NOT NULL, 199 | `Run_On_Monday` char(1) NOT NULL, 200 | `Run_On_Tuesday` char(1) NOT NULL, 201 | `Run_On_Wednesday` char(1) NOT NULL, 202 | `Run_On_Thursday` char(1) NOT NULL, 203 | `Run_On_Friday` char(1) NOT NULL, 204 | `Run_On_Saturday` char(1) NOT NULL, 205 | PRIMARY KEY (`Train_No`) 206 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 207 | /*!40101 SET character_set_client = @saved_cs_client */; 208 | 209 | -- 210 | -- Dumping data for table `Train` 211 | -- 212 | 213 | LOCK TABLES `Train` WRITE; 214 | /*!40000 ALTER TABLE `Train` DISABLE KEYS */; 215 | INSERT INTO `Train` VALUES (12559,'SHIV GANGA EXP',479,47,96,192,'N','Y','Y','Y','Y','Y','Y','Y','Y'),(12560,'SHIV GANGA EXP',480,43,96,192,'N','Y','Y','Y','Y','Y','Y','Y','Y'),(12581,'MUV NDLS S F EX',432,48,80,144,'N','N','Y','Y','Y','Y','Y','Y','Y'),(12582,'MUV NDLS S F EX',432,48,80,144,'N','N','Y','Y','Y','Y','Y','Y','Y'); 216 | /*!40000 ALTER TABLE `Train` ENABLE KEYS */; 217 | UNLOCK TABLES; 218 | 219 | -- 220 | -- Table structure for table `auth_group` 221 | -- 222 | 223 | DROP TABLE IF EXISTS `auth_group`; 224 | /*!40101 SET @saved_cs_client = @@character_set_client */; 225 | /*!40101 SET character_set_client = utf8 */; 226 | CREATE TABLE `auth_group` ( 227 | `id` int(11) NOT NULL AUTO_INCREMENT, 228 | `name` varchar(80) NOT NULL, 229 | PRIMARY KEY (`id`), 230 | UNIQUE KEY `name` (`name`) 231 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 232 | /*!40101 SET character_set_client = @saved_cs_client */; 233 | 234 | -- 235 | -- Dumping data for table `auth_group` 236 | -- 237 | 238 | LOCK TABLES `auth_group` WRITE; 239 | /*!40000 ALTER TABLE `auth_group` DISABLE KEYS */; 240 | /*!40000 ALTER TABLE `auth_group` ENABLE KEYS */; 241 | UNLOCK TABLES; 242 | 243 | -- 244 | -- Table structure for table `auth_group_permissions` 245 | -- 246 | 247 | DROP TABLE IF EXISTS `auth_group_permissions`; 248 | /*!40101 SET @saved_cs_client = @@character_set_client */; 249 | /*!40101 SET character_set_client = utf8 */; 250 | CREATE TABLE `auth_group_permissions` ( 251 | `id` int(11) NOT NULL AUTO_INCREMENT, 252 | `group_id` int(11) NOT NULL, 253 | `permission_id` int(11) NOT NULL, 254 | PRIMARY KEY (`id`), 255 | UNIQUE KEY `auth_group_permissions_group_id_0cd325b0_uniq` (`group_id`,`permission_id`), 256 | KEY `auth_group_permissi_permission_id_84c5c92e_fk_auth_permission_id` (`permission_id`), 257 | CONSTRAINT `auth_group_permissi_permission_id_84c5c92e_fk_auth_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), 258 | CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) 259 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 260 | /*!40101 SET character_set_client = @saved_cs_client */; 261 | 262 | -- 263 | -- Dumping data for table `auth_group_permissions` 264 | -- 265 | 266 | LOCK TABLES `auth_group_permissions` WRITE; 267 | /*!40000 ALTER TABLE `auth_group_permissions` DISABLE KEYS */; 268 | /*!40000 ALTER TABLE `auth_group_permissions` ENABLE KEYS */; 269 | UNLOCK TABLES; 270 | 271 | -- 272 | -- Table structure for table `auth_permission` 273 | -- 274 | 275 | DROP TABLE IF EXISTS `auth_permission`; 276 | /*!40101 SET @saved_cs_client = @@character_set_client */; 277 | /*!40101 SET character_set_client = utf8 */; 278 | CREATE TABLE `auth_permission` ( 279 | `id` int(11) NOT NULL AUTO_INCREMENT, 280 | `name` varchar(255) NOT NULL, 281 | `content_type_id` int(11) NOT NULL, 282 | `codename` varchar(100) NOT NULL, 283 | PRIMARY KEY (`id`), 284 | UNIQUE KEY `auth_permission_content_type_id_01ab375a_uniq` (`content_type_id`,`codename`), 285 | CONSTRAINT `auth_permissi_content_type_id_2f476e4b_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) 286 | ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1; 287 | /*!40101 SET character_set_client = @saved_cs_client */; 288 | 289 | -- 290 | -- Dumping data for table `auth_permission` 291 | -- 292 | 293 | LOCK TABLES `auth_permission` WRITE; 294 | /*!40000 ALTER TABLE `auth_permission` DISABLE KEYS */; 295 | INSERT INTO `auth_permission` VALUES (1,'Can add log entry',1,'add_logentry'),(2,'Can change log entry',1,'change_logentry'),(3,'Can delete log entry',1,'delete_logentry'),(4,'Can add permission',2,'add_permission'),(5,'Can change permission',2,'change_permission'),(6,'Can delete permission',2,'delete_permission'),(7,'Can add user',3,'add_user'),(8,'Can change user',3,'change_user'),(9,'Can delete user',3,'delete_user'),(10,'Can add group',4,'add_group'),(11,'Can change group',4,'change_group'),(12,'Can delete group',4,'delete_group'),(13,'Can add content type',5,'add_contenttype'),(14,'Can change content type',5,'change_contenttype'),(15,'Can delete content type',5,'delete_contenttype'),(16,'Can add session',6,'add_session'),(17,'Can change session',6,'change_session'),(18,'Can delete session',6,'delete_session'); 296 | /*!40000 ALTER TABLE `auth_permission` ENABLE KEYS */; 297 | UNLOCK TABLES; 298 | 299 | -- 300 | -- Table structure for table `auth_user` 301 | -- 302 | 303 | DROP TABLE IF EXISTS `auth_user`; 304 | /*!40101 SET @saved_cs_client = @@character_set_client */; 305 | /*!40101 SET character_set_client = utf8 */; 306 | CREATE TABLE `auth_user` ( 307 | `id` int(11) NOT NULL AUTO_INCREMENT, 308 | `password` varchar(128) NOT NULL, 309 | `last_login` datetime DEFAULT NULL, 310 | `is_superuser` tinyint(1) NOT NULL, 311 | `username` varchar(150) NOT NULL, 312 | `first_name` varchar(30) NOT NULL, 313 | `last_name` varchar(30) NOT NULL, 314 | `email` varchar(254) NOT NULL, 315 | `is_staff` tinyint(1) NOT NULL, 316 | `is_active` tinyint(1) NOT NULL, 317 | `date_joined` datetime NOT NULL, 318 | PRIMARY KEY (`id`), 319 | UNIQUE KEY `username` (`username`) 320 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; 321 | /*!40101 SET character_set_client = @saved_cs_client */; 322 | 323 | -- 324 | -- Dumping data for table `auth_user` 325 | -- 326 | 327 | LOCK TABLES `auth_user` WRITE; 328 | /*!40000 ALTER TABLE `auth_user` DISABLE KEYS */; 329 | INSERT INTO `auth_user` VALUES (1,'pbkdf2_sha256$30000$2SQJIk8SP66i$NnPhhrNebOIzUpkzq08FfGEK8yD890gLE7QFDEBRPLI=','2016-10-22 10:09:36',1,'cryptomanic','','','deepakyadav.iitbhu@gmail.com',1,1,'2016-10-20 13:13:07'),(2,'pbkdf2_sha256$30000$wgUkFQpMQfhs$cToHFrWUW9S9VcDg+ThYHCnNZhy0518GL/uWpCg91nI=','2016-10-22 10:16:14',0,'goku446','','','',0,1,'2016-10-20 13:33:02'),(3,'pbkdf2_sha256$30000$YJxAOzSjE3Uv$+neHe5jbsv8gu9/Tb7wYhEs3ZzgSol5V5neODb1oDQ4=','2016-10-20 18:39:25',0,'anantdadu','','','',0,1,'2016-10-20 18:38:16'),(4,'pbkdf2_sha256$30000$SotWuaH9RCjM$xGyBEjDXRM7bUpGOG4p3QKa1rHV+uDpGSjvGCv6PzYw=','2016-10-22 09:45:28',0,'prateek1996','','','',0,1,'2016-10-22 09:43:11'); 330 | /*!40000 ALTER TABLE `auth_user` ENABLE KEYS */; 331 | UNLOCK TABLES; 332 | 333 | -- 334 | -- Table structure for table `auth_user_groups` 335 | -- 336 | 337 | DROP TABLE IF EXISTS `auth_user_groups`; 338 | /*!40101 SET @saved_cs_client = @@character_set_client */; 339 | /*!40101 SET character_set_client = utf8 */; 340 | CREATE TABLE `auth_user_groups` ( 341 | `id` int(11) NOT NULL AUTO_INCREMENT, 342 | `user_id` int(11) NOT NULL, 343 | `group_id` int(11) NOT NULL, 344 | PRIMARY KEY (`id`), 345 | UNIQUE KEY `auth_user_groups_user_id_94350c0c_uniq` (`user_id`,`group_id`), 346 | KEY `auth_user_groups_group_id_97559544_fk_auth_group_id` (`group_id`), 347 | CONSTRAINT `auth_user_groups_group_id_97559544_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), 348 | CONSTRAINT `auth_user_groups_user_id_6a12ed8b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) 349 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 350 | /*!40101 SET character_set_client = @saved_cs_client */; 351 | 352 | -- 353 | -- Dumping data for table `auth_user_groups` 354 | -- 355 | 356 | LOCK TABLES `auth_user_groups` WRITE; 357 | /*!40000 ALTER TABLE `auth_user_groups` DISABLE KEYS */; 358 | /*!40000 ALTER TABLE `auth_user_groups` ENABLE KEYS */; 359 | UNLOCK TABLES; 360 | 361 | -- 362 | -- Table structure for table `auth_user_user_permissions` 363 | -- 364 | 365 | DROP TABLE IF EXISTS `auth_user_user_permissions`; 366 | /*!40101 SET @saved_cs_client = @@character_set_client */; 367 | /*!40101 SET character_set_client = utf8 */; 368 | CREATE TABLE `auth_user_user_permissions` ( 369 | `id` int(11) NOT NULL AUTO_INCREMENT, 370 | `user_id` int(11) NOT NULL, 371 | `permission_id` int(11) NOT NULL, 372 | PRIMARY KEY (`id`), 373 | UNIQUE KEY `auth_user_user_permissions_user_id_14a6b632_uniq` (`user_id`,`permission_id`), 374 | KEY `auth_user_user_perm_permission_id_1fbb5f2c_fk_auth_permission_id` (`permission_id`), 375 | CONSTRAINT `auth_user_user_perm_permission_id_1fbb5f2c_fk_auth_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), 376 | CONSTRAINT `auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) 377 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 378 | /*!40101 SET character_set_client = @saved_cs_client */; 379 | 380 | -- 381 | -- Dumping data for table `auth_user_user_permissions` 382 | -- 383 | 384 | LOCK TABLES `auth_user_user_permissions` WRITE; 385 | /*!40000 ALTER TABLE `auth_user_user_permissions` DISABLE KEYS */; 386 | /*!40000 ALTER TABLE `auth_user_user_permissions` ENABLE KEYS */; 387 | UNLOCK TABLES; 388 | 389 | -- 390 | -- Table structure for table `django_admin_log` 391 | -- 392 | 393 | DROP TABLE IF EXISTS `django_admin_log`; 394 | /*!40101 SET @saved_cs_client = @@character_set_client */; 395 | /*!40101 SET character_set_client = utf8 */; 396 | CREATE TABLE `django_admin_log` ( 397 | `id` int(11) NOT NULL AUTO_INCREMENT, 398 | `action_time` datetime NOT NULL, 399 | `object_id` longtext, 400 | `object_repr` varchar(200) NOT NULL, 401 | `action_flag` smallint(5) unsigned NOT NULL, 402 | `change_message` longtext NOT NULL, 403 | `content_type_id` int(11) DEFAULT NULL, 404 | `user_id` int(11) NOT NULL, 405 | PRIMARY KEY (`id`), 406 | KEY `django_admin__content_type_id_c4bce8eb_fk_django_content_type_id` (`content_type_id`), 407 | KEY `django_admin_log_user_id_c564eba6_fk_auth_user_id` (`user_id`), 408 | CONSTRAINT `django_admin_log_user_id_c564eba6_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), 409 | CONSTRAINT `django_admin__content_type_id_c4bce8eb_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) 410 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 411 | /*!40101 SET character_set_client = @saved_cs_client */; 412 | 413 | -- 414 | -- Dumping data for table `django_admin_log` 415 | -- 416 | 417 | LOCK TABLES `django_admin_log` WRITE; 418 | /*!40000 ALTER TABLE `django_admin_log` DISABLE KEYS */; 419 | /*!40000 ALTER TABLE `django_admin_log` ENABLE KEYS */; 420 | UNLOCK TABLES; 421 | 422 | -- 423 | -- Table structure for table `django_content_type` 424 | -- 425 | 426 | DROP TABLE IF EXISTS `django_content_type`; 427 | /*!40101 SET @saved_cs_client = @@character_set_client */; 428 | /*!40101 SET character_set_client = utf8 */; 429 | CREATE TABLE `django_content_type` ( 430 | `id` int(11) NOT NULL AUTO_INCREMENT, 431 | `app_label` varchar(100) NOT NULL, 432 | `model` varchar(100) NOT NULL, 433 | PRIMARY KEY (`id`), 434 | UNIQUE KEY `django_content_type_app_label_76bd3d3b_uniq` (`app_label`,`model`) 435 | ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; 436 | /*!40101 SET character_set_client = @saved_cs_client */; 437 | 438 | -- 439 | -- Dumping data for table `django_content_type` 440 | -- 441 | 442 | LOCK TABLES `django_content_type` WRITE; 443 | /*!40000 ALTER TABLE `django_content_type` DISABLE KEYS */; 444 | INSERT INTO `django_content_type` VALUES (1,'admin','logentry'),(4,'auth','group'),(2,'auth','permission'),(3,'auth','user'),(5,'contenttypes','contenttype'),(6,'sessions','session'); 445 | /*!40000 ALTER TABLE `django_content_type` ENABLE KEYS */; 446 | UNLOCK TABLES; 447 | 448 | -- 449 | -- Table structure for table `django_migrations` 450 | -- 451 | 452 | DROP TABLE IF EXISTS `django_migrations`; 453 | /*!40101 SET @saved_cs_client = @@character_set_client */; 454 | /*!40101 SET character_set_client = utf8 */; 455 | CREATE TABLE `django_migrations` ( 456 | `id` int(11) NOT NULL AUTO_INCREMENT, 457 | `app` varchar(255) NOT NULL, 458 | `name` varchar(255) NOT NULL, 459 | `applied` datetime NOT NULL, 460 | PRIMARY KEY (`id`) 461 | ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1; 462 | /*!40101 SET character_set_client = @saved_cs_client */; 463 | 464 | -- 465 | -- Dumping data for table `django_migrations` 466 | -- 467 | 468 | LOCK TABLES `django_migrations` WRITE; 469 | /*!40000 ALTER TABLE `django_migrations` DISABLE KEYS */; 470 | INSERT INTO `django_migrations` VALUES (1,'contenttypes','0001_initial','2016-10-20 13:12:03'),(2,'auth','0001_initial','2016-10-20 13:12:07'),(3,'admin','0001_initial','2016-10-20 13:12:07'),(4,'admin','0002_logentry_remove_auto_add','2016-10-20 13:12:08'),(5,'contenttypes','0002_remove_content_type_name','2016-10-20 13:12:08'),(6,'auth','0002_alter_permission_name_max_length','2016-10-20 13:12:08'),(7,'auth','0003_alter_user_email_max_length','2016-10-20 13:12:09'),(8,'auth','0004_alter_user_username_opts','2016-10-20 13:12:09'),(9,'auth','0005_alter_user_last_login_null','2016-10-20 13:12:09'),(10,'auth','0006_require_contenttypes_0002','2016-10-20 13:12:09'),(11,'auth','0007_alter_validators_add_error_messages','2016-10-20 13:12:09'),(12,'auth','0008_alter_user_username_max_length','2016-10-20 13:12:10'),(13,'sessions','0001_initial','2016-10-20 13:12:10'); 471 | /*!40000 ALTER TABLE `django_migrations` ENABLE KEYS */; 472 | UNLOCK TABLES; 473 | 474 | -- 475 | -- Table structure for table `django_session` 476 | -- 477 | 478 | DROP TABLE IF EXISTS `django_session`; 479 | /*!40101 SET @saved_cs_client = @@character_set_client */; 480 | /*!40101 SET character_set_client = utf8 */; 481 | CREATE TABLE `django_session` ( 482 | `session_key` varchar(40) NOT NULL, 483 | `session_data` longtext NOT NULL, 484 | `expire_date` datetime NOT NULL, 485 | PRIMARY KEY (`session_key`), 486 | KEY `django_session_de54fa62` (`expire_date`) 487 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 488 | /*!40101 SET character_set_client = @saved_cs_client */; 489 | 490 | -- 491 | -- Dumping data for table `django_session` 492 | -- 493 | 494 | LOCK TABLES `django_session` WRITE; 495 | /*!40000 ALTER TABLE `django_session` DISABLE KEYS */; 496 | INSERT INTO `django_session` VALUES ('n9s5nhc87o3clpgix0ja4a0pck2nikqz','YjEzZjNhODJkNDk4MTE0NTM1ZWNjMDQ1MDU3NjQ5MjA4MzY2MmU2ODp7Il9hdXRoX3VzZXJfaGFzaCI6IjNhMWI2YjdmM2NhZDc5YTZiZmUwMWE3ODc4MWQ1NDE2OGViN2QzMzIiLCJfYXV0aF91c2VyX2lkIjoiMiIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImRqYW5nby5jb250cmliLmF1dGguYmFja2VuZHMuTW9kZWxCYWNrZW5kIn0=','2016-11-05 10:15:32'); 497 | /*!40000 ALTER TABLE `django_session` ENABLE KEYS */; 498 | UNLOCK TABLES; 499 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 500 | 501 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 502 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 503 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 504 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 505 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 506 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 507 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 508 | 509 | -- Dump completed on 2016-10-22 15:49:51 510 | -------------------------------------------------------------------------------- /readme.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Railway Management System" 3 | author: "Deepak Yadav" 4 | date: "22 October 2016" 5 | output: pdf_document 6 | --- 7 | 8 | ## Project Structure 9 | . refers to Project_1 Directory i.e. current working directory 10 | 11 | 1. ./railway/views.py : contains important methods which return HttpResponse object 12 | 13 | 2. ./Project_1/urls.py : Map url to methods in views 14 | 15 | 3. ./static : css and images 16 | 17 | 4. ./templates : html pages 18 | 19 | 5. ./Project_1/settings.py: store database details, template path, static path. 20 | 21 | ## Create database, create and populate tables 22 | 1) Open ubuntu command prompt 23 | 2) Start mysql as `mysql -u -p` 24 | 3) Create database `railway_management` as `create database railway_management;` 25 | 4) Select database as `use railway_management;` 26 | 5) Use `commands.sql` file in the main repository to create and populate tables. Run `source /Railway-Management-System/commands.sql` 27 | 28 | ## How to start server? 29 | Go to the Project_1 directory and run ``python manage.py runserver`` 30 | 31 | ## Go to home page 32 | After starting the server go to the ``https://localhost:port/home`` i.e. homepage of the website. 33 | 34 | ## Facilities provided to the end user 35 | 36 | In order to do something you must have an account. So you can **signup** if you don't have one and you are good to go. 37 | Now you have an account so after successful **login** you can 38 | 39 | 1. know about trains: **User** need to provide **train number** as **input**. If train number is valid then train information will be displayed to the user such as **seats availability**, whether **food** is available or not, on **which day** of the week it runs, **train route**, **arrival time** and **departure time** and much more. 40 | 41 | 2. find trains between stations: Provide two **station codes** and you will get to know all trains passes through both the specified stations. Both station codes must be different. 42 | 43 | 3. book a ticket: Booking a ticket is very simple. You just need to fill a form correctly. You will have to provide **train number**, **first name**, **last name**, select **gender** from drop down menu, **age**, select **class(sleeper, 1 AC, 2 AC, 3 AC)** from drop down menu and **phone number**. 44 | 45 | ## Other facilities 46 | 1. HTML pages are linked for better user experience. 47 | 48 | -------------------------------------------------------------------------------- /readme.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cryptomanic/Railway-Management-System/8bb39cee0c946f5fa3ecf3a2e37411ff3b2a0c21/readme.pdf --------------------------------------------------------------------------------