diff --git a/EAppt/__pycache__/settings.cpython-38.pyc b/EAppt/__pycache__/settings.cpython-38.pyc index 36e52c8..89d4604 100644 Binary files a/EAppt/__pycache__/settings.cpython-38.pyc and b/EAppt/__pycache__/settings.cpython-38.pyc differ diff --git a/accounts/__pycache__/views.cpython-38.pyc b/accounts/__pycache__/views.cpython-38.pyc index 52b5036..87f405f 100644 Binary files a/accounts/__pycache__/views.cpython-38.pyc and b/accounts/__pycache__/views.cpython-38.pyc differ diff --git a/accounts/views.py b/accounts/views.py index f4bdf66..79ebc40 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -40,6 +40,7 @@ def register(request): user = User.objects.create_user(username=username, password=password1, email=email, first_name=first_name,last_name=last_name) user.save(); print('User created') + messages.info(request, 'Account created successfully, you can login now') return redirect('login') else: messages.info(request, 'Passwords not matching') diff --git a/booking/__pycache__/forms.cpython-38.pyc b/booking/__pycache__/forms.cpython-38.pyc new file mode 100644 index 0000000..1354c99 Binary files /dev/null and b/booking/__pycache__/forms.cpython-38.pyc differ diff --git a/booking/__pycache__/models.cpython-38.pyc b/booking/__pycache__/models.cpython-38.pyc index b8a0459..82af054 100644 Binary files a/booking/__pycache__/models.cpython-38.pyc and b/booking/__pycache__/models.cpython-38.pyc differ diff --git a/booking/__pycache__/urls.cpython-38.pyc b/booking/__pycache__/urls.cpython-38.pyc index cafd4a6..1c669de 100644 Binary files a/booking/__pycache__/urls.cpython-38.pyc and b/booking/__pycache__/urls.cpython-38.pyc differ diff --git a/booking/__pycache__/views.cpython-38.pyc b/booking/__pycache__/views.cpython-38.pyc index adf2be3..0138cc4 100644 Binary files a/booking/__pycache__/views.cpython-38.pyc and b/booking/__pycache__/views.cpython-38.pyc differ diff --git a/booking/forms.py b/booking/forms.py new file mode 100644 index 0000000..ddd6619 --- /dev/null +++ b/booking/forms.py @@ -0,0 +1,8 @@ +from django import forms +from .models import MyModel + +class MyForm(forms.ModelForm): + class Meta: + model = MyModel + fields = ["username", "email","date","time","service","barber",] + labels = {'username': "Name", "email": "Email", "date": "Book Your Date(YYYY-MM-DD)", "time": "Book Your Time", "service": "Services", "barber": "Barbers",} \ No newline at end of file diff --git a/booking/migrations/0001_initial.py b/booking/migrations/0001_initial.py new file mode 100644 index 0000000..c2b254f --- /dev/null +++ b/booking/migrations/0001_initial.py @@ -0,0 +1,26 @@ +# Generated by Django 3.1.6 on 2021-03-27 03:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='MyModel', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('username', models.CharField(max_length=200)), + ('email', models.CharField(max_length=200)), + ('date', models.DateField()), + ('time', models.TimeField()), + ('service', models.CharField(choices=[('HC', 'Haircut with clippers'), ('HCS', 'Haircut with clippers & scissors'), ('HBC', 'Haircut and beard combo'), ('B', 'Beard'), ('HE', 'Haircut & eyebrows'), ('DGH', 'Dying gray hair')], default='HC', max_length=200)), + ('barber', models.CharField(choices=[('FA', 'First Available'), ('KA', 'Keith Apelon'), ('FS', 'Frank Swan'), ('DT', 'Dario Tequila')], default='FA', max_length=200)), + ], + ), + ] diff --git a/booking/migrations/0002_auto_20210327_0608.py b/booking/migrations/0002_auto_20210327_0608.py new file mode 100644 index 0000000..59a9376 --- /dev/null +++ b/booking/migrations/0002_auto_20210327_0608.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.6 on 2021-03-27 05:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('booking', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='mymodel', + name='email', + field=models.EmailField(max_length=254), + ), + ] diff --git a/booking/migrations/0003_auto_20210327_0652.py b/booking/migrations/0003_auto_20210327_0652.py new file mode 100644 index 0000000..c411c4e --- /dev/null +++ b/booking/migrations/0003_auto_20210327_0652.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.6 on 2021-03-27 05:52 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('booking', '0002_auto_20210327_0608'), + ] + + operations = [ + migrations.AlterField( + model_name='mymodel', + name='date', + field=models.CharField(max_length=200), + ), + ] diff --git a/booking/migrations/0004_auto_20210327_0703.py b/booking/migrations/0004_auto_20210327_0703.py new file mode 100644 index 0000000..dab41fc --- /dev/null +++ b/booking/migrations/0004_auto_20210327_0703.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.6 on 2021-03-27 06:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('booking', '0003_auto_20210327_0652'), + ] + + operations = [ + migrations.AlterField( + model_name='mymodel', + name='time', + field=models.CharField(max_length=200), + ), + ] diff --git a/booking/migrations/0005_auto_20210327_1433.py b/booking/migrations/0005_auto_20210327_1433.py new file mode 100644 index 0000000..1b628c5 --- /dev/null +++ b/booking/migrations/0005_auto_20210327_1433.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.6 on 2021-03-27 13:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('booking', '0004_auto_20210327_0703'), + ] + + operations = [ + migrations.AlterField( + model_name='mymodel', + name='barber', + field=models.CharField(choices=[('FA', 'First Available'), ('KA', 'Keith Apelon'), ('FS', 'Frank Swan'), ('DT', 'Dario Tequila')], max_length=200), + ), + migrations.AlterField( + model_name='mymodel', + name='service', + field=models.CharField(choices=[('HC', 'Haircut with clippers'), ('HCS', 'Haircut with clippers & scissors'), ('HBC', 'Haircut and beard combo'), ('B', 'Beard'), ('HE', 'Haircut & eyebrows'), ('DGH', 'Dying gray hair')], max_length=200), + ), + ] diff --git a/booking/migrations/0006_auto_20210327_1454.py b/booking/migrations/0006_auto_20210327_1454.py new file mode 100644 index 0000000..de0c854 --- /dev/null +++ b/booking/migrations/0006_auto_20210327_1454.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.6 on 2021-03-27 13:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('booking', '0005_auto_20210327_1433'), + ] + + operations = [ + migrations.AlterField( + model_name='mymodel', + name='service', + field=models.CharField(choices=[('Haircut with clippers 10$', 'Haircut with clippers 10$'), ('HCS', 'Haircut with clippers & scissors 15$'), ('HBC', 'Haircut and beard combo 25$'), ('B', 'Beard 5$'), ('HE', 'Haircut & eyebrows 15$'), ('DGH', 'Dying gray hair 25$')], max_length=200), + ), + ] diff --git a/booking/migrations/0007_auto_20210327_1456.py b/booking/migrations/0007_auto_20210327_1456.py new file mode 100644 index 0000000..46b948f --- /dev/null +++ b/booking/migrations/0007_auto_20210327_1456.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.6 on 2021-03-27 13:56 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('booking', '0006_auto_20210327_1454'), + ] + + operations = [ + migrations.AlterField( + model_name='mymodel', + name='barber', + field=models.CharField(choices=[('First Available', 'First Available'), ('Keith Apelon', 'Keith Apelon'), ('Frank Swan', 'Frank Swan'), ('Dario Tequila', 'Dario Tequila')], max_length=200), + ), + migrations.AlterField( + model_name='mymodel', + name='service', + field=models.CharField(choices=[('Haircut with clippers 10$', 'Haircut with clippers 10$'), ('Haircut with clippers & scissors 15$', 'Haircut with clippers & scissors 15$'), ('Haircut and beard combo 25$', 'Haircut and beard combo 25$'), ('Beard 5$', 'Beard 5$'), ('Haircut & eyebrows 15$', 'Haircut & eyebrows 15$'), ('Dying gray hair 25$', 'Dying gray hair 25$')], max_length=200), + ), + ] diff --git a/booking/migrations/__pycache__/0001_initial.cpython-38.pyc b/booking/migrations/__pycache__/0001_initial.cpython-38.pyc new file mode 100644 index 0000000..0ab896d Binary files /dev/null and b/booking/migrations/__pycache__/0001_initial.cpython-38.pyc differ diff --git a/booking/migrations/__pycache__/0002_auto_20210327_0608.cpython-38.pyc b/booking/migrations/__pycache__/0002_auto_20210327_0608.cpython-38.pyc new file mode 100644 index 0000000..6936ae4 Binary files /dev/null and b/booking/migrations/__pycache__/0002_auto_20210327_0608.cpython-38.pyc differ diff --git a/booking/migrations/__pycache__/0003_auto_20210327_0652.cpython-38.pyc b/booking/migrations/__pycache__/0003_auto_20210327_0652.cpython-38.pyc new file mode 100644 index 0000000..153fdf9 Binary files /dev/null and b/booking/migrations/__pycache__/0003_auto_20210327_0652.cpython-38.pyc differ diff --git a/booking/migrations/__pycache__/0004_auto_20210327_0703.cpython-38.pyc b/booking/migrations/__pycache__/0004_auto_20210327_0703.cpython-38.pyc new file mode 100644 index 0000000..c881095 Binary files /dev/null and b/booking/migrations/__pycache__/0004_auto_20210327_0703.cpython-38.pyc differ diff --git a/booking/migrations/__pycache__/0005_auto_20210327_1433.cpython-38.pyc b/booking/migrations/__pycache__/0005_auto_20210327_1433.cpython-38.pyc new file mode 100644 index 0000000..0e742a6 Binary files /dev/null and b/booking/migrations/__pycache__/0005_auto_20210327_1433.cpython-38.pyc differ diff --git a/booking/migrations/__pycache__/0006_auto_20210327_1454.cpython-38.pyc b/booking/migrations/__pycache__/0006_auto_20210327_1454.cpython-38.pyc new file mode 100644 index 0000000..11455f4 Binary files /dev/null and b/booking/migrations/__pycache__/0006_auto_20210327_1454.cpython-38.pyc differ diff --git a/booking/migrations/__pycache__/0007_auto_20210327_1456.cpython-38.pyc b/booking/migrations/__pycache__/0007_auto_20210327_1456.cpython-38.pyc new file mode 100644 index 0000000..9a9650f Binary files /dev/null and b/booking/migrations/__pycache__/0007_auto_20210327_1456.cpython-38.pyc differ diff --git a/booking/models.py b/booking/models.py index 71a8362..39bbe33 100644 --- a/booking/models.py +++ b/booking/models.py @@ -1,3 +1,36 @@ from django.db import models # Create your models here. + + +SERVICES = ( + ('Haircut with clippers 10$','Haircut with clippers 10$'), + ('Haircut with clippers & scissors 15$','Haircut with clippers & scissors 15$'), + ('Haircut and beard combo 25$','Haircut and beard combo 25$'), + ('Beard 5$','Beard 5$'), + ('Haircut & eyebrows 15$','Haircut & eyebrows 15$'), + ('Dying gray hair 25$','Dying gray hair 25$'), + + + ) + +BARBERS = ( + ('First Available','First Available'), + ('Keith Apelon','Keith Apelon'), + ('Frank Swan','Frank Swan'), + ('Dario Tequila','Dario Tequila'), + ) + + + +class MyModel(models.Model): + username = models.CharField(max_length=200) + email = models.EmailField() + date = models.CharField(max_length=200) + time = models.CharField(max_length=200) + service = models.CharField(max_length=200, choices=SERVICES) + barber = models.CharField(max_length=200, choices=BARBERS) + + def __str__(self): + return 'Appointment: {}/{} on {} at {} {} {}'.format(self.username, self.email, self.date, self.time, self.service, self.barber) + diff --git a/booking/urls.py b/booking/urls.py index c8ec9dc..9fc7f4b 100644 --- a/booking/urls.py +++ b/booking/urls.py @@ -3,4 +3,7 @@ from . import views urlpatterns = [ path('book', views.book, name="book"), + path(r'form', views.my_form, name='form'), + path('myappointments', views.myappointments, name='myappointments'), + ] diff --git a/booking/views.py b/booking/views.py index c6dee3d..cff5d38 100644 --- a/booking/views.py +++ b/booking/views.py @@ -1,5 +1,51 @@ from django.shortcuts import render - +from django.shortcuts import render, redirect +from django.contrib import messages +from django.contrib.auth.models import User, auth +from django.utils.safestring import mark_safe # Create your views here. + + +from .models import MyModel +from .forms import MyForm + +def my_form(request): + if request.method == "POST": + form = MyForm(request.POST) + if form.is_valid(): + form.save() + else: + form = MyForm() + return render(request, 'form.html', {'form': form}) + + + def book(request): - pass \ No newline at end of file + if not request.user.is_active: + messages.info(request, 'Please login first') + return redirect('login') + + if request.method=='POST': + first_name = request.POST['first_name'] + email = request.POST['email'] + Text = request.POST['Text'] + Time = request.POST['Time'] + service = request.POST['service'] + barber = request.POST['barber'] + MyModel.objects.create(username=first_name,email=email,date=Text,time=Time,service=service,barber=barber) + + + + messages.info(request, "Appointment booked successfully, you can check your appointment details in") + messages.info(request, mark_safe(' My appointments.')) + messages.info(request, "If date and time you picked isn't available, we'll pick the closest one to that you picked") + return render(request, 'home.html') + + + +def myappointments(request): + + MyModels = MyModel.objects.all() + + return render(request, 'myappointments.html', {'MyModels': MyModels}) + diff --git a/static/website/css/style.css b/static/website/css/style.css index a6e666b..2a915a3 100644 --- a/static/website/css/style.css +++ b/static/website/css/style.css @@ -251,6 +251,7 @@ p.wickedpicker__title { } /*--//copyright--*/ + /*--responsive--*/ @media(max-width: 1680px){ diff --git a/website/__pycache__/admin.cpython-38.pyc b/website/__pycache__/admin.cpython-38.pyc index 3d88e4b..16dea4e 100644 Binary files a/website/__pycache__/admin.cpython-38.pyc and b/website/__pycache__/admin.cpython-38.pyc differ diff --git a/website/__pycache__/models.cpython-38.pyc b/website/__pycache__/models.cpython-38.pyc index 6cfaa30..077a198 100644 Binary files a/website/__pycache__/models.cpython-38.pyc and b/website/__pycache__/models.cpython-38.pyc differ diff --git a/website/admin.py b/website/admin.py index ce988ad..b3a110c 100644 --- a/website/admin.py +++ b/website/admin.py @@ -1,5 +1,7 @@ from django.contrib import admin from .models import Dest +from booking.models import MyModel # Register your models here. -admin.site.register(Dest) \ No newline at end of file +admin.site.register(Dest) +admin.site.register(MyModel) \ No newline at end of file diff --git a/website/models.py b/website/models.py index 7ad8e3e..a69887c 100644 --- a/website/models.py +++ b/website/models.py @@ -1,4 +1,5 @@ from django.db import models +from booking.models import * # Create your models here. class Dest(models.Model): diff --git a/website/templates/form.html b/website/templates/form.html new file mode 100644 index 0000000..56f7724 --- /dev/null +++ b/website/templates/form.html @@ -0,0 +1,38 @@ +{% load static %} + + + + + + + + Login + + + + + + + + +
+
+
+
+
+ Form + {% csrf_token %} + {{ form.as_p }} + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/website/templates/home.html b/website/templates/home.html index 93c5f7d..0476209 100644 --- a/website/templates/home.html +++ b/website/templates/home.html @@ -29,6 +29,7 @@ {% if user.is_authenticated %} + {% else %} @@ -41,43 +42,54 @@
+ {% if user.is_authenticated %}

Make an appointment

-
+ {% else %} +

Create your account first

+ {% endif %} + {% csrf_token %} +
+ +
+ {% for message in messages %} +

{{message}}

+ {% endfor %} +

Your Name

- +

Email

- +
-

Book Your Date

+

Book Your Date (Sundays excluded)

-

Book Your Time

+

Book Your Time (Open from 8 AM to 9 PM.)

Services

- - - - - - - + + + + + +

Stylist

- diff --git a/website/templates/myappointments.html b/website/templates/myappointments.html new file mode 100644 index 0000000..5b6427b --- /dev/null +++ b/website/templates/myappointments.html @@ -0,0 +1,30 @@ +{% load static %} + + + + + + + Login + + + + + + +
+
+
+

Your appointments

+{% for item in MyModels %} +

{{ item.username}} on {{ item.date}} at {{ item.time}} {{ item.service}} by {{ item.barber}}

+
+{% endfor %} +
+
+
+ + \ No newline at end of file