Commits

Philippe Marichal committed cad47a2

First version of tumblelog

  • Participants

Comments (0)

Files changed (7)

+syntax: glob
+*.pyc
+.DS_Store
+.svn

__init__.py

Empty file added.

migrations/0001_initial.py

+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+    
+    def forwards(self, orm):
+        
+        # Adding model 'StreamItem'
+        db.create_table('tumblelog_streamitem', (
+            ('pub_date', self.gf('django.db.models.fields.DateTimeField')()),
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])),
+            ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()),
+        ))
+        db.send_create_signal('tumblelog', ['StreamItem'])
+    
+    
+    def backwards(self, orm):
+        
+        # Deleting model 'StreamItem'
+        db.delete_table('tumblelog_streamitem')
+    
+    
+    models = {
+        'contenttypes.contenttype': {
+            'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'tumblelog.streamitem': {
+            'Meta': {'object_name': 'StreamItem'},
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
+            'pub_date': ('django.db.models.fields.DateTimeField', [], {})
+        }
+    }
+    
+    complete_apps = ['tumblelog']

migrations/__init__.py

Empty file added.
+from django.db import models
+from django.contrib.contenttypes import generic
+from django.template.loader import render_to_string
+from django.contrib.contenttypes.models import ContentType
+
+class StreamItem(models.Model):
+	content_type = models.ForeignKey(ContentType)
+	object_id = models.PositiveIntegerField()
+	pub_date = models.DateTimeField()
+	
+	content_object = generic.GenericForeignKey('content_type', 'object_id')
+
+	def get_rendered_html(self):
+		template_name = 'tumble/stream_item_%s.html' % (self.content_type.name)
+		return render_to_string(template_name, { 'object': self.content_object })
+        
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these 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.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
+# Create your views here.