Commits

Dan Carroll  committed e8af955

Start to remove some traces of activity syncing from project and blog app

  • Participants
  • Parent commits 1503a47
  • Branches activitysync-separation

Comments (0)

Files changed (6)

File mysite/blog/admin.py

 # Blog application admin page
-from mysite.blog.models import Entry, Activity
+from mysite.blog.models import Entry
 from django.contrib import admin
 
 class EntryAdmin(admin.ModelAdmin):
     prepopulated_fields = {'slug': ('title',)}
 
 admin.site.register(Entry, EntryAdmin)
-
-class ActivityAdmin(admin.ModelAdmin):
-    list_display = ('source', 'title', 'link', 'pub_date', 'published', 'username', 'author', 'comments')
-    list_filter = ['pub_date', 'source', 'username']
-    search_fields = ['title', 'comments']
-    date_hierarchy = 'pub_date'
-
-admin.site.register(Activity, ActivityAdmin)

File mysite/blog/management/__init__.py

Empty file removed.

File mysite/blog/management/commands/__init__.py

Empty file removed.

File mysite/blog/models.py

         except Warning:
             pass # Usually a truncation warning
 
-
-class Activity(models.Model):
-    """Activity from social network (Twitter, Flickr, etc)."""
-    SOURCE_CHOICES = (
-        ('T', 'twitter'),
-        ('DG', 'digg'),
-        ('DL', 'delicious'),
-        ('FB', 'facebook'),
-        ('HU', 'hulu'),
-        ('RD', 'reddit'),
-        ('GR', 'googlereader'),
-    )
-    
-    title = models.CharField('title', max_length=200)
-    link = models.URLField(max_length=500)
-    source = models.CharField(max_length=2, choices=SOURCE_CHOICES)
-    username = models.CharField(max_length=20, blank=True)
-    author = models.CharField(max_length=20, blank=True)
-    comments = models.TextField(blank=True)
-    pub_date = models.DateTimeField('Date published')
-    published = models.BooleanField(default=True)
-    guid = models.CharField(max_length=255, unique=True, db_index=True)
-    objects = PublishedManager()
-    
-    class Meta:
-        verbose_name = 'activity'
-        verbose_name_plural = 'activities'
-        db_table = 'blog_activities'
-        ordering = ('-pub_date',)
-        get_latest_by = 'pub_date'
-    
-    def __unicode__(self):
-        return u'%s' % self.title
-
-    def get_activity_prefix(self):
-        if self.source == 'DG':
-            return u'Dugg '
-        elif self.source == 'DL':
-            return u'Bookmarked '
-        elif self.source == 'HU':
-            return u'Watched '
-        elif self.source == 'RD':
-            return u'Liked '
-        elif self.source == 'GR':
-            return u'Shared '
-        else:
-            return u''
-    
-    def get_network_link(self):
-        if self.source == 'T':
-            return u"http://twitter.com/erunama"
-        elif self.source == 'DG':
-            return u"http://digg.com/users/erunama"
-        elif self.source == 'DL':
-            return u"http://delicious.com/erunama"
-        elif self.source == 'FB':
-            return u"http://www.facebook.com/people/Dan-Carroll/401024"
-        elif self.source == 'HU':
-            return u"http://www.hulu.com/profiles/erunama/"
-        elif self.source == 'RD':
-            return u"http://www.reddit.com/user/erunama/"
-        elif self.source == 'GR':
-            return u"http://www.google.com/reader/shared/dancarroll"
-            

File mysite/urls.py

     url(r'^admin/', include(admin.site.urls)),
     
     # Main sections
-    url(r'^activity/$', view='mysite.views.activity', name='main_activity'),
+    url(r'^activity/$', view='activitysync.views.activity', name='main_activity'),
     url(r'^blog/', include('mysite.blog.urls')),
     
     # RSS feeds

File mysite/views.py

-from django.http import Http404
 from django.shortcuts import render_to_response
 from django.template import RequestContext
 
-from mysite.blog.models import Entry, Activity
-from mysite.blog.paginator import InfinitePaginator
+from mysite.blog.models import Entry
 from blog.views import blog_entry_detail
 
 def index(request):
                  'activities': Activity.objects.published()[:5] },
                 context_instance=RequestContext(request))
 
-def activity(request):
-    type = request.GET.get('type', '')
-    if type:
-        activity_list = Activity.objects.published().filter(source__exact=type)
-    else:
-        activity_list = Activity.objects.published().defer("username", "author", "comments", "guid")
-
-    # Make sure page request is an int.  If not, deliver first page.
-    try:
-        page = int(request.GET.get('page', '1'))
-    except ValueError:
-        page = 1
-    
-    paginator = InfinitePaginator(activity_list, 25)
-    try:
-        activities = paginator.page(page)
-    except:
-        raise Http404
-        
-    return render_to_response('activity.html',
-                activities.create_template_context(),
-                context_instance=RequestContext(request))