annotate ygroup/views.py @ 693:ad69236e8501

For issue #52, update many 3rd party Javascript libraries. Updated to jquery 1.10.2, jquery ui 1.10.3. This broke a lot of stuff. - Found a newer version of the jquery cycle all plugin (3.0.3). - Updated JPlayer to 2.4.0. - Updated to MarkItUp 1.1.14. This also required me to add multiline attributes set to true on various buttons in the markdown set. - As per a stackoverflow post, added some code to get multiline titles in a jQuery UI dialog. They removed that functionality but allow you to put it back. Tweaked the MarkItUp preview CSS to show blockquotes in italic. Did not update TinyMCE at this time. I'm not using the JQuery version and this version appears to work ok for now. What I should do is make a repo for MarkItUp and do a vendor branch thing so I don't have to futz around diffing directories to figure out if I'll lose changes when I update.
author Brian Neal <bgneal@gmail.com>
date Wed, 04 Sep 2013 19:55:20 -0500
parents ee87ea74d46b
children 5d208c3321ce
rev   line source
bgneal@323 1 """
bgneal@323 2 Views for the ygroup (Yahoo Group Archive) application.
bgneal@323 3
bgneal@323 4 """
bgneal@323 5 from django.shortcuts import get_object_or_404
bgneal@323 6 from django.views.generic import ListView
bgneal@323 7
bgneal@323 8 from ygroup.models import Thread, Post
bgneal@323 9 from core.paginator import DiggPaginator
bgneal@323 10
bgneal@323 11
bgneal@323 12 THREADS_PER_PAGE = 40
bgneal@323 13 POSTS_PER_PAGE = 20
bgneal@323 14
bgneal@323 15
bgneal@323 16 class ThreadIndexView(ListView):
bgneal@323 17 """
bgneal@323 18 This generic view displays the list of threads available.
bgneal@323 19
bgneal@323 20 """
bgneal@323 21 model = Thread
bgneal@323 22 paginate_by = THREADS_PER_PAGE
bgneal@323 23
bgneal@323 24 def get_paginator(self, queryset, per_page, **kwargs):
bgneal@323 25 """
bgneal@323 26 Return an instance of the paginator for this view.
bgneal@323 27 """
bgneal@323 28 return DiggPaginator(queryset, per_page, body=5, tail=2,
bgneal@323 29 margin=3, padding=2, **kwargs)
bgneal@323 30
bgneal@323 31
bgneal@323 32 class ThreadView(ListView):
bgneal@323 33 """
bgneal@323 34 This generic view displays the posts in a thread.
bgneal@323 35
bgneal@323 36 """
bgneal@323 37 context_object_name = "post_list"
bgneal@323 38 template_name = "ygroup/thread.html"
bgneal@323 39 paginate_by = POSTS_PER_PAGE
bgneal@323 40
bgneal@323 41 def get_queryset(self):
bgneal@323 42 self.thread = get_object_or_404(Thread, pk=self.args[0])
bgneal@323 43 return Post.objects.filter(thread=self.thread)
bgneal@323 44
bgneal@323 45 def get_context_data(self, **kwargs):
bgneal@323 46 context = super(ThreadView, self).get_context_data(**kwargs)
bgneal@323 47 context['thread'] = self.thread
bgneal@323 48 return context
bgneal@323 49
bgneal@323 50 def get_paginator(self, queryset, per_page, **kwargs):
bgneal@323 51 """
bgneal@323 52 Return an instance of the paginator for this view.
bgneal@323 53 """
bgneal@323 54 return DiggPaginator(queryset, per_page, body=5, tail=2,
bgneal@323 55 margin=3, padding=2, **kwargs)