Merge branch 'refs/heads/ivan' into andrei

# Conflicts:
#	CineSync/templates/home/homepage.html
#	CineSync/timetable/views.py
This commit is contained in:
Андрей Дувакин 2024-04-19 21:51:46 +05:00
commit e7e1add412
10 changed files with 90 additions and 16 deletions

View File

@ -9,7 +9,6 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('films/', include('films.urls'), name='films'),
path('timetable/', include('timetable.urls'), name='timetable'),
path('ticket/<int:sess_id>', include('tickets.urls'), name='tickets'),
path("auth/", include("users.urls"), name="auth"),
path("auth/", include("django.contrib.auth.urls"), name="auth"),
]

0
CineSync/__init__.py Normal file
View File

View File

@ -4,6 +4,21 @@
width: 25vw !important;
border-radius: 3vw;
}
.film_session_image {
margin-top: 40px;
object-fit: cover;
height: 20vw !important;
width: 50% !important;
border-radius: 3vw;
}
.line {
width: 30%;
height: 5px;
background-color: black;
position: absolute;
top: 70%;
border-radius: 3vw;
}
.ticket_film_image {
object-fit: cover;
height: 20vw !important;
@ -43,7 +58,7 @@
padding-bottom: 2vw;
flex-direction: column;
}
.film_card {
.film_card, .seats_card {
width: 100%;
background-color: #eaeaea;
margin-top: 1vw;

View File

@ -58,4 +58,5 @@
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,44 @@
{% extends "base.html" %}
{% load static %}
{% load tags %}
{% block title %}
{{ session.film.name }}
{% endblock %}
{% block content %}
<link href="{% static 'css/style.css' %}" rel="stylesheet">
<div style="text-align: center;">
<img src="{{ session.film.image.url }}" class="film_session_image"
alt="Фотография фильма не найдена">
</div>
<div class="seats_card"
style="width: 50%; height:
{{ height }}px;
margin: 0 auto; margin-top: 20px"
>
<div style="width: 80%; margin-top: 80px; margin: 0 auto;">
<h1>{{ session.film.name }}</h1>
{{ session.auditorium.number }}<br>
{{ session.start_datetime }}
<div style="margin-top: 20%;">
<div class="line" style="margin-left: 5%; margin-top: 150px;">
<h6 style="text-align: center; margin-top: 4px">Экран</h6>
</div>
{% for row in session.auditorium.row_count|get_range %}
<div class="row">
{% for seat in seats %}
<div class="film_card_row col">
<a class="film_session">
<span style="width: 20px; height: 18px; text-align: center;">{{ seat.row_number }}</span>
</a>
</div>
{% endfor %}
{{ row }}
</div>
{% endfor %}
</div>
<div style="text-align: center">
<button class="btn btn-primary" style="float: bottom; margin-top: 40px;">Купить билет</button>
</div>
</div>
</div>
{% endblock %}

View File

@ -1,11 +1,5 @@
from django.shortcuts import render, get_object_or_404
from timetable.models import FilmSession
def ticket_view(request, sess_id):
session = get_object_or_404(
FilmSession.objects.all(),
id=sess_id,
)
context = {'session': session}
return render(request, 'tickets/ticket_buy.html', context)
def ticket_view(request):
return render(request, 'tickets/ticket_buy.html')

View File

@ -0,0 +1,11 @@
from django import template
register = template.Library()
@register.filter(name='get_range')
def get_range(number):
if number:
return range(1, number + 1)
return range(0)

View File

@ -6,5 +6,5 @@ app_name = 'time_table'
urlpatterns = [
path('', timetable_view, name='main'),
path('session/<int:pk>', session_view, name='main'),
path('session/<int:sess_id>', session_view, name='session'),
]

View File

@ -2,8 +2,8 @@ import datetime
from datetime import date
from django.http import HttpResponse
from django.shortcuts import render
from films.models import Film
from django.shortcuts import render, get_object_or_404
from timetable.models import FilmSession, Row
from timetable.models import FilmSession
@ -40,6 +40,16 @@ def timetable_view(request):
)
def session_view(request):
template = 'session/session_details.html'
return render(request, template)
def session_view(request, sess_id):
session = get_object_or_404(
FilmSession.objects.all(),
id=sess_id,
)
height = session.auditorium.row_count * 80 + 300
context = {
'session': session,
'seats': Row.objects.filter(auditorium_id=session.auditorium.id),
'height': height,
}
template = 'timetable/session.html'
return render(request, template, context)