Skip to content

Commit

Permalink
remove special lists; only show current month on calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
qch3n-at authored and ppiro committed Feb 24, 2024
1 parent 1b0ed00 commit 8f66a7e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 62 deletions.
20 changes: 6 additions & 14 deletions cal/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
{},
'cal_index',
),
path(
'all/',
cal.views.all,
{},
'cal_all',
),
re_path(
r'^(?P<year>\d{4})/$',
YearArchiveView.as_view(
Expand Down Expand Up @@ -107,20 +113,6 @@
cal.views.update_event,
{ 'new': True },
),
path(
'locations/',
cal.views.SpecialListView.as_view(
queryset=Location.objects.all(),
events_by="Locations",
),
),
path(
'categories/',
cal.views.SpecialListView.as_view(
queryset=Category.objects.all(),
events_by="Categories",
),
),
re_path(
r'^ajax/list/(?P<number>\d*)/?$',
cal.views.event_list,
Expand Down
18 changes: 4 additions & 14 deletions cal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def currentmonth(self):
return self.formatmonth(t.year, t.month)


def index(request):
def all(request):
d = date.today() - relativedelta.relativedelta(days=2)
cal = EventCalendar(Event.all.order_by('startDate'), request.user.is_authenticated).currentmonth()
date_list = Event.all.all().datetimes('startDate', 'year')
Expand All @@ -119,6 +119,9 @@ def index(request):
'latestevents': latest_events
})

def index(request):
d = date.today()
return monthly(request, d.year, d.month)

def monthly(request, year, month):
try:
Expand Down Expand Up @@ -241,19 +244,6 @@ def complete_ical(request, num, past_duration):
calendar = create_calendar([x.get_icalendar_event() for x in events])
return HttpResponse(calendar.to_ical(), content_type='text/calendar; charset=utf-8')


class SpecialListView(ListView):
template_name = "cal/event_special_list.html"
events_by = None

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context.update({
'events_by': self.events_by,
})
return context


def public_upcoming(request):
events = Event.objects.not_deleted().advertise().filter(
endDate__gte=timezone.now().date(),
Expand Down
1 change: 0 additions & 1 deletion templates/cal/event_archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<h1 id="site-name">{{HOS_NAME}} Calendar</h1>
</div>
</div>
{% include 'cal/overview_event_navigation.inc' %}


{% if type %}
Expand Down
1 change: 0 additions & 1 deletion templates/cal/event_archive_year.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<h1 id="site-name">{{HOS_NAME}} Calendar: {{year}}</h1>
</div>
</div>
{% include 'cal/overview_event_navigation.inc' %}


{% if type %}
Expand Down
31 changes: 0 additions & 31 deletions templates/cal/event_special_list.html

This file was deleted.

1 change: 0 additions & 1 deletion templates/cal/overview_event_navigation.inc

This file was deleted.

0 comments on commit 8f66a7e

Please sign in to comment.