From f8b19e7895ddae14061f6d9037f0b5dae5135871 Mon Sep 17 00:00:00 2001 From: name Date: Wed, 19 Jul 2023 18:23:03 -0400 Subject: [PATCH 01/19] Added Static Pages --- server/db.sqlite3 | Bin 0 -> 131072 bytes .../djangoapp/templates/djangoapp/about.html | 22 ++++++++++++++++++ .../templates/djangoapp/contact.html | 22 ++++++++++++++++++ .../djangoapp/templates/djangoapp/index.html | 16 +++++++++---- server/djangoapp/urls.py | 4 ++-- server/djangoapp/views.py | 10 ++++++-- 6 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 server/db.sqlite3 create mode 100644 server/djangoapp/templates/djangoapp/about.html create mode 100644 server/djangoapp/templates/djangoapp/contact.html diff --git a/server/db.sqlite3 b/server/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..5de4d8b055744c2557759b3cd622b63a99b6222e GIT binary patch literal 131072 zcmeI5dyFH=UB}&a+n$H*n&Y~-ED+mWA+OizAe z@-a2S2LwO>1V8`;KmY_l00cmwk3eQ7=sUZz(Kgy`v)O2;QYlq48)nDUYw1)vvz98X zsik;2bwMp&NTpxMW{SC7{_=FtH~;2_zTde`?bDiG>liIiPq% zW;Av?x4k{7IW_;%6!mn;_M~e2dsV$-XnU>ZgNNFl(W;x4E>90?F`G+WB-F!ewuh9^ zvfFCz?;S@*rdUd4)0bk@$xY!TRdN@orXR07nL;j~E`BIV9bLB_72S>)o?~#yP zyiQv?POG6>ilxHkP|&w>X~T_?QKWq9&3iq(8sp2Idf`pyv-wYSdh@ zsHOtc#Y)e`$N@nu71UgQ-A|d)9DG0+J%Xr3HIvR1B#Lfj5Z&lI(TEjZt~I%Z zXf&`i#v}P^TO<}(w1R9khu&s(;8sd7kddl)^u}(}UV7qdBca(qU~Nn!@O2BeW-%`X z)@|#$x!cm&8c2I)f;tV6Px;7q$)A(ICtoMOP6POW00@8p2!H?xfB*=900@8p2!H?x zyjKL~&83$r70&QtW%NZ^!;3_LbNdVvl2u*w4f+ z#nLnbJ|F-BAO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#HHR}%px1}S| z_2${lF&-A#nE#D zD=T5PG4M!odWv&v-d~*HGakLhNqwSGWDxUk&vS2sieb{7N!<15V*|Z1JH0gJ8nY;s z{zlrjnUL&Wem1N$Gg9~C?#H8Bh(`Alw3=QvYFeGveN8Lm%hgOZQ|1-#pWo=;)$x?(RXOASgO5~lijJf zd&gGD(yMi|!N%L(j%_8E&l+VtKWK196s!NO%7fBQA0f?MVQgHi2tS8Q9LSMKe&Xkz;fI7ix$bTWJ*k6=&U&_i zp81nC0Qy{MHZ->V=6*Da^F_4LHp_R6N{5jZZ(!C_Q$)9nJ-W+kKX%gt9hzboSGx)HxO+TuE$8H&pcl-2|`wqQV6M^yQ0gXM9DY~7SzMF`*>w2w5 zk7vdA8*Ou!K8<@X5%G(cH!r@*#satfPku0-N+!D>R_LgqsoeL{((9tqCP;mb0-*!%%lnS|ADVNPUEy=Ptbyy7@ z=3r2-WyjhR|HhjV_WzHXVIds^KmY_l00ck)1V8`;KmY_l00f?X0+|0l{dI^EfB*=9 z00@8p2!H?xfB*=900@A!3m00ck)1V8`;KmY_l00cnb=_i2s|I=TG zC;m@neTB zJ1fSvi_cTL<<*d0t-77jplz`_M=jP0L9R;tHX{4g-JUWL7iW>{v(#99F(~8>m36KNF#8OUVGgJO2^6-tBoPF-g-`)&k=GJqsbg zvYD`Kgo2)pkif%d#;MKXxd7A9GhiZk;QSa(UCsEp3g=h$dQzOI=fl);z2FymoCIbo zL^+Yqhb(KM%t>I@LY@=(T##BPRX@|{#4=MR)QNdk4*JH=sa!1mp;r0>&#i|&sWc+a zW6lSt)oM-%b=wJ + + + + Dealership Review + + + + + + + + + +
+

+ Welcome to Best Cars dealership, home to the best cars in North America. We sell domestic and imported cars at reasonable prices. +

+ + + + diff --git a/server/djangoapp/templates/djangoapp/contact.html b/server/djangoapp/templates/djangoapp/contact.html new file mode 100644 index 0000000000..9f498d03c3 --- /dev/null +++ b/server/djangoapp/templates/djangoapp/contact.html @@ -0,0 +1,22 @@ + + + + + Dealership Review + + + + + + + + + +
+

+ Welcome to Best Cars dealership, home to the best cars in North America. We sell domestic and imported cars at reasonable prices. +

+ + + + \ No newline at end of file diff --git a/server/djangoapp/templates/djangoapp/index.html b/server/djangoapp/templates/djangoapp/index.html index 1a9ee6e39a..c2559e2479 100644 --- a/server/djangoapp/templates/djangoapp/index.html +++ b/server/djangoapp/templates/djangoapp/index.html @@ -14,11 +14,17 @@ - - This is the index page of your Django app! - - - + diff --git a/server/djangoapp/urls.py b/server/djangoapp/urls.py index 37b1c89d01..3f6b28cd16 100644 --- a/server/djangoapp/urls.py +++ b/server/djangoapp/urls.py @@ -10,9 +10,9 @@ # name the URL # path for about view - + path(route='about', view=views.about, name='about'), # path for contact us view - + path(route='contact', view=views.contact, name='contact'), # path for registration # path for login diff --git a/server/djangoapp/views.py b/server/djangoapp/views.py index 61cc664da0..01ac66f51f 100644 --- a/server/djangoapp/views.py +++ b/server/djangoapp/views.py @@ -18,12 +18,18 @@ # Create an `about` view to render a static about page -# def about(request): -# ... +def about(request): + context = {} + if request.method == "GET": + return render(request, 'djangoapp/about.html', context) # Create a `contact` view to return a static contact page #def contact(request): +def contact(request): + context = {} + if request.method == "GET": + return render(request, 'djangoapp/contact.html', context) # Create a `login_request` view to handle sign in request # def login_request(request): From 51e33bcf81fc0546ac399744917a54c20ec733d9 Mon Sep 17 00:00:00 2001 From: name Date: Wed, 19 Jul 2023 19:47:00 -0400 Subject: [PATCH 02/19] Added registration and starting to style the pages --- .../djangoapp/templates/djangoapp/about.html | 53 ++++++++++++++++--- .../djangoapp/templates/djangoapp/index.html | 21 +++++++- .../templates/djangoapp/registration.html | 2 +- server/djangoapp/urls.py | 5 +- server/djangoapp/views.py | 52 ++++++++++++++---- 5 files changed, 114 insertions(+), 19 deletions(-) diff --git a/server/djangoapp/templates/djangoapp/about.html b/server/djangoapp/templates/djangoapp/about.html index 9d0ef7bb36..63274aa74e 100644 --- a/server/djangoapp/templates/djangoapp/about.html +++ b/server/djangoapp/templates/djangoapp/about.html @@ -11,12 +11,53 @@ - -
-

- Welcome to Best Cars dealership, home to the best cars in North America. We sell domestic and imported cars at reasonable prices. -

+ + + + + +
+

+ Welcome to Best Cars dealership, home to the best cars in North America. We sell domestic and imported cars at reasonable prices. +

+
+ + diff --git a/server/djangoapp/templates/djangoapp/index.html b/server/djangoapp/templates/djangoapp/index.html index c2559e2479..2e732cf2c1 100644 --- a/server/djangoapp/templates/djangoapp/index.html +++ b/server/djangoapp/templates/djangoapp/index.html @@ -23,7 +23,26 @@ About Us Contact Us - + diff --git a/server/djangoapp/templates/djangoapp/registration.html b/server/djangoapp/templates/djangoapp/registration.html index ae11ea4b71..00cf6c4197 100644 --- a/server/djangoapp/templates/djangoapp/registration.html +++ b/server/djangoapp/templates/djangoapp/registration.html @@ -6,6 +6,6 @@ - + yes \ No newline at end of file diff --git a/server/djangoapp/urls.py b/server/djangoapp/urls.py index 3f6b28cd16..67bd2cf5fc 100644 --- a/server/djangoapp/urls.py +++ b/server/djangoapp/urls.py @@ -14,10 +14,11 @@ # path for contact us view path(route='contact', view=views.contact, name='contact'), # path for registration - + path(route='registration', view=views.contact, name='registration'), # path for login - + path(route='login', view=views.login_request, name='login'), # path for logout + path(route='logout', view=views.logout_request, name='logout'), path(route='', view=views.get_dealerships, name='index'), diff --git a/server/djangoapp/views.py b/server/djangoapp/views.py index 01ac66f51f..6974496caf 100644 --- a/server/djangoapp/views.py +++ b/server/djangoapp/views.py @@ -31,17 +31,51 @@ def contact(request): if request.method == "GET": return render(request, 'djangoapp/contact.html', context) -# Create a `login_request` view to handle sign in request -# def login_request(request): -# ... +def registration_request(request): + context = {} + if request.method == 'GET': + return render(request, 'djangoapp/registration.html', context) + elif request.method == 'POST': + # Check if user exists + username = request.POST['username'] + password = request.POST['psw'] + first_name = request.POST['firstname'] + last_name = request.POST['lastname'] + user_exist = False + try: + User.objects.get(username=username) + user_exist = True + except: + logger.error("New user") + if not user_exist: + user = User.objects.create_user(username=username, first_name=first_name, last_name=last_name, + password=password) + login(request, user) + return redirect("djangoapp:index") + else: + context['message'] = "User already exists." + return render(request, 'djangoapp/registration.html', context) -# Create a `logout_request` view to handle sign out request -# def logout_request(request): -# ... -# Create a `registration_request` view to handle sign up request -# def registration_request(request): -# ... +def login_request(request): + context = {} + if request.method == "POST": + username = request.POST['username'] + password = request.POST['psw'] + user = authenticate(username=username, password=password) + if user is not None: + login(request, user) + return redirect('djangoapp:index') + else: + context['message'] = "Invalid username or password." + return render(request, 'onlinecourse/user_login_bootstrap.html', context) + else: + return render(request, 'onlinecourse/user_login_bootstrap.html', context) + + +def logout_request(request): + logout(request) + return redirect('djangoapp:index') # Update the `get_dealerships` view to render the index page with a list of dealerships def get_dealerships(request): From f2c43e4769405be3397f590978a5cfa5036f2e05 Mon Sep 17 00:00:00 2001 From: name Date: Thu, 20 Jul 2023 15:52:29 -0400 Subject: [PATCH 03/19] Added more style to the About Page and Contact Page --- .../djangoapp/templates/djangoapp/about.html | 46 ++++++++++++---- .../templates/djangoapp/contact.html | 53 +++++++++++++++++-- .../djangoapp/templates/djangoapp/index.html | 2 - 3 files changed, 86 insertions(+), 15 deletions(-) diff --git a/server/djangoapp/templates/djangoapp/about.html b/server/djangoapp/templates/djangoapp/about.html index 63274aa74e..3365493d2a 100644 --- a/server/djangoapp/templates/djangoapp/about.html +++ b/server/djangoapp/templates/djangoapp/about.html @@ -14,7 +14,19 @@ @@ -25,10 +37,8 @@ -
+ +
+

+ We are home to the best cars in North America. We sell domestic and imported cars at reasonable prices. At Best Cars dealership, you can be sure to get the bang for your buck. We sell all kinds of makes and models of cars including brands like Kia, Voltswagen, Ford, Dodge, Cheverolette and much more. We take pride in being awarded with Top 10 most customer friendly dealerships in the nation! This just shows how eager we are to meet you and get you the perfect car for you. Come in today! +

+ +
+ +
+

+ Our Story +

+
- +
+

+ Grant Angler founded this company in 1890. Following his death in 1910, his family has kept the business going. It is still family owned to this day. Austin Angler holds ownership of the company now with his brother Martin being head of Marketing & Design. +

+
+ + diff --git a/server/djangoapp/templates/djangoapp/contact.html b/server/djangoapp/templates/djangoapp/contact.html index 9f498d03c3..7db1cf4f01 100644 --- a/server/djangoapp/templates/djangoapp/contact.html +++ b/server/djangoapp/templates/djangoapp/contact.html @@ -11,12 +11,57 @@ + + + +
-

- Welcome to Best Cars dealership, home to the best cars in North America. We sell domestic and imported cars at reasonable prices. -

- +

+ Contact Us +

    +

    Phone Number: 444-444-4444

    +

    Email Address: bestcardealership@best.com

    +

    Address: 1234 58 Ave Little Rock, Arkansas 65789

    +
+

+
\ No newline at end of file diff --git a/server/djangoapp/templates/djangoapp/index.html b/server/djangoapp/templates/djangoapp/index.html index 2e732cf2c1..8067801c14 100644 --- a/server/djangoapp/templates/djangoapp/index.html +++ b/server/djangoapp/templates/djangoapp/index.html @@ -19,10 +19,8 @@ -