File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
templates/mainpage/include Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 11from django .db import models
22from django .utils .timezone import now
3- from mainpage .utils .typing import ensured
43
54
65class Curators (models .Model ):
@@ -69,8 +68,8 @@ class Enrollment(models.Model):
6968 late_price_date_from = models .DateField ()
7069
7170 @staticmethod
72- def get_enrollment_with_active_registration () -> "Enrollment" :
73- return ensured ( Enrollment .objects .filter (end_registration_date__gte = now ()).first () )
71+ def get_enrollment_with_active_registration () -> "Enrollment | None " :
72+ return Enrollment .objects .filter (end_registration_date__gte = now ()).first ()
7473
7574 def __str__ (self ) -> str :
7675 return f"Enrollment ({ self .start_date } - { self .end_date } )"
Original file line number Diff line number Diff line change 7171 < li class ="nav-item ">
7272 < a class ="nav-link scroll-to " href ="#contact "> Контакты</ a >
7373 </ li >
74+ {% if enrollment %}
7475 < li class ="nav-item d-none d-lg-block ">
7576 {% if enrollment.platim_url %}
7677 < a class ="custom-btn btn " href ="{{ enrollment.platim_url }} " target ="_blank ">
8283 </ a >
8384 {% endif %}
8485 </ li >
86+ {% endif %}
8587 </ ul >
8688 </ nav >
8789
Original file line number Diff line number Diff line change @@ -11,7 +11,10 @@ def index(request: HttpRequest) -> HttpResponse:
1111 context = {
1212 'enrollment' : enrollment ,
1313 'projects' : GraduateProjects .objects .all (),
14- 'registration_closes_date_formatted' : enrollment .end_registration_date .strftime ('%b %d, %Y %H:%M:%S' ),
14+ 'registration_closes_date_formatted' : (
15+ enrollment .end_registration_date .strftime ('%b %d, %Y %H:%M:%S' )
16+ if enrollment else ""
17+ ),
1518 'student_videos' : [
1619 {
1720 'title' : 'Путь джуна — из геодезиста в Support Engineer' ,
You can’t perform that action at this time.
0 commit comments