Commits

yang xiaoyong committed 77eb9fe Draft

init press app

  • Participants
  • Parent commits 727f0bd

Comments (0)

Files changed (7)

File itj/itj/settings.py

     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.staticfiles',
-    # Uncomment the next line to enable the admin:
-    # 'django.contrib.admin',
-    # Uncomment the next line to enable admin documentation:
-    # 'django.contrib.admindocs',
+    'django.contrib.admin',
+
+    'press',
 )
 
 # A sample logging configuration. The only tangible logging

File itj/itj/urls.py

+# -*- encoding:utf-8 -*-
+
 from django.conf.urls import patterns, include, url
+from django.contrib import admin
 
-# Uncomment the next two lines to enable the admin:
-# from django.contrib import admin
-# admin.autodiscover()
+admin.autodiscover()
 
 urlpatterns = patterns('',
-    # Examples:
-    # url(r'^$', 'itj.views.home', name='home'),
-    # url(r'^itj/', include('itj.foo.urls')),
-
-    # Uncomment the admin/doc line below to enable admin documentation:
-    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
-
-    # Uncomment the next line to enable the admin:
-    # url(r'^admin/', include(admin.site.urls)),
+    url(r'^admin/', include(admin.site.urls)),
 )

File itj/press/__init__.py

Empty file added.

File itj/press/admin.py

+# -*- encoding:utf-8 -*-
+
+from django.contrib import admin
+from press.models import PressRelease
+
+admin.site.register(PressRelease)

File itj/press/models.py

+# -*- encoding:utf-8 -*-
+
+from django.db import models
+
+class PressRelease(models.Model):
+    title = models.CharField(max_length=100)
+    body = models.TextField()
+    pub_date = models.DateTimeField()
+    author = models.CharField(max_length=100)
+
+    def __unicode__(self):
+        return self.title

File itj/press/tests.py

+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+
+class SimpleTest(TestCase):
+    def test_basic_addition(self):
+        """
+        Tests that 1 + 1 always equals 2.
+        """
+        self.assertEqual(1 + 1, 2)

File itj/press/views.py

+# Create your views here.