Added tmp links to month tables

This commit is contained in:
2022-07-14 16:49:49 +03:00
parent 35398809ce
commit 6afe30ed42
5 changed files with 19 additions and 4 deletions
@@ -26,7 +26,6 @@ table.month td {
table.month td.current {
background: dimgrey;
color: white;
}
table.month th.subtitle {
@@ -34,6 +33,15 @@ table.month th.subtitle {
font-weight: normal;
}
table.month td a {
text-decoration: none;
color: black;
}
table.month td.current a {
color: white;
}
div.calendar {
display: flex;
flex-flow: row wrap;
@@ -18,7 +18,7 @@
<div class="calendar">
{% for month in month_data %}
{% if not month.is_leap_month or year_data.is_leap %}
{% include 'faerun_calendar/month.html' with month=month calendar_data=calendar_data month_days=month_days %}
{% include 'faerun_calendar/month.html' with month=month calendar_data=calendar_data month_days=month_days events=events %}
{% endif %}
{% endfor %}
</div>
@@ -19,7 +19,7 @@
<td>
{% endif %}
<div>{{day}}</div>
<a href="{{year_data.number}}/{{month.number}}/{{day}}">{{day}}</a>
</td>
+1
View File
@@ -5,5 +5,6 @@ from . import views
urlpatterns = [
path('', views.index, name='index'),
path('<int:year>', views.year_page, name='index'),
path('<int:year>/<int:month>/<int:day>', views.day_page, name='index'),
]
+7 -1
View File
@@ -8,20 +8,26 @@ from .models import CalendarData
from .models import Event
def day_page(request, year: int, month: int, day: int):
return HttpResponse(f'{year}.{month}.{day}')
def year_page(request, year: int):
try:
year_data = YearData.objects.get(number=year)
except YearData.DoesNotExist:
return HttpResponseNotFound("<h1>404 Not Found</h1>")
return HttpResponseNotFound('<h1>404 Not Found</h1>')
month_data = MonthData.objects.all()
calendar_data = CalendarData.objects.first()
events = Event.objects.all()
params = {
'calendar_data': calendar_data,
'year_data': year_data,
'month_data': month_data,
'month_days': tuple(i+1 for i in range(30)),
'events': events,
}
return render(request, 'faerun_calendar/index.html', params)