diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..c6aeba6 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,7 @@ +Copyright (c) 2016 Jon Culver + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 3eb5338..ae9e245 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,13 @@ Decisions get made by people who show up. Progressive Events is here to tell you Things you'll need: + 1. Postgres database: https://wiki.postgresql.org/wiki/Detailed_installation_guides#MacOS -2. A unique, secure Django `SECRET_KEY` http://www.miniwebtool.com/django-secret-key-generator/ -3. A Google Maps API key (server side, for geocoding) https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true -4. Optionally, Redis: http://jasdeep.ca/2012/05/installing-redis-on-mac-os-x/ +2. The GDAL library (http://www.gdal.org/), `brew install GDAL` +3. The Postgres/GIS library, `brew install postgis` +4. A unique, secure Django `SECRET_KEY` http://www.miniwebtool.com/django-secret-key-generator/ +5. A Google Maps API key (server side, for geocoding) https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend&keyType=CLIENT_SIDE&reusekey=true +6. Optionally, Redis: http://jasdeep.ca/2012/05/installing-redis-on-mac-os-x/ ## Configuration diff --git a/core/models.py b/core/models.py index 46d8310..c1441a9 100644 --- a/core/models.py +++ b/core/models.py @@ -12,6 +12,8 @@ from .fields import MoneypatchedRecurrenceField from .utils import get_point +import pytz + def round_hours(hours=1): return now().replace(minute=0).replace(second=0) + timedelta(hours=hours) @@ -88,13 +90,15 @@ def save(self, *args, **kwargs): class EventQueryset(models.query.GeoQuerySet): def filter_by_date(self, as_occurrences=False, **kwargs): - future_date = datetime.now() + timedelta(**kwargs) + + midnight_hawaii = datetime.combine(datetime.now(pytz.timezone('US/Hawaii')), datetime.min.time()) + future_date = midnight_hawaii + timedelta(**kwargs) queryset = self.all() - events = filter(lambda e: len(e.recurrences.between(datetime.now(), future_date, inc=True)) > 0, queryset) + events = filter(lambda e: len(e.recurrences.between(midnight_hawaii, future_date, inc=True)) > 0, queryset) if as_occurrences: occurrences = [] for e in events: - occurrences += e.recurrences.between(datetime.now(), future_date, inc=True) + occurrences += e.recurrences.between(midnight_hawaii, future_date, inc=True) return occurrences else: return self.filter(pk__in=map(lambda e: e.pk, events)) @@ -145,6 +149,6 @@ def save(self, *args, **kwargs): def dates(self, *args, **kwargs): if not kwargs: kwargs = {'days': 60} - today = datetime.now().replace(hour=0,minute=0,second=0,microsecond=0) - future_date = today + timedelta(**kwargs) - return [i for i in self.recurrences.between(after=today, before=future_date, inc=True)] \ No newline at end of file + midnight_hawaii = datetime.combine(datetime.now(pytz.timezone('US/Hawaii')), datetime.min.time()) + future_date = midnight_hawaii + timedelta(**kwargs) + return [i for i in self.recurrences.between(after=midnight_hawaii, before=future_date, inc=True)] \ No newline at end of file diff --git a/core/static/js/sigo.js b/core/static/js/sigo.js index e42c59e..c77a13a 100644 --- a/core/static/js/sigo.js +++ b/core/static/js/sigo.js @@ -87,6 +87,7 @@ var sigo = function(){ self.lookup = new XMLHttpRequest(); self.lookup.open('GET', self.endpoint + '?search=' + encodeURIComponent(self.getElementById(self.input).value)); + self.lookup.setRequestHeader('Accept', 'application/json'); self.lookup.send(null); self.lookup.onreadystatechange = function(){ var DONE = 4, OK = 200; diff --git a/core/static/recurrence/js/recurrence.js b/core/static/recurrence/js/recurrence.js index c844a03..382dd0f 100644 --- a/core/static/recurrence/js/recurrence.js +++ b/core/static/recurrence/js/recurrence.js @@ -515,8 +515,9 @@ recurrence.DateFormat.prototype = { }, Z: function() { - var offset = this.data.getTimezoneOffset(); - return offset * 60; + // var offset = this.data.getTimezoneOffset(); + // return offset * 60; + return 0; } }; recurrence.DateFormat.formatchars = RegExp( @@ -564,10 +565,10 @@ recurrence.serialize = function(rule_or_recurrence) { }; return pad(dt.getUTCFullYear(), 4) + pad(dt.getUTCMonth() + 1, 2) + - pad(dt.getUTCDate(), 2) + 'T' + - pad(dt.getUTCHours(), 2) + - pad(dt.getUTCMinutes(), 2) + - pad(dt.getUTCSeconds(), 2) + 'Z'; + pad(dt.getUTCDate(), 2); //+ 'T' + + // pad(dt.getUTCHours(), 2) + + // pad(dt.getUTCMinutes(), 2) + + // pad(dt.getUTCSeconds(), 2); // + 'Z'; }; var serialize_rule = function(rule) { @@ -669,21 +670,21 @@ recurrence.deserialize = function(text) { var second = 0; } var dt = new Date(); - if (text.indexOf('Z') > 0) { - dt.setUTCFullYear(year); - dt.setUTCMonth(month - 1); - dt.setUTCDate(day); - dt.setUTCHours(hour); - dt.setUTCMinutes(minute); - dt.setUTCSeconds(second); - } else { + // if (text.indexOf('Z') > 0) { + // dt.setUTCFullYear(year); + // dt.setUTCMonth(month - 1); + // dt.setUTCDate(day); + // dt.setUTCHours(hour); + // dt.setUTCMinutes(minute); + // dt.setUTCSeconds(second); + // } else { dt.setFullYear(year); dt.setMonth(month - 1); dt.setDate(day); dt.setHours(hour); dt.setMinutes(minute); dt.setSeconds(second); - } + // } return dt; }; diff --git a/core/templates/base.html b/core/templates/base.html index ad17fa3..a708795 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -70,8 +70,14 @@
${event.venue.title}${event.venue.address}, ${event.venue.city}
` + } + + if(event.description){ + template += `${event.description}
` + } + + if(event.url){ + template += `` + } else { + template += `More info on Progressive Events
` + } + points.push(L.marker([event.venue.point.y, event.venue.point.x]) - .bindPopup(`{% spaceless %} -- {{ event.venue.title }}{{ event.venue.address }}, {{ event.venue.city }} -
- {% endif %} - {% if event.description %} -{{ event.description | linebreaksbr | safe }}
- {% endif %} -
- {% if event.url %}
- {{ event.url }}
- {% endif %}
- Jump to listing
-