community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r1693192 - in /comdev/tools/events_list: admin.py models.py static/ static/default.css templates/include/head.html templates/people/view.html views.py
Date Wed, 29 Jul 2015 07:23:10 GMT
Author: rgardler
Date: Wed Jul 29 07:23:09 2015
New Revision: 1693192

URL: http://svn.apache.org/r1693192
Log:
pull in more member data (including adding topics table) and display it on the people view
page

Added:
    comdev/tools/events_list/static/
    comdev/tools/events_list/static/default.css
Modified:
    comdev/tools/events_list/admin.py
    comdev/tools/events_list/models.py
    comdev/tools/events_list/templates/include/head.html
    comdev/tools/events_list/templates/people/view.html
    comdev/tools/events_list/views.py

Modified: comdev/tools/events_list/admin.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/admin.py?rev=1693192&r1=1693191&r2=1693192&view=diff
==============================================================================
--- comdev/tools/events_list/admin.py (original)
+++ comdev/tools/events_list/admin.py Wed Jul 29 07:23:09 2015
@@ -1,10 +1,11 @@
 from django.contrib import admin
-from .models import Event, Group, Hashtag, Log, Person
+from .models import Event, Group, Hashtag, Log, Person, Topic
 
 admin.site.register(Event)
 admin.site.register(Group)
 admin.site.register(Hashtag)
 admin.site.register(Person)
+admin.site.register(Topic)
 
 admin.site.register(Log)
 

Modified: comdev/tools/events_list/models.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/models.py?rev=1693192&r1=1693191&r2=1693192&view=diff
==============================================================================
--- comdev/tools/events_list/models.py (original)
+++ comdev/tools/events_list/models.py Wed Jul 29 07:23:09 2015
@@ -1,6 +1,17 @@
 from datetime import datetime, timedelta
 from django.db import models
 
+class Topic(models.Model):
+    name = models.CharField(max_length=200)
+    urlkey = models.CharField(max_length=50)
+    meetupID = models.BigIntegerField(verbose_name = "Meetups.com ID", unique=True)
+
+    def __str__(self):
+        return self.name
+
+    def __unicode__(self):
+        return unicode(self.name)
+
 class Group(models.Model):
     name = models.CharField(max_length=200)
     city = models.CharField(max_length=50)
@@ -26,12 +37,19 @@ class Hashtag(models.Model):
 
 class Person(models.Model):
     name = models.CharField(max_length = 50)
+    bio = models.TextField()
     country = models.CharField(max_length = 2)
     state = models.CharField(max_length = 2)
     city = models.CharField(max_length = 30)
-    url = models.URLField(default="")
+    latitude = models.DecimalField(max_digits=10, decimal_places=6)
+    longitude = models.DecimalField(max_digits=10, decimal_places=6)
+    url = models.URLField()
+    largePhoto = models.URLField()
+    photo = models.URLField()
+    thumbnail = models.URLField()
     lastVisit = models.DateTimeField()
     groups = models.ManyToManyField(Group, related_name="members")
+    topics = models.ManyToManyField(Topic, related_name="people")
     meetupID =  models.BigIntegerField(verbose_name = "Meetups.com ID", unique=True)
 
     def __str__(self):

Added: comdev/tools/events_list/static/default.css
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/static/default.css?rev=1693192&view=auto
==============================================================================
--- comdev/tools/events_list/static/default.css (added)
+++ comdev/tools/events_list/static/default.css Wed Jul 29 07:23:09 2015
@@ -0,0 +1,3 @@
+.right {
+    float: right;
+}
\ No newline at end of file

Modified: comdev/tools/events_list/templates/include/head.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/include/head.html?rev=1693192&r1=1693191&r2=1693192&view=diff
==============================================================================
--- comdev/tools/events_list/templates/include/head.html (original)
+++ comdev/tools/events_list/templates/include/head.html Wed Jul 29 07:23:09 2015
@@ -1,6 +1,8 @@
+{% load staticfiles %}
 <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
 <script type="text/javascript" src="http://cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>
 <script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
 
 <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"></link>
 
 <link rel="stylesheet" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css"></link>
+<link rel="stylesheet" href="{% static 'default.css' %}"></link>

Modified: comdev/tools/events_list/templates/people/view.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/people/view.html?rev=1693192&r1=1693191&r2=1693192&view=diff
==============================================================================
--- comdev/tools/events_list/templates/people/view.html (original)
+++ comdev/tools/events_list/templates/people/view.html Wed Jul 29 07:23:09 2015
@@ -8,11 +8,25 @@
   {% include "include/navbar.html" %}
 
   <h1>{{ person.name }}</h1>
-  <p>{{ person.city }}, {{ person.state }}, {{ person.country }}</p>
+  <p><span class="right"><img src="{{ person.photo }}"></img></span>
{{ person.bio }}</p>
 
-  <p>
-  <a href="{{ person.url }}">Source</a>
-  </p>  
+  <p>{{ person.city }}, {{ person.state }}, {{ person.country }} ({{ person.latitude
}}, {{ person.longitude }})</p>
+
+  <p><a href="{{ person.url }}">Source</a></p>
+
+  <h2>Topics</h2>
+  <ul>
+    {% for topic in person.topics.all %}
+      <li>{{ topic }}</li>
+    {% endfor %}
+  </ul>
+
+  <h2>Groups</h2>
+  <ul>
+    {% for group in person.groups.all %}
+      <li>{{ group }}</li>
+    {% endfor %}
+  </ul>
 
   <p>Last Active: {{ person.lastVisit }}</p>
 </body>

Modified: comdev/tools/events_list/views.py
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/views.py?rev=1693192&r1=1693191&r2=1693192&view=diff
==============================================================================
--- comdev/tools/events_list/views.py (original)
+++ comdev/tools/events_list/views.py Wed Jul 29 07:23:09 2015
@@ -2,7 +2,7 @@ from django.conf import settings
 from django.shortcuts import get_object_or_404, render, redirect
 from django.http import HttpResponse
 from django.template import RequestContext, loader
-from events_list.models import Event, Group, Hashtag, Log, Person
+from events_list.models import Event, Group, Hashtag, Log, Person, Topic
 from datetime import datetime, timedelta
 import json
 import logging
@@ -15,7 +15,6 @@ import sys
 # FIXME: make this a configuration value
 MEETUP_API_KEY = "3a7711454d145e404e531c2ee6f391d"
 
-
 logger = logging.getLogger(__name__)
 
 def index(request):
@@ -149,13 +148,40 @@ def importMembers(request, group_id):
             person.meetupID = member['id']
             person.name = member['name']
             person.country = member['country']
-            person.state = member['state']
+            if 'state' in member.keys():
+                person.state = member['state']
             person.city = member['city']
+            if 'lon' in member.keys():
+                person.longitude = member['lon']
+            if 'lat' in member.keys():
+                person.latitude = member['lat']                
             person.url = member['link']
+            if 'bio' in member.keys():
+                person.bio = member['bio']
             visited = float(str(member['visited'])[0:-3])
             person.lastVisit = datetime.utcfromtimestamp(visited)
+            if 'photo' in member.keys():
+                if 'highres_link' in member['photo'].keys():
+                    person.largePhoto = member['photo']['highres_link']
+                if 'photo_link' in member['photo'].keys():
+                    person.photo = member['photo']['photo_link']
+                if 'thumb_link' in member['photo'].keys():
+                    person.thumbnail = member['photo']['thumb_link']
             person.save()
 
+            if 'topics' in member.keys():
+                for topic in member['topics']:
+                    try:
+                        record = Topic.objects.get(meetupID = topic['id'])
+                    except Topic.DoesNotExist:
+                        record = Topic()
+                    record.urlkey = topic['urlkey']
+                    record.name = topic['name']
+                    record.meetupID = topic['id']
+                    record.save()
+                    person.topics.add(record)
+            
+
             person.groups.add(group)
             person.save()
         except:



Mime
View raw message