Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added blog app to django_website

git-svn-id: http://code.djangoproject.com/svn/djangoproject.com@13 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 992712bec0df7b9f22f261090f252e679a9fd1b1 1 parent 285f7ae
adrian authored
View
0  django_website/apps/blog/__init__.py
No changes.
View
1  django_website/apps/blog/models/__init__.py
@@ -0,0 +1 @@
+__all__ = ['blog']
View
25 django_website/apps/blog/models/blog.py
@@ -0,0 +1,25 @@
+from django.core import meta
+
+class Entry(meta.Model):
+ verbose_name_plural = 'entries'
+ module_name = 'entries'
+ db_table = 'new_blog_entries'
+ fields = (
+ meta.DateTimeField('pub_date', 'publication date'),
+ meta.SlugField('slug', 'slug', unique_for_date='pub_date'),
+ meta.CharField('headline', 'headline', maxlength=200),
+ meta.TextField('body', 'body', help_text="Use raw HTML."),
+ )
+ ordering = (('pub_date', 'DESC'),)
+ admin = meta.Admin(
+ fields = (
+ (None, {'fields': ('pub_date', 'slug', 'headline', 'body')}),
+ ),
+ list_display = ('pub_date', 'headline'),
+ )
+
+ def __repr__(self):
+ return self.headline
+
+ def get_absolute_url(self):
+ return "/weblog/%s/%s/" % (self.pub_date.strftime("%Y/%b/%d"), self.slug)
View
0  django_website/apps/blog/urls/__init__.py
No changes.
View
15 django_website/apps/blog/urls/blog.py
@@ -0,0 +1,15 @@
+from django.conf.urls.defaults import *
+
+info_dict = {
+ 'app_label': 'blog',
+ 'module_name': 'entries',
+ 'date_field': 'pub_date',
+}
+
+urlpatterns = patterns('django.views.generic.date_based',
+ (r'(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\w{2})/(?P<slug>\w+)/', 'object_detail', dict(info_dict, slug_field='slug')),
+ (r'(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\w{2})/', 'archive_day', info_dict),
+ (r'(?P<year>\d{4})/(?P<month>\w{3})/', 'archive_month', info_dict),
+ (r'(?P<year>\d{4})/', 'archive_year', info_dict),
+ (r'/?', 'archive_index', info_dict),
+)
View
0  django_website/apps/blog/views/__init__.py
No changes.
View
1  django_website/settings/main.py
@@ -11,6 +11,7 @@
)
ROOT_URLCONF = 'django_website.settings.urls.main'
INSTALLED_APPS = (
+ 'django_website.apps.blog',
)
MEDIA_ROOT = "/home/html/djangoproject.com/m/"
MEDIA_URL = "http://www.djangoproject.com.com/m/"
Please sign in to comment.
Something went wrong with that request. Please try again.