mirror of https://github.com/scrapy/scrapy.git
Remove blog application which is not django 1.0
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40264
This commit is contained in:
parent
4d388c946e
commit
bd28045b99
|
|
@ -1,14 +0,0 @@
|
|||
from django.contrib.syndication.feeds import Feed
|
||||
from django_website.apps.blog.models import Entry
|
||||
import datetime
|
||||
|
||||
class WeblogEntryFeed(Feed):
|
||||
title = "The Django weblog"
|
||||
link = "http://www.djangoproject.com/weblog/"
|
||||
description = "Latest news about Django, the Python Web framework."
|
||||
|
||||
def items(self):
|
||||
return Entry.objects.filter(pub_date__lte=datetime.datetime.now())[:10]
|
||||
|
||||
def item_pubdate(self, item):
|
||||
return item.pub_date
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import datetime
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Entry(models.Model):
|
||||
pub_date = models.DateTimeField()
|
||||
slug = models.SlugField(unique_for_date='pub_date')
|
||||
headline = models.CharField(max_length=200)
|
||||
summary = models.TextField(help_text="Use raw HTML.")
|
||||
body = models.TextField(help_text="Use raw HTML.")
|
||||
author = models.CharField(max_length=100)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = 'entries'
|
||||
ordering = ('-pub_date',)
|
||||
get_latest_by = 'pub_date'
|
||||
|
||||
class Admin:
|
||||
list_display = ('pub_date', 'headline', 'author')
|
||||
|
||||
def __unicode__(self):
|
||||
return self.headline
|
||||
|
||||
def get_absolute_url(self):
|
||||
return "/weblog/%s/%s/" % (self.pub_date.strftime("%Y/%b/%d").lower(), self.slug)
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
import datetime
|
||||
|
||||
from django import template
|
||||
|
||||
from scrapyorg.blog.models import Entry
|
||||
|
||||
|
||||
class LatestBlogEntriesNode(template.Node):
|
||||
def __init__(self, num, varname):
|
||||
self.num, self.varname = num, varname
|
||||
|
||||
def render(self, context):
|
||||
context[self.varname] = list(Entry.objects.filter(pub_date__lte=datetime.datetime.now())[:self.num])
|
||||
return ''
|
||||
|
||||
def do_get_latest_blog_entries(parser, token):
|
||||
"""
|
||||
{% get_latest_blog_entries 2 as latest_entries %}
|
||||
"""
|
||||
bits = token.contents.split()
|
||||
if len(bits) != 4:
|
||||
raise template.TemplateSyntaxError, "'%s' tag takes three arguments" % bits[0]
|
||||
if bits[2] != 'as':
|
||||
raise template.TemplateSyntaxError, "First argument to '%s' tag must be 'as'" % bits[0]
|
||||
return LatestBlogEntriesNode(bits[1], bits[3])
|
||||
|
||||
register = template.Library()
|
||||
register.tag('get_latest_blog_entries', do_get_latest_blog_entries)
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from scrapyorg.blog.models import Entry # relative import
|
||||
|
||||
info_dict = {
|
||||
'queryset': Entry.objects.all(),
|
||||
'date_field': 'pub_date',
|
||||
}
|
||||
|
||||
urlpatterns = patterns('django.views.generic.date_based',
|
||||
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\w-]+)/$', 'object_detail', dict(info_dict, slug_field='slug')),
|
||||
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'archive_day', info_dict),
|
||||
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', info_dict),
|
||||
(r'^(?P<year>\d{4})/$', 'archive_year', info_dict),
|
||||
(r'^/?$', 'archive_index', info_dict),
|
||||
)
|
||||
Loading…
Reference in New Issue