Переглянути джерело

Adding recent meetups to template

David Leonard 10 роки тому
батько
коміт
4b93343106

+ 25 - 1
hackathon_starter/hackathon/templates/hackathon/meetup.html

@@ -18,7 +18,7 @@
             </thead>
             <tbody>
 
-            {% for key in data %}
+            {% for key in data.userData %}
                 <tr>
                     <td>{{ key.name }}</td>
                     <td>{{ key.state }}</td>
@@ -33,6 +33,30 @@
         </div>
     </div>
 
+    <div class="col-lg-12">
+        <div class="table-responsive">
+            <table class="table table-bordered table-hover table-striped tablesorter">
+                <thead>
+                <tr>
+                <th class="header"> Last Meetup Group <i class="icon-sort"></i></th>
+                <th class="header"> Name <i class="icon-sort"></i></th>
+                <th class="header"> Last Event Location <i class="icon-sort"></i></th>
+                </tr>
+            </thead>
+            <tbody>
+
+            {% for key in data.dashboardData %}
+                <tr>
+                    <td>{{ key.group }}</td>
+                    <td>{{ key.name }}</td>
+                    <td>{{ key.last_event.name}}</td>
+    			</tr>
+            {% endfor %}
+
+            </tbody>
+            </table>
+        </div>
+    </div>
     
 
 </body>

+ 4 - 1
hackathon_starter/hackathon/views.py

@@ -161,10 +161,13 @@ def meetupToken(request):
 
 def meetupUser(request):
     access_token = MeetupToken.objects.all()[0]
+    meetupData = {}
     userData = retrieveUserData('https://api.meetup.com/2/member/self/?access_token=' + str(access_token))
+    meetupData['userData'] = userData
     dashboardData = retrieveDashboard('https://api.meetup.com/dashboard?access_token=' + str(access_token))
+    meetupData['dashboardData'] = dashboardData
     print dashboardData
-    return render(request, 'hackathon/meetup.html', { 'data': userData })
+    return render(request, 'hackathon/meetup.html', { 'data': meetupData })
 
 #################
 #   QUANDL API  #