community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r1692976 - in /comdev/tools/events_list: models.py templates/events/index.html templates/events/view.html urls.py views.py
Date Tue, 28 Jul 2015 01:26:33 GMT
Author: rgardler
Date: Tue Jul 28 01:26:32 2015
New Revision: 1692976

URL: http://svn.apache.org/r1692976
Log:
add a very basic event details screen

Added:
    comdev/tools/events_list/templates/events/view.html
Modified:
    comdev/tools/events_list/models.py
    comdev/tools/events_list/templates/events/index.html
    comdev/tools/events_list/urls.py
    comdev/tools/events_list/views.py

Modified: comdev/tools/events_list/models.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/models.py?rev=1692976&r1=1692975&r2=1692976&view=diff
==============================================================================
--- comdev/tools/events_list/models.py (original)
+++ comdev/tools/events_list/models.py Tue Jul 28 01:26:32 2015
@@ -1,4 +1,4 @@
-from datetime import datetime
+from datetime import datetime, timedelta
 from django.db import models
 
 class Group(models.Model):
@@ -48,6 +48,12 @@ class Event(models.Model):
     @property
     def date_sort(self):
         return self.local_start.strftime("%Y%m%d%H%M")
+
+    @property
+    def utc_start(self):
+        td = timedelta(seconds = self.utc_offset)
+        return self.local_start + td
+
     
     def __str__(self):
         return u'{n}, {d}'.format(n=self.name, d=self.local_start)

Modified: comdev/tools/events_list/templates/events/index.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/events/index.html?rev=1692976&r1=1692975&r2=1692976&view=diff
==============================================================================
--- comdev/tools/events_list/templates/events/index.html (original)
+++ comdev/tools/events_list/templates/events/index.html Tue Jul 28 01:26:32 2015
@@ -33,7 +33,7 @@
   <tbody>
     {% for event in upcoming_events_list %}
     <tr>
-      <td><a href="{{ event.event_url }}" target="_blank">{{ event.name }}</a></td>
+      <td><a href="{% url 'viewEvent' event.id %}" target="_blank">{{ event.name
}}</a></td>
       <td>{{ event.group.city }}, {{ event.group.state }}</td>
       <td>{{ event.group.country }}</td>
       <td>

Added: comdev/tools/events_list/templates/events/view.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/events/view.html?rev=1692976&view=auto
==============================================================================
--- comdev/tools/events_list/templates/events/view.html (added)
+++ comdev/tools/events_list/templates/events/view.html Tue Jul 28 01:26:32 2015
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>{{ event.name }}</title>
+</head>
+<body>
+  <h1>{{ event.name }}</h1>
+  <p>{{ event.group.city }}, {{ event.group.state }}, {{event.group.country }}</p>
+
+  {{ event.description | safe }}
+
+  <p>Start Time: {{ event.local_start }} (UTC start: {{ event.utc_start }})</p>
+
+  <p>
+  <a href="{{ event.event_url }}" title="{{ event.tweet }}" class="_hs_socialshare">Share</a>
+  <script>
+    var _hs = {
+               size: 5,
+               partner: "rgardler.github.io"
+    };
+    (function() {
+                 var h = document.createElement('script'); h.type = 'text/javascript'; h.async
= true;
+                 h.src = ('https:' == document.location.protocol ? 'https://' : 'http://')
+ 'dtirydke3kdq7.cloudfront.net/hootlet.js?v=1';
+                 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(h,
s);
+    })();
+  </script>
+  </p>  
+
+  <p>Hashtags: 
+	{% for hashtag in event.hashtags.all %}
+	  {{ hashtag.name }},
+	{% endfor %}
+  </p>
+
+  <p>Organized by: {{ event.group.name }}</p>
+
+  <p><a href="{{ event.event_url }}" target="_blank">Source</a></p>
+
+  <p>Applicable: {{ event.is_applicable }} <a href="{% url 'toggleNA' event.id %}">Toggle
N/A</a></p>
+</body>
+</html>

Modified: comdev/tools/events_list/urls.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/urls.py?rev=1692976&r1=1692975&r2=1692976&view=diff
==============================================================================
--- comdev/tools/events_list/urls.py (original)
+++ comdev/tools/events_list/urls.py Tue Jul 28 01:26:32 2015
@@ -4,6 +4,7 @@ from . import views
 
 urlpatterns = [
     url(r'^$', views.index, name='index'),
+    url(r'^(?P<event_id>[0-9]+)/$', views.viewEvent, name='viewEvent'),
     url(r'^(?P<event_id>[0-9]+)/toggleNA/$', views.toggleNA, name='toggleNA'),
     url(r'^importMeetups/$', views.importMeetups, name='importMeetups'),
 ]

Modified: comdev/tools/events_list/views.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/views.py?rev=1692976&r1=1692975&r2=1692976&view=diff
==============================================================================
--- comdev/tools/events_list/views.py (original)
+++ comdev/tools/events_list/views.py Tue Jul 28 01:26:32 2015
@@ -28,6 +28,15 @@ def index(request):
     })
     return HttpResponse(template.render(context))
 
+def viewEvent(request, event_id):
+    event = get_object_or_404(Event, pk = event_id)
+
+    template = loader.get_template('events/view.html')
+    context = RequestContext(request, {
+                             'event': event
+    })
+    return HttpResponse(template.render(context))
+    
 def toggleNA(request, event_id):
     # toggle the is_applicable field on a given record
     event = get_object_or_404(Event, pk = event_id)
@@ -46,7 +55,7 @@ def toggleNA(request, event_id):
     log.save()
 
     return redirect('events_list.views.index')
-    
+
 def importMeetups(request):
     # Import latest meetups from meetup.com, if we didn't import them within the last hour
     log = Log()



Mime
View raw message