Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Nabies authored Apr 23, 2021
1 parent b78b501 commit 2b4b843
Show file tree
Hide file tree
Showing 19 changed files with 457 additions and 0 deletions.
Binary file added __pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added __pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file added __pycache__/forms.cpython-38.pyc
Binary file not shown.
Binary file added __pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file added __pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added __pycache__/views.cpython-38.pyc
Binary file not shown.
6 changes: 6 additions & 0 deletions admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin
from .models import Booking
from .models import Driver
# Register your models here.
admin.site.register(Booking)
admin.site.register(Driver)
5 changes: 5 additions & 0 deletions apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class BookingappConfig(AppConfig):
name = 'bookingapp'
114 changes: 114 additions & 0 deletions forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
from django.contrib.auth.models import User
from django import forms
from .models import Booking,Driver


FROM_LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)

TO_LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)

LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)


class BookingForm(forms.ModelForm):
name=forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Your name',

}))
email=forms.EmailField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Email address',
'type':'email',

}))
phone=forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control ',
'placeholder':'Phone Number',

}))
passenger=forms.IntegerField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Passenger Count',
'type':'number',

}))

StartLocation = forms.ChoiceField(choices=FROM_LOCATION,required=True)
ToLocation = forms.ChoiceField(choices=TO_LOCATION,required=True)

class Meta:
model=Booking
fields=['name','email','phone','StartLocation','ToLocation','passenger']

class UserForm(forms.ModelForm):
username=forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Your name',

}))
email=forms.EmailField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Email address',
'type':'email',

}))

password=forms.CharField(widget=forms.PasswordInput(attrs={
'class':'form-control',
'placeholder':'Enter the password',
}))

class Meta:
model=User
fields=('username','email','password')


class Driverform(forms.ModelForm):
# name=forms.CharField(widget=forms.TextInput(attrs={
# 'class':'form-control',
# 'placeholder':'Your name',
#
# }))

phone=forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control ',
'placeholder':'Phone Number'

}))

lic_no=forms.IntegerField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'License Number',
'type':'number',

}))
vehicle_no=forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control ',
'placeholder':'Vehicle No',

}))

Location = forms.ChoiceField(choices=LOCATION,required=True)




class Meta:
model=Driver
fields=['phone','lic_no','vehicle_no','Location']
40 changes: 40 additions & 0 deletions migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated by Django 3.0.3 on 2020-09-08 04:12

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='Booking',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, null=True)),
('email', models.EmailField(max_length=255, null=True)),
('phone', models.CharField(max_length=20, null=True)),
('passenger', models.IntegerField(null=True)),
('StartLocation', models.CharField(choices=[('Kuniyamuthur', 'Kuniyamuthur'), ('Ukkadam', 'Ukkadam'), ('Gandhipuram', 'Gandhipuram'), ('Sundharapuram', 'Sundharapuram')], max_length=255, null=True)),
('ToLocation', models.CharField(choices=[('Kuniyamuthur', 'Kuniyamuthur'), ('Ukkadam', 'Ukkadam'), ('Gandhipuram', 'Gandhipuram'), ('Sundharapuram', 'Sundharapuram')], max_length=255, null=True)),
],
),
migrations.CreateModel(
name='Driver',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('phone', models.CharField(blank=True, max_length=255, null=True)),
('Location', models.CharField(blank=True, choices=[('Kuniyamuthur', 'Kuniyamuthur'), ('Ukkadam', 'Ukkadam'), ('Gandhipuram', 'Gandhipuram'), ('Sundharapuram', 'Sundharapuram')], max_length=255, null=True)),
('lic_no', models.IntegerField(blank=True, null=True)),
('vehicle_no', models.CharField(blank=True, max_length=255, null=True)),
('user', models.OneToOneField(default='', null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
17 changes: 17 additions & 0 deletions migrations/0002_remove_driver_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.0.3 on 2020-09-08 04:36

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('bookingapp', '0001_initial'),
]

operations = [
migrations.RemoveField(
model_name='driver',
name='user',
),
]
31 changes: 31 additions & 0 deletions migrations/0003_auto_20200910_0856.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 3.0.3 on 2020-09-10 03:26

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


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('bookingapp', '0002_remove_driver_user'),
]

operations = [
migrations.AddField(
model_name='driver',
name='date_created',
field=models.DateTimeField(auto_now_add=True, null=True),
),
migrations.AddField(
model_name='driver',
name='user',
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='driver',
name='Location',
field=models.CharField(choices=[('Kuniyamuthur', 'Kuniyamuthur'), ('Ukkadam', 'Ukkadam'), ('Gandhipuram', 'Gandhipuram'), ('Sundharapuram', 'Sundharapuram')], max_length=255, null=True),
),
]
22 changes: 22 additions & 0 deletions migrations/0004_auto_20200910_0913.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.0.3 on 2020-09-10 03:43

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('bookingapp', '0003_auto_20200910_0856'),
]

operations = [
migrations.RemoveField(
model_name='driver',
name='date_created',
),
migrations.AddField(
model_name='driver',
name='name',
field=models.CharField(max_length=200, null=True),
),
]
18 changes: 18 additions & 0 deletions migrations/0005_driver_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.0.3 on 2020-09-10 03:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('bookingapp', '0004_auto_20200910_0913'),
]

operations = [
migrations.AddField(
model_name='driver',
name='email',
field=models.EmailField(max_length=255, null=True),
),
]
21 changes: 21 additions & 0 deletions migrations/0006_auto_20200910_1027.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.0.3 on 2020-09-10 04:57

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('bookingapp', '0005_driver_email'),
]

operations = [
migrations.RemoveField(
model_name='driver',
name='email',
),
migrations.RemoveField(
model_name='driver',
name='name',
),
]
66 changes: 66 additions & 0 deletions models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
from django.db import models
from django.contrib.auth.models import User
# Create your models here.

class Driver(models.Model):
# name=models.CharField(max_length=255)
# email=models.EmailField(max_length=255)
# phone=models.CharField(max_length=255)
# LOCATION=(
# ('Kuniyamuthur','Kuniyamuthur'),
# ('Ukkadam','Ukkadam'),
# ('Gandhipuram','Gandhipuram'),
# ('Sundharapuram','Sundharapuram'),
# )
# Location=models.CharField(max_length=255,choices = LOCATION)
# lic_no=models.IntegerField()
# vehicle_no=models.CharField(max_length=255)
# password=models.CharField(max_length=50)
user=models.OneToOneField(User,on_delete=models.CASCADE,null=True)
# user_id=models.CharField(max_length=10,null=True)
# name=models.CharField(max_length=200,null=True)
# email=models.EmailField(max_length=255,null=True)
phone=models.CharField(max_length=255,null=True,blank=True)
LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)
Location=models.CharField(max_length=255,choices = LOCATION,null=True)
lic_no=models.IntegerField(null=True,blank=True)
vehicle_no=models.CharField(max_length=255,null=True,blank=True)
# date_created = models.DateTimeField(auto_now_add=True, null=True)



# def user(self):
# return User.objects.get(pk=self.user_id)

def __str__(request):
return str(request.user)


class Booking(models.Model):
name=models.CharField(max_length=255,null=True)
email=models.EmailField(max_length=255,null=True)
phone=models.CharField(max_length=20,null=True)
passenger=models.IntegerField(null=True)
FROM_LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)
StartLocation=models.CharField(max_length=255,null=True,choices = FROM_LOCATION)
TO_LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)
ToLocation=models.CharField(max_length=255,null=True,choices = TO_LOCATION)


def __str__(self):
return self.name
3 changes: 3 additions & 0 deletions 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.
13 changes: 13 additions & 0 deletions urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django.urls import path
from bookingapp import views


urlpatterns = [
path('',views.index,name='index'),
path('contact.html',views.contact,name='contact'),
path('driver.html',views.driver,name='driver'),
path('details/',views.bookingdetails,name='details'),
path('driverdetails/',views.driverdetails,name='driverdetails'),
path('login/',views.loginform,name='login'),
path('logout/',views.logoutform,name='logout'),
]
Loading

0 comments on commit 2b4b843

Please sign in to comment.