Changeset 746
- Timestamp:
- 05/07/07 18:29:30 (1 year ago)
- Files:
-
- cherokee-www/trunk/cherokee/blog/models.py (modified) (2 diffs)
- cherokee-www/trunk/cherokee/blog/sitemaps.py (modified) (1 diff)
- cherokee-www/trunk/cherokee/blog/templates/blog/comment_list.html (added)
- cherokee-www/trunk/cherokee/blog/templates/blog/post_archive.html (modified) (1 diff)
- cherokee-www/trunk/cherokee/blog/templatetags (added)
- cherokee-www/trunk/cherokee/blog/templatetags/__init__.py (added)
- cherokee-www/trunk/cherokee/blog/templatetags/text.py (added)
- cherokee-www/trunk/cherokee/blog/urls.py (modified) (2 diffs)
- cherokee-www/trunk/cherokee/blog/utils (added)
- cherokee-www/trunk/cherokee/blog/utils/BeautifulSoup.py (added)
- cherokee-www/trunk/cherokee/blog/utils/__init__.py (added)
- cherokee-www/trunk/cherokee/media/css/blog.css (added)
- cherokee-www/trunk/cherokee/media/css/global.css (modified) (1 diff)
- cherokee-www/trunk/cherokee/media/js/blog.js (added)
- cherokee-www/trunk/cherokee/media/js/jquery.js (added)
- cherokee-www/trunk/cherokee/media/js/plugins (added)
- cherokee-www/trunk/cherokee/media/js/plugins/jquery.block.js (added)
- cherokee-www/trunk/cherokee/settings.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee-www/trunk/cherokee/blog/models.py
r734 r746 8 8 class Post(models.Model): 9 9 author = models.ForeignKey(User, verbose_name=_('Author')) 10 title = models.CharField(_('Title'), maxlength=100)11 slug = models.SlugField(_('Slug'), prepopulate_from=(' title',))10 headline = models.CharField(_('Headline'), maxlength=100) 11 slug = models.SlugField(_('Slug'), prepopulate_from=('headline',)) 12 12 body = models.TextField(_('Body')) 13 p osted_date = models.DateTimeField(_('Date Posted'), default=datetime.now)13 pub_date = models.DateTimeField(_('Date Posted'), default=datetime.now) 14 14 is_active = models.BooleanField(_('Is Active')) 15 15 … … 17 17 verbose_name = _('post') 18 18 verbose_name_plural = _('posts') 19 ordering = ('-p osted_date',)20 get_latest_by = 'p osted_date'19 ordering = ('-pub_date',) 20 get_latest_by = 'pub_date' 21 21 22 22 class Admin: 23 list_display = (' title', 'posted_date', 'is_active',)23 list_display = ('headline', 'pub_date', 'is_active',) 24 24 25 25 def __str__(self): 26 return self. title26 return self.headline 27 27 28 28 def get_absolute_url(self): 29 return '/blog/%s/%s/' % (self.p osted_date.strftime('%Y/%b/%d').lower(), self.slug)29 return '/blog/%s/%s/' % (self.pub_date.strftime('%Y/%b/%d').lower(), self.slug) cherokee-www/trunk/cherokee/blog/sitemaps.py
r734 r746 9 9 10 10 def items(self): 11 return Post.objects.filter(p osted_date__lte=datetime.now())11 return Post.objects.filter(pub_date__lte=datetime.now()) cherokee-www/trunk/cherokee/blog/templates/blog/post_archive.html
r735 r746 1 1 {% extends "base.html" %} 2 {% load text comments %} 3 4 {% block extrahead %} 5 <link href="/media/css/blog.css" type="text/css" rel="stylesheet" /> 6 <script src="/media/js/jquery.js" type="text/javascript"></script> 7 <script src="/media/js/plugins/jquery.block.js" type="text/javascript"></script> 8 <script src="/media/js/blog.js" type="text/javascript"></script> 9 {% endblock %} 2 10 3 11 {% block content %} 4 12 {% for post in latest %} 5 <h2>{{ post.title }}</h2> 6 <p>{{ post.body }}</p> 13 {% get_free_comment_count for blog.post post.id as comment_count %} 14 <div id="post_{{ post.id }}" class="post"> 15 <div class="post_date"> 16 <p class="month">{{ post.pub_date|date:"M" }}</p> 17 <p class="day">{{ post.pub_date|date:"d" }}</p> 18 <p class="year">{{ post.pub_date|date:"Y" }}</p> 19 </div> 20 <div class="post_detail"> 21 <h2><a href="{{ post.get_absolute_url }}">{{ post.headline }}</a></h2> 22 23 <p>{{ post.body|markdown_and_pygments }}</p> 24 25 <ul class="post_info_line"> 26 <li><a href="#" onclick="show_comments(this, {{ post.id }}, '{{ comment_count }} comment{{ comment_count|pluralize }}', 'hide comment{{ comment_count|pluralize }}'); return false;">{{ comment_count }} comment{{ comment_count|pluralize }}</a></li> 27 <li><a href="#" onclick="show_add_comment({{ post.id }}); return false;">say something</a></li> 28 <li><a href="#" onclick="digg_this('{{ post_headline }}', '{{ post.get_absolute_url }}'); return false;" id="digg_this">digg this</a></li> 29 <li><a href="http://del.icio.us/post" onclick="delicious_bookmark('{{ post.headline }}', '{{ post.get_absolute_url }}'); return false;" id="delicious">save this</a></li> 30 </ul> 31 32 <br class="clear" /> 33 34 <div id="add_comment_for_{{ post.id }}" class="add_comment" style="display: none;"> 35 <form method="POST" action=""> 36 <ol> 37 <li> 38 <label for="id_person_name">Your Name</label> 39 <input type="text" name="person_name" id="id_person_name" /> 40 </li> 41 <li> 42 <label for="id_comment">Comment</label> 43 <textarea name="comment" id="id_comment" rows="10" cols="60"></textarea> 44 </li> 45 </ol> 46 <p><input type="submit" value="Post" /></p> 47 </form> 48 </div> 49 50 <div id="comments_for_{{ post.id }}" class="comments" style="display: none;"></div> 51 52 </div> 53 54 <br class="clear" /> 55 <br class="clear" /> 56 57 </div> 58 7 59 {% endfor %} 8 60 {% endblock %} cherokee-www/trunk/cherokee/blog/urls.py
r734 r746 1 1 2 2 from django.conf.urls.defaults import * 3 from django.views.generic.simple import direct_to_template 4 3 5 from models import Post 4 6 5 7 info_dict = { 6 8 'queryset': Post.objects.filter(is_active=True), 7 'date_field': 'p osted_date',9 'date_field': 'pub_date', 8 10 } 9 11 … … 16 18 (r'^/?$', 'archive_index', info_dict), 17 19 ) 20 21 urlpatterns += patterns('', 22 (r'^comment_list/(?P<id>\d+)/$', direct_to_template, {'template': 'blog/comment_list.html'}), 23 ) cherokee-www/trunk/cherokee/media/css/global.css
r735 r746 24 24 font-size: 11px; 25 25 } 26 27 .clear { 28 clear: both; 29 } cherokee-www/trunk/cherokee/settings.py
r741 r746 52 52 TEMPLATE_CONTEXT_PROCESSORS = ( 53 53 'django.core.context_processors.i18n', 54 'django.core.context_processors.auth', 54 55 ) 55 56 … … 65 66 'django.contrib.admin', 66 67 'django.contrib.sitemaps', 68 'django.contrib.comments', 67 69 'django.contrib.markup', 68 70