From ec11098e4645fc6f2ca5a0ae71a295b514270297 Mon Sep 17 00:00:00 2001 From: Andrii Ishchenko Date: Fri, 17 Nov 2023 11:19:33 +0200 Subject: [PATCH 1/3] Solution --- .gitignore | 1 + db.sqlite3 | Bin 0 -> 176128 bytes taxi/urls.py | 2 +- taxi/views.py | 17 +++++++++++------ taxi_service/settings.py | 6 +++++- taxi_service/urls.py | 1 + templates/includes/sidebar.html | 22 ++++++++++++++++++---- templates/registration/logged_out.html | 5 +++++ templates/registration/login.html | 18 ++++++++++++++++++ templates/taxi/car_list.html | 2 +- templates/taxi/driver_list.html | 15 +++++++++++---- templates/taxi/index.html | 1 + 12 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 db.sqlite3 create mode 100644 templates/registration/logged_out.html create mode 100644 templates/registration/login.html diff --git a/.gitignore b/.gitignore index b26d6116..abb32ddc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ venv/ .pytest_cache/ **__pycache__/ +.pylintrc diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..b59363401944225553d5c42fa6805eb6a9d383f4 GIT binary patch literal 176128 zcmeI53veUJd6+T8;6)Ho2c;8MFdE|(ZQ2w<&XS&?i-E>&blN=lAYvgLA0id;%5iIdo>RL+hPNiJ1MaiWS! ziXD|Dmo2F(fA@@2~&vneLt$tS-+hWm(7+iaDt)_znFA zjx)R{2nK`UL-215{tduC4*rGV9}oX(e>Cl+zYiI%r#KTx^^hM>*)j4%@&o&~dw<-! zWP8QBZF#@>yXFn^Wj@ZI?fEiSGLTEIBt2zu z#bVscu|^frMP*+uCMqQecI9GDDV3B$zQnBUl6SU4#kz<-Rvk56luc6E1U&UB3M;YM z*h*}1I<~3-Rb{oqc!U|6zrujW7vpR3==}VKmKd7>K#dwEI-=L>mn!8g9g@=>!}BQO zvbaQ%d--A;!GSMijD96)iVPY*YGe`%`tyyEL^e`}9*TdS%CDatKJ1P3SsbnV7 z*>1~2$blF79KVC}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t=yI8?wCNT~IVqckGnP=vmy}KD z>UA#?rfpY&NzMTbz!q z);p-afQG~)%uu-%cD{`-#@FJ}`S}ekF*XBM)VxPXDlkYldO*_wbZ3xLE7s~v2mB6W zpQn0$6b3VJR&_9AM@UJ/", DriverDetailView.as_view(), name="driver-detail" - ), + ) ] app_name = "taxi" diff --git a/taxi/views.py b/taxi/views.py index 82ad312f..6e86b58c 100644 --- a/taxi/views.py +++ b/taxi/views.py @@ -1,47 +1,52 @@ +from django.contrib.auth.mixins import LoginRequiredMixin +from django.http import HttpRequest, HttpResponse from django.shortcuts import render from django.views import generic from .models import Driver, Car, Manufacturer -def index(request): +def index(request: HttpRequest) -> HttpResponse: """View function for the home page of the site.""" num_drivers = Driver.objects.count() num_cars = Car.objects.count() num_manufacturers = Manufacturer.objects.count() + num_visits = request.session.get("num_visits", 0) + request.session["num_visits"] = num_visits + 1 context = { "num_drivers": num_drivers, "num_cars": num_cars, "num_manufacturers": num_manufacturers, + "num_visits": num_visits + 1 } return render(request, "taxi/index.html", context=context) -class ManufacturerListView(generic.ListView): +class ManufacturerListView(LoginRequiredMixin, generic.ListView): model = Manufacturer context_object_name = "manufacturer_list" template_name = "taxi/manufacturer_list.html" paginate_by = 5 -class CarListView(generic.ListView): +class CarListView(LoginRequiredMixin, generic.ListView): model = Car paginate_by = 5 queryset = Car.objects.select_related("manufacturer") -class CarDetailView(generic.DetailView): +class CarDetailView(LoginRequiredMixin, generic.DetailView): model = Car -class DriverListView(generic.ListView): +class DriverListView(LoginRequiredMixin, generic.ListView): model = Driver paginate_by = 5 -class DriverDetailView(generic.DetailView): +class DriverDetailView(LoginRequiredMixin, generic.DetailView): model = Driver queryset = Driver.objects.prefetch_related("cars__manufacturer") diff --git a/taxi_service/settings.py b/taxi_service/settings.py index b6c0cf19..4706af52 100644 --- a/taxi_service/settings.py +++ b/taxi_service/settings.py @@ -12,6 +12,8 @@ from pathlib import Path +from django.conf.global_settings import LOGIN_REDIRECT_URL + # Build paths inside the project like this: BASE_DIR / "subdir". BASE_DIR = Path(__file__).resolve().parent.parent @@ -39,7 +41,7 @@ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", - "taxi", + "taxi" ] MIDDLEWARE = [ @@ -108,6 +110,8 @@ AUTH_USER_MODEL = "taxi.Driver" +LOGIN_REDIRECT_URL = "/" + # Internationalization # https://docs.djangoproject.com/en/4.0/topics/i18n/ diff --git a/taxi_service/urls.py b/taxi_service/urls.py index 8b94449f..baf83d1a 100644 --- a/taxi_service/urls.py +++ b/taxi_service/urls.py @@ -22,4 +22,5 @@ urlpatterns = [ path("admin/", admin.site.urls), path("", include("taxi.urls", namespace="taxi")), + path("accounts/", include("django.contrib.auth.urls")), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/templates/includes/sidebar.html b/templates/includes/sidebar.html index b7cd72dc..02c4d2c4 100644 --- a/templates/includes/sidebar.html +++ b/templates/includes/sidebar.html @@ -1,6 +1,20 @@ diff --git a/templates/registration/logged_out.html b/templates/registration/logged_out.html new file mode 100644 index 00000000..4ffb1809 --- /dev/null +++ b/templates/registration/logged_out.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} +{% block content %} +

Logged out

+ Click here to login again +{% endblock %} diff --git a/templates/registration/login.html b/templates/registration/login.html new file mode 100644 index 00000000..1d951e5c --- /dev/null +++ b/templates/registration/login.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} + +{% block content %} +

Login

+ + {% if form.errors %} +

Invalid credentials

+ {% endif %} + +
+ {% csrf_token %} + {{ form.as_p }} + + + + +
+{% endblock %} diff --git a/templates/taxi/car_list.html b/templates/taxi/car_list.html index e107b579..90067b92 100644 --- a/templates/taxi/car_list.html +++ b/templates/taxi/car_list.html @@ -6,7 +6,7 @@

Car list

    {% for car in car_list %}
  • - {{ car.id }} + {{ car.id }} {{ car.model }} ({{ car.manufacturer.name }})
  • {% endfor %} diff --git a/templates/taxi/driver_list.html b/templates/taxi/driver_list.html index c6c3e823..f895dd3b 100644 --- a/templates/taxi/driver_list.html +++ b/templates/taxi/driver_list.html @@ -5,10 +5,17 @@

    Driver list

    {% if driver_list %}
      {% for driver in driver_list%} -
    • - {{ driver.username }} - ({{ driver.first_name }} {{ driver.last_name }}) -
    • + {% if user.id == driver.id %} +
    • + {{ driver.username }} + ({{ driver.first_name }} {{ driver.last_name }}) (Me) +
    • + {% else %} +
    • + {{ driver.username }} + ({{ driver.first_name }} {{ driver.last_name }}) +
    • + {% endif %} {% endfor %}
    {% else %} diff --git a/templates/taxi/index.html b/templates/taxi/index.html index 13c59aa8..549801ae 100644 --- a/templates/taxi/index.html +++ b/templates/taxi/index.html @@ -10,4 +10,5 @@

    Dynamic content

  • Drivers: {{ num_drivers }}
  • Manufacturers: {{ num_manufacturers }}
+

You have visited this page {{ num_visits }} time{{ num_visits|pluralize }}

{% endblock %} From 583446971ba8fc879004a8587d199d7b8b40734b Mon Sep 17 00:00:00 2001 From: Andrii Ishchenko Date: Fri, 17 Nov 2023 11:44:52 +0200 Subject: [PATCH 2/3] Solution 2 --- db.sqlite3 | Bin 176128 -> 176128 bytes taxi/views.py | 4 +++- taxi_service/settings.py | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db.sqlite3 b/db.sqlite3 index b59363401944225553d5c42fa6805eb6a9d383f4..3f1524c23e0acf8801a77ef07de6651cb0b6bb1e 100644 GIT binary patch delta 536 zcmajbyKd7^0D$4f1yV%;11l9O5))F=V;`SmJA%Qn6FW|#+(=Sq$<210*l}*YB}+;x z7?^;i6Ke-LBIJ=5Vdx9+4s>8eJi-6zKfg_#-=;o2OWb@u785t`2JZ)n9|Pk0G$kH9 zx_;=BAJby|7!WYMzc_txzj`?r*6Xc-$Kwry5H@_YT%#3_SqHE1bnXXkkTuk(Gn4Gv zWG6I)dVgA5tD9~;FV1@m?AE;51lF~}LIZ6R8>M2wX2;RuY*T4@8$_?59F;YzIaCzf z(^#%z^mI!MoEF;48KiX7w?0A=!+)NTAh#6>(13;+ip~J)1n@aX=O{J{FyvWqk-c~K z%oeUzec~kk`i5|yCcls|sgUva7vKq5B7YsIoZ;vW50>=MbQgiO@kR`uxE^QeA>wUL zPrf{?CjNIlcKXC`@)gbHC@zaQ3PLvd{7^{z(-vPYh!02UzgkH1n7;bCCxo~Y5#QK9 DW?rTn delta 535 zcmaiwJ#W)c7)EQCk}4EjSV2$(6H>!{eeJ}yU~nOkoy5>2RhwjSf9oHxZ3D77Wv&Ks#||LK2Mm5O{mSriWr=@vLv85zK7M9{Uw2S@m?^ z(GK5^j^viSD|%UicG@*p6k~p_YO&M6AggiEL|B~fHB)ZdpK3KBV$DD|gg6+Xv6;jT zHe(?ec2zDJ_0&CKk#?-mN+!FZV}!{BqUxOOxq7wNCmi(07L+yd^+7)rmg_gywB;k& zh)mNB+^FmuUL`b1JVp2&;n_?G5M<88I;s=%0BqCuvSGKKsm=`9EeRq_vatm1xi@^H zcYI>ElwnvEUIeivay2iE+6}_uZ3xxwtVt9_>9OdF*=+<{NR&X3FfQ?8nG?|a(v7vN zWT&A{Z{^=!($jkdh55?l%#$CF(OpJmey`N8>sffZs!`Xy$vvI^!#o3C0 HttpResponse: +@login_required +def index(request: HttpRequest) -> HttpResponse: """View function for the home page of the site.""" num_drivers = Driver.objects.count() diff --git a/taxi_service/settings.py b/taxi_service/settings.py index 4706af52..a4ef2fd3 100644 --- a/taxi_service/settings.py +++ b/taxi_service/settings.py @@ -12,8 +12,6 @@ from pathlib import Path -from django.conf.global_settings import LOGIN_REDIRECT_URL - # Build paths inside the project like this: BASE_DIR / "subdir". BASE_DIR = Path(__file__).resolve().parent.parent From f88e1dcd1500437d132da60182c5a7ea314f4b84 Mon Sep 17 00:00:00 2001 From: Andrii Ishchenko Date: Fri, 17 Nov 2023 13:18:31 +0200 Subject: [PATCH 3/3] may be this way --- db.sqlite3 | Bin 176128 -> 176128 bytes templates/taxi/driver_list.html | 9 +-------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/db.sqlite3 b/db.sqlite3 index 3f1524c23e0acf8801a77ef07de6651cb0b6bb1e..7a70f11439cf51d647d5768dc232e667da9be846 100644 GIT binary patch delta 255 zcmZp8z}4`8Yl1Z6hKVxHj2jvgS`!$zCNRCWR!FQeO*Jt}wx}|(NXyHrG)&2_CG_x|a)H5(QF*7r0(qm!uZO(R_UKr1$uzjvA zQ=Sm32md7g?b`(cm~8k7I%j)MJQJq?AF8R_oAa5PIrtHR#+D}L2GjS~GdXS#t6*AX F4gl*3PgMW_ delta 255 zcmZp8z}4`8Yl1Z6>WMPWjH??HS`!$zCNRCWRwyc}Of^eRE;cbWHA^iuEhsWAv@|o% zF)K97%q=a;E1RBe!*npP%(=>{(y%nt(ZJn3%_S`AIIL*a0(lIi} zQMaT#%D_F;!^ObJz{ptF&`8(7P{F{`%Gk)t&|J^J%-GW0ph=H~)wem@ae84qlfw47 zwoG|Ktdsb+^LuO;2w<||C+M8*Iq^)K0(_{ZZg0+KYUbca2pSt%ni);sU(e*YJ*Driver list {% if driver_list %}
    {% for driver in driver_list%} - {% if user.id == driver.id %}
  • {{ driver.username }} - ({{ driver.first_name }} {{ driver.last_name }}) (Me) + ({{ driver.first_name }} {{ driver.last_name }}) {% if user.id == driver.id %}(Me){% endif %}
  • - {% else %} -
  • - {{ driver.username }} - ({{ driver.first_name }} {{ driver.last_name }}) -
  • - {% endif %} {% endfor %}
{% else %}