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 { table.month td.current {
background: dimgrey; background: dimgrey;
color: white;
} }
table.month th.subtitle { table.month th.subtitle {
@@ -34,6 +33,15 @@ table.month th.subtitle {
font-weight: normal; font-weight: normal;
} }
table.month td a {
text-decoration: none;
color: black;
}
table.month td.current a {
color: white;
}
div.calendar { div.calendar {
display: flex; display: flex;
flex-flow: row wrap; flex-flow: row wrap;
@@ -18,7 +18,7 @@
<div class="calendar"> <div class="calendar">
{% for month in month_data %} {% for month in month_data %}
{% if not month.is_leap_month or year_data.is_leap %} {% 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 %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
@@ -19,7 +19,7 @@
<td> <td>
{% endif %} {% endif %}
<div>{{day}}</div> <a href="{{year_data.number}}/{{month.number}}/{{day}}">{{day}}</a>
</td> </td>
+1
View File
@@ -5,5 +5,6 @@ from . import views
urlpatterns = [ urlpatterns = [
path('', views.index, name='index'), path('', views.index, name='index'),
path('<int:year>', views.year_page, 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 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): def year_page(request, year: int):
try: try:
year_data = YearData.objects.get(number=year) year_data = YearData.objects.get(number=year)
except YearData.DoesNotExist: except YearData.DoesNotExist:
return HttpResponseNotFound("<h1>404 Not Found</h1>") return HttpResponseNotFound('<h1>404 Not Found</h1>')
month_data = MonthData.objects.all() month_data = MonthData.objects.all()
calendar_data = CalendarData.objects.first() calendar_data = CalendarData.objects.first()
events = Event.objects.all()
params = { params = {
'calendar_data': calendar_data, 'calendar_data': calendar_data,
'year_data': year_data, 'year_data': year_data,
'month_data': month_data, 'month_data': month_data,
'month_days': tuple(i+1 for i in range(30)), 'month_days': tuple(i+1 for i in range(30)),
'events': events,
} }
return render(request, 'faerun_calendar/index.html', params) return render(request, 'faerun_calendar/index.html', params)