Changeset 43:544f3cf6a4f0

Show
Ignore:
Timestamp:
08/31/08 16:07:55 (3 months ago)
Author:
Jeffrey Gelens <jeffrey@…>
Branch:
default
Message:

Upgraded source to work with Django Trunk (soon 1.0)

Files:
1 added
1 removed
9 modified

Legend:

Unmodified
Added
Removed
  • blog/admin.py

    r38 r43  
    1212        }) 
    1313    ) 
    14     list_display = ('title', 'pub_date', 'comments') 
     14    list_display = ('title', 'pub_date') 
    1515    list_filter = ('topic', 'pub_date') 
    1616    search_fields = ('title','body') 
  • blog/feeds.py

    r26 r43  
    55from blog.models import Article 
    66from django.contrib.contenttypes.models import ContentType 
    7 from django.contrib.comments.models import FreeComment 
     7from django.contrib.comments.models import Comment 
    88 
    99JST = tzinfo.FixedOffset(540) 
     
    6060    def items(self): 
    6161        article_type = ContentType.objects.get(app_label="blog", model="article") 
    62         comments = FreeComment.objects \ 
     62        comments = Comment.objects \ 
    6363                .filter(content_type=article_type, is_public=True) \ 
    6464                .order_by("-submit_date")[:10] 
  • blog/models.py

    r38 r43  
    1111 
    1212class Link(models.Model): 
    13     name = models.CharField(max_length=50, core=True) 
     13    name = models.CharField(max_length=50) 
    1414    url = models.URLField() 
    1515    kind = models.CharField(max_length=1, choices=LINK_CHOICES) 
     
    3535        get_latest_by = 'pub_date' 
    3636 
    37     def comments(self): 
    38         from django.contrib.contenttypes.models import ContentType 
    39         from django.contrib.comments.models import FreeComment 
    40         from django.utils.html import escape 
     37    #def comments(self): 
     38    #    from django.contrib.contenttypes.models import ContentType 
     39    #    from django.contrib.comments.models import Comment 
     40    #    from django.utils.html import escape 
    4141 
    42         content_type = ContentType.objects.get(app_label__exact="blog",model__exact="article") 
    43         comments = FreeComment.objects.filter(content_type__exact=content_type.id, object_id__exact=self.id) 
    44         links = [] 
     42    #    content_type = ContentType.objects.get(app_label__exact="blog",model__exact="article") 
     43    #    comments = Comment.objects.filter(content_type__exact=content_type.id, object_id__exact=self.id) 
     44    #    links = [] 
    4545 
    46         for comment in comments: 
    47             if len(links) > 4: 
    48                 break 
    49             else: 
    50                 links.append('<a href="/admin/comments/freecomment/%s">%s</a>' % \ 
    51                         (comment.id, escape(comment.person_name))) 
     46    #    for comment in comments: 
     47    #        if len(links) > 4: 
     48    #            break 
     49    #        else: 
     50    #            links.append('<a href="/admin/comments/freecomment/%s">%s</a>' % \ 
     51    #                    (comment.id, escape(comment.person_name))) 
    5252 
    53         return '<br />'.join(links) 
    54     comments.allow_tags = True 
     53    #    return '<br />'.join(links) 
     54    #comments.allow_tags = True 
    5555 
    5656    def comments_open(self): 
  • blog/signals.py

    r38 r43  
    11from django.conf import settings 
    22from django.db.models import signals 
    3 from django.contrib.comments.models import FreeComment 
     3from django.contrib.comments.models import Comment 
    44from django.contrib.sites.models import Site 
    55from django.contrib.flatpages.models import FlatPage 
     
    4646                    instance.is_public = False 
    4747 
    48 signals.post_save.connect(moderate_comments, sender=FreeComment) 
     48signals.post_save.connect(moderate_comments, sender=Comment) 
  • blog/templatetags/semi_static.py

    r20 r43  
    11from django import template 
    22from blog.models import Link 
    3 from django.contrib.comments.models import FreeComment 
     3from django.contrib.comments.models import Comment 
    44from django.contrib.contenttypes.models import ContentType 
    55 
     
    1414def latest_comments(): 
    1515    article_type = ContentType.objects.get(app_label="blog", model="article") 
    16     latest_comments = FreeComment.objects \ 
     16    latest_comments = Comment.objects \ 
    1717        .filter(content_type=article_type, is_public=True) \ 
    1818        .order_by("-submit_date")[:5] 
  • templates/blog/archive_month.html

    r25 r43  
    88  <h1 style="text-align: left;">{{ month|date:"F y" }} Archives</h1> 
    99  {% for article in articles %} 
    10   {% get_free_comment_count for blog.article article.id as comment_count %} 
     10  {% get_comment_count for blog.article article.id as comment_count %} 
    1111  <div class="article-head"><h2><a href="{{ article.get_absolute_url }}">{{ article.title }}</a></h2></div> 
    1212  <div class="article-date">  
  • templates/blog/index.html

    r38 r43  
    3030    <hr /> 
    3131{% for article in articles  %} 
    32   {% get_free_comment_count for blog.article article.id as comment_count %} 
     32  {% get_comment_count for blog.article article.id as comment_count %} 
    3333  <div class="hentry article"> 
    3434    <abbr class="published" title="{{ article.pub_date|date:"Y-m-d\Th:i:sO" }}">{{ article.pub_date|naturalday|capfirst }}, </abbr> 
  • templates/blog/single_article.html

    r38 r43  
    2424  </div> 
    2525 
    26   {% get_free_comment_list for blog.article article.id as comment_list %} 
     26  {% get_comment_list for blog.article article.id as comment_list %} 
    2727 
    2828  <div class="article"> 
    2929    {% for comment in comment_list %} 
    3030      {% if comment.is_public %} 
    31       <h2 class="comment-title" id="c{{ comment.id }}">{{ comment.person_name }}</h2> 
     31      <h2 class="comment-title" id="c{{ comment.id }}">{{ comment.name }}</h2> 
    3232      <span class="comment-published">said {{ comment.submit_date|naturalday }}:</span> 
    3333      {{ comment.comment|textile }} 
     
    4343      </div> 
    4444      <br /><br /> 
    45     {% free_comment_form for blog.article article.id %} 
     45    {% render_comment_form for blog.article article.id %} 
    4646    {% endif %} 
    4747  </div> 
  • urls.py

    r37 r43  
    66urlpatterns = patterns('', 
    77    (r'^admin/(.*)', admin.site.root), 
    8     (r'^comments/', include('django.contrib.comments.urls.comments')),     
     8    (r'^comments/', include('django.contrib.comments.urls')),     
    99    (r'^', include('blog.urls')), 
    1010)