Commits

Dan Carroll committed 8380f49

Fix up example project so that it displays activities

  • Participants
  • Parent commits 3f82379

Comments (0)

Files changed (4)

 
 *.pyc
 *.swp
+example.db
 

examples/activitydisplay/settings.py

 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.sqlite3',
-        'NAME': os.path.join(BASE_DIR, 'db'),
+        'NAME': os.path.join(BASE_DIR, 'example.db'),
         'USER': '',
         'PASSWORD': '',
         'HOST': '',
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.admin',
+    'activitysync',
 )
 
+ACTIVITYSYNC_PROVIDERS = (
+    'activitysync.providers.twitterprovider.TwitterProvider',
+    # 'activitysync.providers.googlereader.GoogleReaderProvider',
+    # 'activitysync.providers.redditprovider.RedditProvider',
+)
+
+TWITTER_USERNAME = 'twitter'
+# REDDIT_USERNAME = ''
+# GOOGLEREADER_SHARED_RSS = ''
+# GOOGLEREADER_PUBLIC_URL = ''
+

examples/activitydisplay/templates/index.html

+<html>
+<head>
+    <title>django-activitysync example</title>
+</head>
+<body>
+    {% load activitysync_extras %}
+    {% render_activities_with_date_headers activities %}
+</body>
+</html>
+

examples/activitydisplay/views.py

-from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+
 from activitysync.models import Activity
 
 def index(request):
-    return HttpResponse("Nice", status=200, mimetype='text/plain')
+    return render_to_response(
+        'index.html',
+        {'activities': Activity.objects.published()},
+        context_instance=RequestContext(request)
+    )