Skip to content

Commit

Permalink
Merge pull request #20 from UCF/doc-update
Browse files Browse the repository at this point in the history
Location Documentation and Added Views
  • Loading branch information
jmbarne3 authored Sep 16, 2019
2 parents 8dbee3e + ee49a5b commit 55161dd
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 7 deletions.
22 changes: 22 additions & 0 deletions apps/events/views/event_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,22 @@ def named_listing(request, pk, slug, type, format=None):


class ListViewByCalendarMixin(object):
location = None

def get_location(self):
"""
Return the location
"""
location = self.request.GET.get('location', '')

if location:
try:
self.location = Location.objects.get(import_id=location)
except Location.DoesNotExist, e:
self.location = None

return self.location

def get_calendar(self):
"""
Returns the calendar object specified for the view; if no calendar
Expand Down Expand Up @@ -881,6 +897,9 @@ def get_queryset(self):
calendar = self.get_calendar()
events = events.filter(event__calendar=calendar)

if self.get_format() != 'html' and self.get_location():
events = events.filter(location=self.location)

return events


Expand Down Expand Up @@ -913,6 +932,9 @@ def get_queryset(self):
calendar = self.get_calendar()
events = events.filter(event__calendar=calendar)

if self.get_format() != 'html' and self.get_location():
events = events.filter(location=self.location)

return events


Expand Down
57 changes: 50 additions & 7 deletions templates/events/static/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,10 @@ <h3 id="feeds">Feeds</h3>
a single event item/entry for a multi-day event. This gives the consumer the ability to handle multi-day events how they prefer. Enabling
<code>mapped_events</code> will take a multi-day event and create an event item/entry for every day it occurs on; e.g. an event that spans September 10 at 9:00am - September 12 at 1:00pm would create events items/entries for September 10 from 9:00 - 23:59, September 11 from 00:00 - 23:59, and September 12 from 00:00 - 13:00. Note that this parameter option is not available for all views; see the table below for compatible views.
</p>
<p>
The URL parameter option <code>location</code> (default: <em>None</em>) filters events to a specific location. The value passed to the parameter should be the building ID.
For example, the building ID for Millican Hall is <code>1</code>, so the value passed would be <code>?location=1</code>. The building ID for Spectrum Stadium is <code>135</code>, so the value passed would be <code>?location=135</code>.
</p>
<p>
Listed below are all available feed locations. All calendar-based views listed below assume you're trying to fetch events
on a specific calendar. To fetch events on the Main Calendar, remove the <code>/calendar/[calendar_id]/[calendar_slug]/</code>
Expand Down Expand Up @@ -856,6 +860,10 @@ <h3 id="feeds">Feeds</h3>
<code>mapped_events</code><br/>
<small>Default: <em>false</em></small>
</li>
<li>
<code>location</code><br/>
<small>Default: <em>None</em></small>
</li>
</ul>
</td>
</tr>
Expand Down Expand Up @@ -890,6 +898,10 @@ <h3 id="feeds">Feeds</h3>
<code>mapped_events</code><br/>
<small>Default: <em>false</em></small>
</li>
<li>
<code>location</code><br/>
<small>Default: <em>None</em></small>
</li>
</ul>
</td>
</tr>
Expand Down Expand Up @@ -920,8 +932,12 @@ <h3 id="feeds">Feeds</h3>
<td>
<ul class="table-list">
<li>
<code>mapped_events</code><br/>
<small>Default: <em>false</em></small>
<code>mapped_events</code><br/>
<small>Default: <em>false</em></small>
</li>
<li>
<code>location</code><br/>
<small>Default: <em>None</em></small>
</li>
</ul>
</td>
Expand All @@ -947,7 +963,12 @@ <h3 id="feeds">Feeds</h3>
</ul>
</td>
<td>
n/a
<ul class="table-list">
<li>
<code>location</code><br/>
<small>Default: <em>None</em></small>
</li>
</ul>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -990,8 +1011,12 @@ <h3 id="feeds">Feeds</h3>
<td>
<ul class="table-list">
<li>
<code>mapped_events</code><br/>
<small>Default: <em>false</em></small>
<code>mapped_events</code><br/>
<small>Default: <em>false</em></small>
</li>
<li>
<code>location</code><br/>
<small>Default: <em>None</em></small>
</li>
</ul>
</td>
Expand Down Expand Up @@ -1039,6 +1064,10 @@ <h3 id="feeds">Feeds</h3>
<code>mapped_events</code><br/>
<small>Default: <em>false</em></small>
</li>
<li>
<code>location</code><br/>
<small>Default: <em>None</em></small>
</li>
</ul>
</td>
</tr>
Expand Down Expand Up @@ -1080,6 +1109,10 @@ <h3 id="feeds">Feeds</h3>
<code>mapped_events</code><br/>
<small>Default: <em>false</em></small>
</li>
<li>
<code>location</code><br/>
<small>Default: <em>None</em></small>
</li>
</ul>
</td>
</tr>
Expand Down Expand Up @@ -1107,7 +1140,12 @@ <h3 id="feeds">Feeds</h3>
</ul>
</td>
<td>
n/a
<ul class="table-list">
<li>
<code>location</code><br/>
<small>Default: <em>None</em></small>
</li>
</ul>
</td>
</tr>
<tr>
Expand All @@ -1134,7 +1172,12 @@ <h3 id="feeds">Feeds</h3>
</ul>
</td>
<td>
n/a
<ul class="table-list">
<li>
<code>location</code><br/>
<small>Default: <em>None</em></small>
</li>
</ul>
</td>
</tr>
<tr>
Expand Down

0 comments on commit 55161dd

Please sign in to comment.