677d5ff5c56e

Pretty much done with the photo blog.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 15 Feb 2009 00:34:21 -0500
parents 91f05965e207
children 40477baa92d8
branches/tags (none)
files photoblog/models.py photoblog/specs.py rss/feeds.py rss/urls.py templates/base.html templates/feeds/photoblog_description.html templates/feeds/photoblog_title.html templates/flatpages/splash.html templates/photoblog/entry.html

Changes

--- a/photoblog/models.py	Sat Feb 14 23:35:49 2009 -0500
+++ b/photoblog/models.py	Sun Feb 15 00:34:21 2009 -0500
@@ -5,7 +5,7 @@
 class Entry(ImageModel):
     title = models.CharField(max_length=300)
     slug = models.SlugField()
-    pub_date = models.DateField(default=datetime.datetime.today)
+    pub_date = models.DateTimeField(default=datetime.datetime.now)
     body = models.TextField(blank=True)
     original_image = models.ImageField(upload_to="storage/photoblog/original")
     num_views = models.PositiveIntegerField(editable=False, default=0)
--- a/photoblog/specs.py	Sat Feb 14 23:35:49 2009 -0500
+++ b/photoblog/specs.py	Sun Feb 15 00:34:21 2009 -0500
@@ -4,10 +4,6 @@
 class ResizeThumb(processors.Resize):
     height = 50
 
-class ResizeDisplay(processors.Resize):
-    width = 550
-    height = 550
-
 class EnchanceThumb(processors.Adjustment): 
     contrast = 1.2
     sharpness = 1.1
@@ -16,7 +12,3 @@
     access_as = 'thumbnail'
     pre_cache = True
     processors = [ResizeThumb, EnchanceThumb]
-
-class Display(ImageSpec):
-    increment_count = True
-    processors = [ResizeDisplay]
--- a/rss/feeds.py	Sat Feb 14 23:35:49 2009 -0500
+++ b/rss/feeds.py	Sun Feb 15 00:34:21 2009 -0500
@@ -1,7 +1,7 @@
 from django.contrib.syndication.feeds import Feed
 from stevelosh.blog.models import Entry, Comment as BlogComment
 from stevelosh.projects.models import Project, Comment as ProjectComment
-from stevelosh.thoughts.models import TextThought, LinkThought
+from stevelosh.photoblog.models import Entry as PhotoBlogEntry
 import operator
 
 
@@ -80,42 +80,27 @@
                 'Steve Losh / ' + item.name)
     
 
-class LatestThoughts(Feed):
-    title = "Steve Losh / RSS / Thoughts"
-    link = "http://stevelosh.com/thoughts"
-    description = "Latest thoughts from stevelosh.com"
+class LatestPhotoBlogEntries(Feed):
+    title = "Steve Losh / RSS / Photo Blog"
+    link = "http://stevelosh.com/photoblog"
+    description = "Latest photos from stevelosh.com"
     
     item_author_name = 'Steve Losh'
     item_author_email = 'steve@stevelosh.com'
     item_author_link = 'http://stevelosh.com'
     
     def items(self):
-        thoughts = []
-        thoughts += [{'type': 'thought-text', 'item': thought, 'date': thought.posted}
-                     for thought in 
-                     TextThought.objects.order_by('-posted')[:10]]
-        thoughts += [{'type': 'thought-link', 'item': thought, 'date': thought.posted}
-                     for thought in 
-                     LinkThought.objects.order_by('-posted')[:10]]
-        thoughts.sort(key=operator.itemgetter('date'))
-        thoughts.reverse()
-        return thoughts[:10]
+        return PhotoBlogEntry.objects.filter(published=True).order_by('-pub_date')[:10]
     
     def item_pubdate(self, item):
-        return item['date']
+        return item.pub_date
     
     def item_link(self, item):
-        title = 'Steve Losh / '
-        if item['type'] == 'thought-text':
-            title += 'Thoughts / ' + str(item['item'].id)
-        elif item['type'] == 'thought-link':
-            title += 'Thoughts / ' + item['item'].url
-        
         return '%s/?FeederAction=clicked&feed=%s&seed=%s&seed_title=%s' % \
                (feeder,
-                'Thoughts', 
-                self.link, 
-                title)
+                'Blog', 
+                self.item_author_link + item.get_absolute_url(), 
+                'Steve Losh / ' + item.title)
     
 
 class LatestEverything(Feed):
@@ -129,18 +114,16 @@
     
     def items(self):
         items = []
-        items += [{'type': 'blog', 'item': entry, 'date': entry.pub_date} 
-                  for entry in 
-                  Entry.objects.filter(published=True).order_by('-pub_date')[:15]]
-        items += [{'type': 'thought-text', 'item': thought, 'date': thought.posted}
-                  for thought in 
-                  TextThought.objects.order_by('-posted')[:10]]
-        items += [{'type': 'thought-link', 'item': thought, 'date': thought.posted}
-                  for thought in 
-                  LinkThought.objects.order_by('-posted')[:10]]
-        items += [{'type': 'project', 'item': project, 'date': project.posted}
-                  for project in 
-                  Project.objects.order_by('-posted')[:10]]
+        
+        items += [{'type': 'blog', 'item': entry, 'date': entry.pub_date, 'title': title} 
+            for entry in Entry.objects.filter(published=True).order_by('-pub_date')[:10]]
+        
+        items += [{'type': 'photoblog', 'item': entry, 'date': entry.pub_date, 'title': title} 
+            for entry in PhotoBlogEntry.objects.filter(published=True).order_by('-pub_date')[:10]]
+        
+        items += [{'type': 'project', 'item': project, 'date': project.posted, 'title': name}
+            for project in Project.objects.order_by('-posted')[:10]]
+        
         items.sort(key=operator.itemgetter('date'))
         items.reverse()
         return items[:10]
@@ -149,20 +132,8 @@
         return item['date']
     
     def item_link(self, item):
-        title = 'Steve Losh / '
-        new_link = ''
-        if item['type'] == 'blog':
-            title += item['item'].title
-            new_link = self.item_author_link + item['item'].get_absolute_url()
-        elif item['type'] == 'project':
-            title += item['item'].name
-            new_link = self.item_author_link + item['item'].get_absolute_url()
-        elif item['type'] == 'thought-text':
-            title += 'Thoughts / ' + str(item['item'].id)
-            new_link = self.item_author_link + '/thoughts/'
-        elif item['type'] == 'thought-link':
-            title += 'Thoughts / ' + item['item'].url
-            new_link = self.item_author_link + '/thoughts/'
+        title = 'Steve Losh / ' + item['title']
+        new_link = items['item'].get_absolute_url()
         
         return '%s/?FeederAction=clicked&feed=%s&seed=%s&seed_title=%s' % \
                (feeder,
--- a/rss/urls.py	Sat Feb 14 23:35:49 2009 -0500
+++ b/rss/urls.py	Sun Feb 15 00:34:21 2009 -0500
@@ -4,7 +4,7 @@
 feeds = { 'blog': LatestEntries, 
           'comments': LatestComments,
           'projects': LatestProjects, 
-          'thoughts': LatestThoughts, 
+          'photoblog': LatestPhotoBlogEntries, 
           'all': LatestEverything, }
 
 urlpatterns = patterns('stevelosh.rss.views',
--- a/templates/base.html	Sat Feb 14 23:35:49 2009 -0500
+++ b/templates/base.html	Sun Feb 15 00:34:21 2009 -0500
@@ -2,76 +2,76 @@
 
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
-	<title>Steve Losh / {% block title %}{% endblock %}</title>
-	
-	<link rel="stylesheet" href="/site-media/style/blueprint/screen.css" 
-		  type="text/css" media="screen, projection"/>
-	<link rel="stylesheet" href="/site-media/style/blueprint/print.css" 
-		  type="text/css" media="print"/> 
-	<!--[if IE]>
-	<link rel="stylesheet" href="/site-media/style/blueprint/ie.css"
-	 	  type="text/css" media="screen, projection">
-	<![endif]-->
-	<link rel="stylesheet" href="/site-media/style/stevelosh.css" 
-		  type="text/css"/>
-	<link rel="stylesheet" href="/site-media/style/comments.css" 
-		  type="text/css"/>
-		
-	{% block style %}{% endblock %}
-	
-	<script type="text/javascript"
-	        src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js">
-	</script>
-	<script src="/mint/?js" type="text/javascript"></script>
+    <title>Steve Losh / {% block title %}{% endblock %}</title>
+    
+    <link rel="stylesheet" href="/site-media/style/blueprint/screen.css" 
+          type="text/css" media="screen, projection"/>
+    <link rel="stylesheet" href="/site-media/style/blueprint/print.css" 
+          type="text/css" media="print"/> 
+    <!--[if IE]>
+    <link rel="stylesheet" href="/site-media/style/blueprint/ie.css"
+          type="text/css" media="screen, projection">
+    <![endif]-->
+    <link rel="stylesheet" href="/site-media/style/stevelosh.css" 
+          type="text/css"/>
+    <link rel="stylesheet" href="/site-media/style/comments.css" 
+          type="text/css"/>
+        
+    {% block style %}{% endblock %}
+    
+    <script type="text/javascript"
+            src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js">
+    </script>
+    <script src="/mint/?js" type="text/javascript"></script>
 
-	{% block script %}{% endblock %}
+    {% block script %}{% endblock %}
 </head>
 
 <body class="stevelosh">
-	<div id="wrapper" class="container">
-		<div id="header" class="span-24">
-			<h1 id="site-logo"><a href="/">steve losh</a></h1>
-			<h1 id="site-heading">
-				&nbsp;{% block header %}{% endblock %}
-			</h1>
-		</div>
-		
-		<div id="content" class="span-17 colborder">
-			{% block content %}{% endblock %}
-		</div>
-		
-		<div id="sidebar" class="span-6 last">
-			<div class="sidebar-item">
-				<h2><a href="{% url blog-list-newest %}">
-					Blog
-				</a></h2>
-			</div>
-		
-			<div class="sidebar-item">
-				<h2><a href="{% url project-list %}">
-					Projects
-				</a></h2>
-			</div>
-			
-			<div class="sidebar-item">
-				<h2><a href="{% url thoughts-list-newest %}">
-					Thoughts
-				</a></h2>
-			</div>
-			
-			<div class="sidebar-item">
-				<h2><a href="/about/">
-					About
-				</a></h2>
-			</div>
-			
-			<div class="sidebar-item">
-				<h2><a href="/rss/">
-					RSS
-				</a></h2>
-			</div>
-		</div>
-	</div>
+    <div id="wrapper" class="container">
+        <div id="header" class="span-24">
+            <h1 id="site-logo"><a href="/">steve losh</a></h1>
+            <h1 id="site-heading">
+                &nbsp;{% block header %}{% endblock %}
+            </h1>
+        </div>
+        
+        <div id="content" class="span-17 colborder">
+            {% block content %}{% endblock %}
+        </div>
+        
+        <div id="sidebar" class="span-6 last">
+            <div class="sidebar-item">
+                <h2><a href="{% url blog-list-newest %}">
+                    Blog
+                </a></h2>
+            </div>
+            
+            <div class="sidebar-item">
+                <h2><a href="{% url photoblog-newest %}">
+                    Photos
+                </a></h2>
+            </div>
+            
+            <div class="sidebar-item">
+                <h2><a href="{% url project-list %}">
+                    Projects
+                </a></h2>
+            </div>
+            
+            <div class="sidebar-item">
+                <h2><a href="/about/">
+                    About
+                </a></h2>
+            </div>
+            
+            <div class="sidebar-item">
+                <h2><a href="/rss/">
+                    RSS
+                </a></h2>
+            </div>
+        </div>
+    </div>
 </body>
 
 </html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/feeds/photoblog_description.html	Sun Feb 15 00:34:21 2009 -0500
@@ -0,0 +1,5 @@
+{% load markup %}
+
+<img src="{{ obj.original_image.url }}" />
+
+{{ obj.body|markdown }}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/feeds/photoblog_title.html	Sun Feb 15 00:34:21 2009 -0500
@@ -0,0 +1,1 @@
+{{ obj.title }}
\ No newline at end of file
--- a/templates/flatpages/splash.html	Sat Feb 14 23:35:49 2009 -0500
+++ b/templates/flatpages/splash.html	Sun Feb 15 00:34:21 2009 -0500
@@ -2,28 +2,28 @@
 {% load typogrify %}
 
 {% block style %}
-	<link rel="stylesheet" href="/site-media/style/splash.css" 
-		  type="text/css"/>
+    <link rel="stylesheet" href="/site-media/style/splash.css" 
+          type="text/css"/>
 {% endblock %}
 
 {% block content %}
 {% filter typogrify %}
-	<div id="splash-list">
-		<div class="splash-list-entry">
-			<h2>I like writing. &raquo;</h2>
-		</div>
-		<div class="splash-list-entry">
-			<h2>Things I've made. &raquo;</h2>
-		</div>
-		<div class="splash-list-entry">
-			<h2>Too small to blog, too big to tweet. &raquo;</h2>
-		</div>
-		<div class="splash-list-entry">
-			<h2>Who am I and what is this site? &raquo;</h2>
-		</div>
-		<div class="splash-list-entry">
-			<h2>Stay up to date. &raquo;</h2>
-		</div>
-	</div>
+    <div id="splash-list">
+        <div class="splash-list-entry">
+            <h2>I like writing. &raquo;</h2>
+        </div>
+        <div class="splash-list-entry">
+            <h2>One photo per day. &raquo;</h2>
+        </div>
+        <div class="splash-list-entry">
+            <h2>Some things I've made. &raquo;</h2>
+        </div>
+        <div class="splash-list-entry">
+            <h2>More about me. &raquo;</h2>
+        </div>
+        <div class="splash-list-entry">
+            <h2>Tasty feeds. &raquo;</h2>
+        </div>
+    </div>
 {% endfilter %}
 {% endblock %}
\ No newline at end of file
--- a/templates/photoblog/entry.html	Sat Feb 14 23:35:49 2009 -0500
+++ b/templates/photoblog/entry.html	Sun Feb 15 00:34:21 2009 -0500
@@ -21,7 +21,7 @@
             </p>
         </div>
         
-        <img id="photoblog-main-image" src="{{ entry.display.url }}" />
+        <img id="photoblog-main-image" src="{{ entry.original_image.url }}" />
         
         <div id="photoblog-entry-body" class="content">
             {{ entry.body|markdown|typogrify }}