diff options
Diffstat (limited to 'bn_django')
64 files changed, 0 insertions, 2318 deletions
diff --git a/bn_django/__init__.py b/bn_django/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/bn_django/__init__.py +++ /dev/null diff --git a/bn_django/dump_to_pelican.py b/bn_django/dump_to_pelican.py deleted file mode 100644 index bc2be28..0000000 --- a/bn_django/dump_to_pelican.py +++ /dev/null @@ -1,41 +0,0 @@ - -import os -from journal.models import * -from django.contrib.flatpages.models import * - -def save_page(p): - if p.id == 15: return - url = p.url.decode('utf-8') - f = open("flat_page_dump/" + url.strip("/").replace("/", "_") + ".html", 'w') - f.write("Title: " + p.title + "\n") - f.write("Url: " + url + "\n") - f.write("SaveAs: " + url + "index.html\n") - f.write("Date: " + str(p.date)) - f.write("\n") - f.write("\n") - f.write(p.content.decode('utf-8')) - f.close() - -os.system("mkdir flat_page_dump") - -for page in FlatPage.objects.all(): - save_page(page) - -def save_links(): - f = open("link_dump.html", 'w') - f.write("<ul>\n") - for l in LinkArtifact.objects.all(): - f.write("<li><b><a href=\"%s\">%s</a></b> (%s): %s</li>\n" % ( - l.url, l.title, str(l.date), l.html_caption)) - f.write("</ul>\n") - f.close() - -def save_micro(): - f = open("micro_dump.html", 'w') - f.write("<ul>\n") - for m in MicroEntry.objects.all(): - f.write("<li><b>%s</b>: %s\n" % ( - str(m.date), m.html_content)) - f.write("</ul>\n") - f.close() - diff --git a/bn_django/journal/__init__.py b/bn_django/journal/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/bn_django/journal/__init__.py +++ /dev/null diff --git a/bn_django/journal/admin.py b/bn_django/journal/admin.py deleted file mode 100644 index 3f1024c..0000000 --- a/bn_django/journal/admin.py +++ /dev/null @@ -1,51 +0,0 @@ -from django.contrib import admin -from bn_django.journal.models import * - -class EntryAdmin(admin.ModelAdmin): - #fieldsets = ( - #(None, { - #'fields': ('title', 'date', 'html_content', 'author', 'subjournal') - #}, ), - ##('Advanced options', { - #'classes': ('collapse',), - #'fields': ('slug',)})) - #prepopulated_fields = {'slug': ('title'),'text_content': ('html_content')} - #date_hierarchy = 'date' - #list_display = ('date', 'title', 'subjournal', 'author') - search_fields = ('title','text_content') - -class MicroEntryAdmin(admin.ModelAdmin): - #fieldsets = ( - #(None, { - #'fields': ('title', 'date', 'html_content', 'author', - #'subjournal',), }), - #('Advanced options', { - #'classes': ('collapse',), - #'fields': ('slug',)})) - prepopulated_fields = {'slug': ('title'),'text_content': ('html_content')} - date_hierarchy = 'date' - list_display = ('date', 'title', 'subjournal', 'author') - search_fields = ('title','text_content') - -class SubJournalAdmin(admin.ModelAdmin): - pass - -class LinkArtifactAdmin(admin.ModelAdmin): - pass - -class CodeAdmin(admin.ModelAdmin): - pass - -class VideoAdmin(admin.ModelAdmin): - pass - -class ImageAdmin(admin.ModelAdmin): - pass - -admin.site.register(Entry,EntryAdmin) -admin.site.register(MicroEntry,EntryAdmin) -admin.site.register(SubJournal) -admin.site.register(LinkArtifact) -admin.site.register(CodeArtifact) -admin.site.register(VideoArtifact) -admin.site.register(ImageArtifact) diff --git a/bn_django/journal/artifact_urls.py b/bn_django/journal/artifact_urls.py deleted file mode 100644 index 9a3bde4..0000000 --- a/bn_django/journal/artifact_urls.py +++ /dev/null @@ -1,27 +0,0 @@ -from django.conf.urls.defaults import * -from django.conf import settings - -from models import Artifact, VideoArtifact, ImageArtifact, LinkArtifact, CodeArtifact - -urlpatterns = patterns('django.views.generic.list_detail', - (r'^images/$', 'object_list', - dict(queryset=ImageArtifact.objects.order_by('-date'), - paginate_by=35, allow_empty=False)), - (r'^images/(?P<object_id>\d+)/$', 'object_detail', - dict(queryset=ImageArtifact.objects.all())), - (r'^links/$', 'object_list', - dict(queryset=LinkArtifact.objects.order_by('-date'), - paginate_by=35, allow_empty=False)), - (r'^links/(?P<object_id>\d+)/$', 'object_detail', - dict(queryset=LinkArtifact.objects.all())), - (r'^code/$', 'object_list', - dict(queryset=CodeArtifact.objects.order_by('-date'), - paginate_by=35, allow_empty=False)), - (r'^code/(?P<object_id>\d+)/$', 'object_detail', - dict(queryset=CodeArtifact.objects.all())), - (r'^videos/$', 'object_list', - dict(queryset=VideoArtifact.objects.order_by('-date'), - paginate_by=35, allow_empty=False)), - (r'^videos/(?P<object_id>\d+)/$', 'object_detail', - dict(queryset=VideoArtifact.objects.all())), -) diff --git a/bn_django/journal/feeds.py b/bn_django/journal/feeds.py deleted file mode 100644 index 09f1a4e..0000000 --- a/bn_django/journal/feeds.py +++ /dev/null @@ -1,67 +0,0 @@ -from django.contrib.syndication.feeds import Feed -from models import Entry, MicroEntry, LinkArtifact - - -class LatestEntries(Feed): - title = "bnewbold.net journal entries" - link = "/journal/entries/" - description = " " - - def items(self): - return Entry.objects.order_by('-date')[:5] - - def item_link(self,item): - return "http://bnewbold.net%s" % item.get_absolute_url() - - def item_author_name(self,item): - return item.author.username - - def item_author_email(self,item): - return item.author.email - - def item_pubdate(self,item): - return item.date - -class LatestMicroEntries(Feed): - title = "bnewbold.net microentries" - link = "/journal/microentries/" - description = "Quick updates" - - def items(self): - return MicroEntry.objects.order_by('-date')[:5] - - def item_link(self,item): - return "http://bnewbold.net%s" % item.get_absolute_url() - - def item_author_name(self,item): - return item.author.username - - def item_author_email(self,item): - return item.author.email - - def item_pubdate(self,item): - return item.date - -class LatestLinks(Feed): - title = "bnewbold.net links" - link = "/artifacts/links/" - description = "Links to love" - - def items(self): - return LinkArtifact.objects.order_by('-date')[:5] - - def item_link(self,item): - return item.url - - def item_author_name(self,item): - return item.author.username - - def item_author_email(self,item): - return item.author.email - - def item_pubdate(self,item): - return item.date - -feed_list = {'latest_entries':LatestEntries, - 'latest_microentries':LatestMicroEntries, - 'latest_links':LatestLinks } diff --git a/bn_django/journal/models.py b/bn_django/journal/models.py deleted file mode 100644 index a4402b2..0000000 --- a/bn_django/journal/models.py +++ /dev/null @@ -1,98 +0,0 @@ -from django.db import models -from django.dispatch import dispatcher -from django.db.models import signals -from django.contrib.auth.models import User, AnonymousUser -from bn_django.photos.models import Photo - -class SubJournal(models.Model): - name = models.CharField("full title", blank=False,max_length=196) - date = models.DateField("date started", auto_now_add=True) - slug = models.SlugField() - description = models.TextField("description of content",blank=True) - - def __unicode__(self): - return self.name - - class Meta: - get_latest_by = 'date' - ordering = ['-date'] - -class JournalCommon(models.Model): - author = User("User who created this") - date = models.DateTimeField("associated day", auto_now=True) - last_edited = models.DateTimeField("day last edited", auto_now_add=True) - subjournal = models.ForeignKey(SubJournal,blank=True,null=True) - defunct = models.BooleanField("is this entry all around done with?",default=False,blank=False) - private = models.BooleanField("is this entry for validated users only?",default=False,blank=False) - - class Meta: - abstract = True - get_latest_by = 'date' - ordering = ['-date'] - -class Entry(JournalCommon): - html_content = models.TextField("html format content", blank=False) - title = models.CharField("entry title", max_length=384) - slug = models.SlugField() - - def __unicode__(self): - return self.title - - def get_absolute_url(self): - #return "/journal/entries/%04d/%02d/%02d/%s/"%(self.date.year, self.date.month, self.date.day, self.slug) - return "/journal/entries/%s/"%self.slug - -class MicroEntry(JournalCommon): - html_content = models.TextField("html format content", blank=False) - text_content = models.TextField("text version of content", blank=True,null=True) - - def __unicode__(self): - return self.html_content[:50] - - def get_absolute_url(self): - return "/journal/microentries/%s/"%self.id - #return "/journal/microentries/%04d/%02d/%02d/%s/"%(self.date.year, self.date.month, self.date.day, self.slug) - -class Artifact(JournalCommon): - html_caption = models.TextField("html format caption", blank=True) - text_caption = models.TextField("text format caption", blank=True) - entry = models.ForeignKey(Entry, blank=True, null=True) - title = models.CharField("title of the artifact", max_length=256, blank=True) - - class Meta: - abstract = True - -class VideoArtifact(Artifact): - codec = models.CharField("what codec/format the video is", max_length=384) - filepath = models.FileField(upload_to="artifacts/%Y/%m/") - external_url = models.URLField("external representation to reduce bandwidth (youtube, etc)", blank=True) - -class CodeArtifact(Artifact): - code = models.TextField("raw source code", blank=False) - language = models.CharField("what programming language", max_length=160, \ - blank=True) - -class LinkArtifact(Artifact): - url = models.URLField("external link to something wonderful!",verify_exists=False) - - def __unicode__(self): - return self.title - - def get_absolute_url(self): - return "/artifacts/links/%s/"% self.id - -class ImageArtifact(Artifact,Photo): - """Multiply inherets from the photo app - """ - -def build_display_images(sender, instance, signal, *args, **kwargs): - """Simple hook for save-after trigger - """ - instance.build_display_images() -def delete_thumbnails(sender, instance, signal, *args, **kwargs): - """Simple hook for pre-delete trigger. - """ - instance.delete_thumbnails() - -signals.post_save.connect(build_display_images, sender=ImageArtifact) -signals.pre_delete.connect(delete_thumbnails, sender=ImageArtifact) diff --git a/bn_django/journal/templates/feeds/latest_entries_description.html b/bn_django/journal/templates/feeds/latest_entries_description.html deleted file mode 100644 index 6f28865..0000000 --- a/bn_django/journal/templates/feeds/latest_entries_description.html +++ /dev/null @@ -1 +0,0 @@ -{{obj.html_content|safe|truncatewords_html:300}} diff --git a/bn_django/journal/templates/feeds/latest_entries_title.html b/bn_django/journal/templates/feeds/latest_entries_title.html deleted file mode 100644 index e12d8e1..0000000 --- a/bn_django/journal/templates/feeds/latest_entries_title.html +++ /dev/null @@ -1 +0,0 @@ -{{obj.title|safe}} diff --git a/bn_django/journal/templates/feeds/latest_links_description.html b/bn_django/journal/templates/feeds/latest_links_description.html deleted file mode 100644 index 32c8857..0000000 --- a/bn_django/journal/templates/feeds/latest_links_description.html +++ /dev/null @@ -1 +0,0 @@ -{{ obj.html_caption|safe|truncatewords_html:200}} diff --git a/bn_django/journal/templates/feeds/latest_links_title.html b/bn_django/journal/templates/feeds/latest_links_title.html deleted file mode 100644 index d355de5..0000000 --- a/bn_django/journal/templates/feeds/latest_links_title.html +++ /dev/null @@ -1 +0,0 @@ -{{ obj.title }} diff --git a/bn_django/journal/templates/feeds/latest_microentries_description.html b/bn_django/journal/templates/feeds/latest_microentries_description.html deleted file mode 100644 index 427823d..0000000 --- a/bn_django/journal/templates/feeds/latest_microentries_description.html +++ /dev/null @@ -1 +0,0 @@ -{{obj.html_content|safe|truncatewords_html:160}} diff --git a/bn_django/journal/templates/feeds/latest_microentries_title.html b/bn_django/journal/templates/feeds/latest_microentries_title.html deleted file mode 100644 index d992ff6..0000000 --- a/bn_django/journal/templates/feeds/latest_microentries_title.html +++ /dev/null @@ -1 +0,0 @@ -{{obj.title}} diff --git a/bn_django/journal/templates/journal/artifacts.html b/bn_django/journal/templates/journal/artifacts.html deleted file mode 100644 index 4b82573..0000000 --- a/bn_django/journal/templates/journal/artifacts.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Artifacts!{% endblock %} - -{% block content %}<br /> -Oh golly oh golly! We've got -<b> -<ul> - <li /><a href="links/">links</a> - <li /><a href="images/">images</a> - <li /><a href="code/">code snippets</a> - <li /><a href="videos/">videos</a> -</ul> -</b> -Also check out journal <a href="/journal/entries/">entries</a> and <a href="/journal/microentries/">microentries</a>. -{% endblock %} diff --git a/bn_django/journal/templates/journal/base.html b/bn_django/journal/templates/journal/base.html deleted file mode 100644 index 819b1f4..0000000 --- a/bn_django/journal/templates/journal/base.html +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "base.html" %} - -{% block path %} - <a href="/journal/">journal</a> -{% endblock %} diff --git a/bn_django/journal/templates/journal/codeartifact_detail.html b/bn_django/journal/templates/journal/codeartifact_detail.html deleted file mode 100644 index fefdea8..0000000 --- a/bn_django/journal/templates/journal/codeartifact_detail.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends "journal/base.html" %} -{# {% load markup %} #} -{% load comments %} -{% block path %}<a href="/artifacts/">artifacts</a> - »<a href="/artifacts/code/"> code</a> - »<a href="../{{ object.id }}"> {{ object.title }}</a> -{% endblock %} - -{% block title %} -{% if object.title %}{{ object.title }}{% else %}[Untitled Code Snippet]{% endif %} -{% endblock %} - -{% block content %}<br /> -{% if object %}<div class="right_stuff"> -<p class="date">Code added {{ object.date }}, -{% if object.author %}<br />by {{ object.author }},{% endif %} -{% if object.last_edited %}<br />last edited {{ object.last_edited }}.{% endif %} -</div> -{% if object.language %}This is in {{object.language}}.<br /><br />{%endif%} -<pre class="large"> -{{object.code}} -</pre> -{% if object.html_caption|safe %}<br /><br />{{object.html_caption}}{% endif %} -{% else %} -<p>This is not the artifact you are looking for.</p> -{% endif %} -{% endblock %} - -{% block commentary %} -<div class='content' id='commentary'> -{% get_comment_list for object as comments %} -{% include "comment_list" %} -<h3>Post a comment</h3> -{% render_comment_form for object %} -</div> -{% endblock %} diff --git a/bn_django/journal/templates/journal/codeartifact_list.html b/bn_django/journal/templates/journal/codeartifact_list.html deleted file mode 100644 index ee52afd..0000000 --- a/bn_django/journal/templates/journal/codeartifact_list.html +++ /dev/null @@ -1,27 +0,0 @@ -{% extends "journal/base.html" %} - -{% block path %}<a href="/artifacts/">artifacts</a> - »<a href="/artifacts/code/"> code</a> -{% endblock %} - -{% block title %}Code Snippets{% endblock %} - -{% block content %} -<br /> -{% if object_list %} -<ul> - {% for item in object_list %} - <li /><a href="{{ item.id }}/">{{item.title}}</a> - {% if item.language %} ({{item.language}}){% endif %} - {% endfor %} -</ul> -{% else %} -<p>No code snippets have been uploaded yet.</p> -{% endif %} - -{% if is_paginated %} {% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} {% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} {% endif %} -{% endblock %} diff --git a/bn_django/journal/templates/journal/entry_archive_month.html b/bn_django/journal/templates/journal/entry_archive_month.html deleted file mode 100644 index a9e72da..0000000 --- a/bn_django/journal/templates/journal/entry_archive_month.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends "journal/base.html" %} -{% load comments %} - -{% block title %}Journal Entries{% endblock %} - -{% block content %} -<br /> -<div class="notice"> -This page has an <a href="/journal/entries/rss.xml">RSS feed</a>. -<br /> -See also <a href="/artifacts/">artifacts</a>, <a href="microentries"> -microentries</a>. - -</div> -{% if object_list %} - {% for item in object_list %} - {% get_comment_count for item as comment_count %} - <h3><a href="{{ item.get_absolute_url }}"> - {% if item.title %}{{item.title}}{%else%}[Untitled]{%endif%}</a></h3> - <i>{{item.date|date:"D, d/m/Y @H:i"}} by {{ item.author.username }}. - <a href="{{ item.get_absolute_url }}#commentary">{{ comment_count }} comments</a></i> - <p style="padding-left:30px"> - {{ item.html_content|truncatewords_html:256 }} - </p> - {% endfor %} -{% else %} -<p>No entries have been entered yet!</p> -{% endif %} - -{% if is_paginated %} {% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} {% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} {% endif %} -{% endblock %} diff --git a/bn_django/journal/templates/journal/entry_archive_year.html b/bn_django/journal/templates/journal/entry_archive_year.html deleted file mode 100644 index a9e72da..0000000 --- a/bn_django/journal/templates/journal/entry_archive_year.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends "journal/base.html" %} -{% load comments %} - -{% block title %}Journal Entries{% endblock %} - -{% block content %} -<br /> -<div class="notice"> -This page has an <a href="/journal/entries/rss.xml">RSS feed</a>. -<br /> -See also <a href="/artifacts/">artifacts</a>, <a href="microentries"> -microentries</a>. - -</div> -{% if object_list %} - {% for item in object_list %} - {% get_comment_count for item as comment_count %} - <h3><a href="{{ item.get_absolute_url }}"> - {% if item.title %}{{item.title}}{%else%}[Untitled]{%endif%}</a></h3> - <i>{{item.date|date:"D, d/m/Y @H:i"}} by {{ item.author.username }}. - <a href="{{ item.get_absolute_url }}#commentary">{{ comment_count }} comments</a></i> - <p style="padding-left:30px"> - {{ item.html_content|truncatewords_html:256 }} - </p> - {% endfor %} -{% else %} -<p>No entries have been entered yet!</p> -{% endif %} - -{% if is_paginated %} {% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} {% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} {% endif %} -{% endblock %} diff --git a/bn_django/journal/templates/journal/entry_detail.html b/bn_django/journal/templates/journal/entry_detail.html deleted file mode 100644 index b68e4b6..0000000 --- a/bn_django/journal/templates/journal/entry_detail.html +++ /dev/null @@ -1,31 +0,0 @@ -{% extends "journal/base.html" %} -{% load comments %} - -{% block path %}{{ block.super }} - »<a href="{{object.get_absolute_url}}"> {{ object.title }}</a> -{% endblock %} - -{% block title %} -{% if object.title %}{{ object.title }}{% else %}[Untitled Entry]{% endif %} -{% endblock %} - -{% block content %}<br /> -{% if object %}<div class="right_stuff"> -<p class="date">Entry dated {{ object.date }}, -{% if object.author %}<br />written by {{ object.author }},{% endif %} -{% if object.last_edited %}<br />last edited {{ object.last_edited }}.{% endif %} -</div> -<p class="journal_entry">{{ object.html_content|safe }}</p> -{% else %} -<p>This is not the entry you are looking for.</p> -{% endif %} -{% endblock %} - -{% block commentary %} -<div class='content' id='commentary'> -{% get_comment_list for object as comments %} -{% include "comment_list" %} -<h3>Post a comment</h3> -{% render_comment_form for object %} -</div> -{% endblock %} diff --git a/bn_django/journal/templates/journal/entry_list.html b/bn_django/journal/templates/journal/entry_list.html deleted file mode 100644 index 8902552..0000000 --- a/bn_django/journal/templates/journal/entry_list.html +++ /dev/null @@ -1,39 +0,0 @@ -{% extends "journal/base.html" %} -{% load comments %} - -{% block title %}Journal Entries{% endblock %} - -{% block otherhead %}{{ block.super}} -<link rel="alternate" type="application/rss+xml" title="RSS" href="/journal/rss/latest_entries/"> -{% endblock %} - -{% block content %} -<br /> -<div class="notice"> -This page has an <a href="/journal/rss/latest_entries/">RSS feed</a>. -<br /> -See also <a href="/artifacts/">artifacts</a>, <a href="microentries"> -microentries</a>. - -</div> -{% if object_list %} - {% for item in object_list %} - {% get_comment_count for item as comment_count %} - <h3><a href="{{ item.get_absolute_url }}"> - {% if item.title %}{{item.title}}{%else%}[Untitled]{%endif%}</a></h3> - <i>{{item.date|date:"D, d/m/Y @H:i"}} by {{ item.author.username }}. - <a href="{{ item.get_absolute_url }}#commentary">{{ comment_count }} comments</a></i> - <p style="padding-left:30px"> - {{ item.html_content|truncatewords_html:256 }} - </p> - {% endfor %} -{% else %} -<p>No entries have been entered yet!</p> -{% endif %} - -{% if is_paginated %} {% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} {% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} {% endif %} -{% endblock %} diff --git a/bn_django/journal/templates/journal/imageartifact_detail.html b/bn_django/journal/templates/journal/imageartifact_detail.html deleted file mode 100644 index 45ea1aa..0000000 --- a/bn_django/journal/templates/journal/imageartifact_detail.html +++ /dev/null @@ -1,40 +0,0 @@ -{% extends "journal/base.html" %} -{# {% load markup %} #} -{% load comments %} -{% block path %}<a href="/artifacts/">artifacts</a> - »<a href="/artifacts/images/"> images</a> - »<a href="../{{ object.id }}"> {{ object.title }}</a> -{% endblock %} - -{% block title %} -{% if object.title %}{{ object.title }}{% else %}[Untitled Image]{% endif %} -{% endblock %} - -{% block content %}<br /> -{% if object %}<div class="right_stuff"> -<p class="date">Image uploaded {{ object.date }}, -{% if object.author %}<br />by {{ object.author }},{% endif %} -{% if object.last_edited %}<br />last edited {{ object.last_edited }}.{% endif %} -</div> -<center> -<div id="centerize"> - <a href="{{ object.fullurl }}"> - <img src="{{ object.dispurl }}" - alt="{{ object.title }}" /> - </a> -</div> -</center> -{% if object.html_caption %}<br /><br />{{object.html_caption}}{% endif %} -{% else %} -<p>This is not the artifact you are looking for.</p> -{% endif %} -{% endblock %} - -{% block commentary %} -<div class='content' id='commentary'> -{% get_comment_list for object as comments %} -{% include "comment_list" %} -<h3>Post a comment</h3> -{% render_comment_form for object %} -</div> -{% endblock %} diff --git a/bn_django/journal/templates/journal/imageartifact_list.html b/bn_django/journal/templates/journal/imageartifact_list.html deleted file mode 100644 index 6530773..0000000 --- a/bn_django/journal/templates/journal/imageartifact_list.html +++ /dev/null @@ -1,29 +0,0 @@ -{% extends "journal/base.html" %} - -{% block path %}<a href="/artifacts/">artifacts</a> - »<a href="/artifacts/images"> images</a>{% endblock %} - -{% block title %}Uploaded Images{% endblock %} - -{% block content %} -<br /> -{% if object_list %} -<table width="100%" class="thumbs"> -{% for item in object_list %} {% cycle <tr/>, , , %} - <td class="photo_thumb"> - <a href="{{ item.id }}/"> - <img src="{{ item.thumburl }}" - alt="{{ item.title }}" /> - </td> {% endfor %} -</table> -{% else %} -<p>There are no images! If you just uploaded a batch -of photos, try hitting your browser's reload button to see if they -show up.</p> {% endif %} - -{% if is_paginated %} {% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} {% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} {% endif %} -{% endblock %} diff --git a/bn_django/journal/templates/journal/linkartifact_detail.html b/bn_django/journal/templates/journal/linkartifact_detail.html deleted file mode 100644 index 70f9656..0000000 --- a/bn_django/journal/templates/journal/linkartifact_detail.html +++ /dev/null @@ -1,34 +0,0 @@ -{% extends "journal/base.html" %} - -{% load comments %} - -{% block path %}<a href="/artifacts/">artifacts</a> - »<a href="/artifacts/links/"> links</a> - »<a href="../{{ object.id }}"> {{ object.title }}</a> -{% endblock %} - -{% block title %} -{% if object.title %}{{ object.title }}{% else %}[Untitled Link]{% endif %} -{% endblock %} - -{% block content %}<br /> -{% if object %}<div class="right_stuff"> -<p class="date">Link created {{ object.date }}, -{% if object.author %}<br />by {{ object.author }},{% endif %} -{% if object.last_edited %}<br />last edited {{ object.last_edited }}.{% endif %} -</div> -<b><a href="{{object.url}}">{{object.url}}</a></b> -{% if object.html_caption %}<br /><br /> {{object.html_caption|safe}}{% endif %} -{% else %} -<p>This is not the artifact you are looking for.</p> -{% endif %} -{% endblock %} - -{% block commentary %} -<div class='content' id='commentary'> -{% get_comment_list for object as comments %} -{% include "comment_list" %} -<h3>Post a comment</h3> -{% render_comment_form for object %} -</div> -{% endblock %} diff --git a/bn_django/journal/templates/journal/linkartifact_list.html b/bn_django/journal/templates/journal/linkartifact_list.html deleted file mode 100644 index 136ce72..0000000 --- a/bn_django/journal/templates/journal/linkartifact_list.html +++ /dev/null @@ -1,43 +0,0 @@ -{% extends "journal/base.html" %} - -{% block otherhead %}{{ block.super}} -<link rel="alternate" type="application/rss+xml" title="RSS" href="/journal/rss/latest_links/"> -{% endblock %} - -{% block path %}<a href="/artifacts/">artifacts</a> - »<a href="/artifacts/links/"> links</a> -{% endblock %} - -{% block title %}Links Galore!{% endblock %} -{% block right_stuff %} -This page has an <a href="/journal/rss/latest_links/">RSS feed</a>. -{%endblock %} - -{% block content %} -New favorite finds from the net. Good posts from -<a href="/oldlinks">RSS feeds</a> -end up at <a href="http://feeds.bnewbold.net">feeds.bnewbold.net</a>. -<br /> -<br /> -{% if object_list %} -<ul style="list-style: none;margin-left:10px;"> - {% for item in object_list %} - <li style="margin-bottom: 8px;"/><a href="{{ item.id }}/" style="font-size:140%;">{{item.title}}</a> - {% if item.html_caption %} - "{{item.html_caption|safe|truncatewords_html:10}}"{%endif%} - <br /><i style="padding-left: 15px; font-size:90%;"> - added {{item.date|date:"D, M d, Y"}} - - <a href="{{ item.id }}/">more info</a> - - {{ item.url|urlizetrunc:70 }}</i> - {% endfor %} -</ul> -{% else %} -<p>No links have been entered yet.</p> -{% endif %} - -{% if is_paginated %} {% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} {% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} {% endif %} -{% endblock %} diff --git a/bn_django/journal/templates/journal/microentry_arhive_month.html b/bn_django/journal/templates/journal/microentry_arhive_month.html deleted file mode 100644 index eca642d..0000000 --- a/bn_django/journal/templates/journal/microentry_arhive_month.html +++ /dev/null @@ -1,31 +0,0 @@ -{% extends "journal/base.html" %} -{% load comments %} - -{% block path %}{{block.super}} - »<a href="/journal/microentries/"> microentries</a> - -{% block title %}Journal Microentries{% endblock %} - -{% block content %} -<br /> -{% if object_list %} - {% for item in object_list %} - <b>{{item.date|date:"D, d/m/Y @H:i"}}: - <a href="{{ item.get_absolute_url }}"> - {% if item.title %}{{item.title}}{%else%}[Untitled]{%endif%}</a></b> - <p style="padding-left:30px"> - {{ item.html_content|truncatewords_html:256 }} - {% get_comment_count for item as comment_count %} - (<a href="{{ item.get_absolute_url }}#commentary">{{ comment_count }} comments</a>) - </p> - {% endfor %} -{% else %} -<p>No entries have been entered yet!</p> -{% endif %} - -{% if is_paginated %} {% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} {% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} {% endif %} -{% endblock %} diff --git a/bn_django/journal/templates/journal/microentry_arhive_year.html b/bn_django/journal/templates/journal/microentry_arhive_year.html deleted file mode 100644 index eca642d..0000000 --- a/bn_django/journal/templates/journal/microentry_arhive_year.html +++ /dev/null @@ -1,31 +0,0 @@ -{% extends "journal/base.html" %} -{% load comments %} - -{% block path %}{{block.super}} - »<a href="/journal/microentries/"> microentries</a> - -{% block title %}Journal Microentries{% endblock %} - -{% block content %} -<br /> -{% if object_list %} - {% for item in object_list %} - <b>{{item.date|date:"D, d/m/Y @H:i"}}: - <a href="{{ item.get_absolute_url }}"> - {% if item.title %}{{item.title}}{%else%}[Untitled]{%endif%}</a></b> - <p style="padding-left:30px"> - {{ item.html_content|truncatewords_html:256 }} - {% get_comment_count for item as comment_count %} - (<a href="{{ item.get_absolute_url }}#commentary">{{ comment_count }} comments</a>) - </p> - {% endfor %} -{% else %} -<p>No entries have been entered yet!</p> -{% endif %} - -{% if is_paginated %} {% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} {% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} {% endif %} -{% endblock %} diff --git a/bn_django/journal/templates/journal/microentry_detail.html b/bn_django/journal/templates/journal/microentry_detail.html deleted file mode 100644 index 245fe32..0000000 --- a/bn_django/journal/templates/journal/microentry_detail.html +++ /dev/null @@ -1,32 +0,0 @@ -{% extends "journal/base.html" %} - -{% load comments %} -{% block path %}{{ block.super }} - »<a href="/journal/microentries/"> microentries</a> - »<a href="{{ item.get_absolute_url }}"> {{ object.title }}</a> -{% endblock %} - -{% block title %} -{% if object.title %}{{ object.title }}{% else %}[Untitled Microentry]{% endif %} -{% endblock %} - -{% block content %}<br /> -{% if object %}<div class="right_stuff"> -<p class="date">dated {{ object.date }}, -{% if object.author %}<br />written by {{ object.author.username }},{% endif %} -{% if object.last_edited %}<br />last edited {{ object.last_edited }}.{% endif %} -</div> -<p class="journal_entry">{{ object.html_content|safe }}</p> -{% else %} -<p>This is not the entry you are looking for.</p> -{% endif %} -{% endblock %} - -{% block commentary %} -<div class='content' id='commentary'> -{% get_comment_list for object as comments %} -{% include "comment_list" %} -<h3>Post a comment</h3> -{% render_comment_form for object %} -</div> -{% endblock %} diff --git a/bn_django/journal/templates/journal/microentry_list.html b/bn_django/journal/templates/journal/microentry_list.html deleted file mode 100644 index 25255f6..0000000 --- a/bn_django/journal/templates/journal/microentry_list.html +++ /dev/null @@ -1,39 +0,0 @@ -{% extends "journal/base.html" %} -{% load comments %} - -{% block otherhead %}{{ block.super}} -<link rel="alternate" type="application/rss+xml" title="RSS" href="/journal/rss/latest_microentries/"> -{% endblock %} - -{% block path %}{{block.super}} - »<a href="/journal/microentries/"> microentries</a>{% endblock %} - -{% block title %}Journal Microentries{% endblock %} - -{% block content %} -<br /> -<div class="notice"> -This page has an <a href="/journal/rss/latest_microentries/">RSS feed</a>. -</div> - -{% if object_list %} - {% for item in object_list %} - <b>{{item.date|date:"D, m/d/Y @H:i"}}: - {% if item.title %} - <a href="{{ item.get_absolute_url }}"> {{item.title}}</a>{%endif%}</b> - <p style="padding-left:30px"> - {{ item.html_content|truncatewords_html:256 }} - {% get_comment_count for item as comment_count %} - (<a href="{{ item.get_absolute_url }}#commentary">{{ comment_count }} comments</a>, <a href="{{ item.get_absolute_url }}">link</a>) - </p> - {% endfor %} -{% else %} -<p>No microentries have been entered yet!</p> -{% endif %} - -{% if is_paginated %} {% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} {% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} {% endif %} -{% endblock %} diff --git a/bn_django/journal/templates/journal/videoartifact_detail.html b/bn_django/journal/templates/journal/videoartifact_detail.html deleted file mode 100644 index 09b0ac2..0000000 --- a/bn_django/journal/templates/journal/videoartifact_detail.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends "journal/base.html" %} - -{% load comments %} -{% block path %}<a href="/artifacts/">artifacts</a> - »<a href="/artifacts/videos/"> videos</a> - »<a href="../{{ object.id }}"> {{ object.title }}</a> -{% endblock %} - -{% block title %} -{% if object.title %}{{ object.title }}{% else %}[Untitled Video]{% endif %} -{% endblock %} - -{% block content %}<br /> -{% if object %}<div class="right_stuff"> -<p class="date">Video uploaded {{ object.date }}, -{% if object.author %}<br />by {{ object.author }},{% endif %} -{% if object.last_edited %}<br />last edited {{ object.last_edited }}.{% endif %} -</div> -{% if object.external_url %}View this video <a href="{{object.external_url}}">here</a><br /><br />{%endif%} -<a href="{{object.filepath}}">Download the video.</a> -<br /><br />The video codec is {{ object.codec }}.<br /> -{% if object.html_caption %}<br /><br />{{object.html_caption|safe}}{% endif %} -{% else %} -<p>This is not the artifact you are looking for.</p> -{% endif %} -{% endblock %} - -{% block commentary %} -<div class='content' id='commentary'> -{% get_comment_list for object as comments %} -{% include "comment_list" %} -<h3>Post a comment</h3> -{% render_comment_form for object %} -</div> -{% endblock %} diff --git a/bn_django/journal/templates/journal/videoartifact_list.html b/bn_django/journal/templates/journal/videoartifact_list.html deleted file mode 100644 index b5af050..0000000 --- a/bn_django/journal/templates/journal/videoartifact_list.html +++ /dev/null @@ -1,27 +0,0 @@ -{% extends "journal/base.html" %} - -{% block path %}<a href="/artifacts/">artifacts</a> - »<a href="/artifacts/videos/"> videos</a> -{% endblock %} - -{% block title %}Videos{% endblock %} - -{% block content %} -<br /> -{% if object_list %} -<ul> - {% for item in object_list %} - <li /><a href="{{ item.id }}/">{{item.title}}</a> - {%if item.codec%} (codec: {{item.codec}}){% endif %} - {% endfor %} -</ul> -{% else %} -<p>No videos have been entered yet.</p> -{% endif %} - -{% if is_paginated %} {% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} {% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} {% endif %} -{% endblock %} diff --git a/bn_django/journal/urls.py b/bn_django/journal/urls.py deleted file mode 100644 index 4b50f40..0000000 --- a/bn_django/journal/urls.py +++ /dev/null @@ -1,41 +0,0 @@ -from django.conf.urls.defaults import * -from django.conf import settings - -from models import Entry, MicroEntry -from feeds import feed_list - -urlpatterns = patterns('django.views.generic.list_detail', - (r'^$', 'object_list', - dict(queryset=Entry.objects.order_by('-date'), - paginate_by=35, allow_empty=False)), - (r'^entries/$', 'object_list', - dict(queryset=Entry.objects.order_by('-date'), - paginate_by=35, allow_empty=False)), - (r'^microentries/$', 'object_list', - dict(queryset=MicroEntry.objects.order_by('-date'), - paginate_by=35, allow_empty=False)), - (r'^microentries/(?P<object_id>\d+)/$', 'object_detail', - dict(queryset=Entry.objects.order_by('-date'))), - (r'^entries/(?P<slug>[\d\w-]+)/$', 'object_detail', - dict(queryset=Entry.objects.order_by('-date'))), -) - -urlpatterns += patterns('', - (r'^rss/(?P<url>.*)/$','django.contrib.syndication.views.feed', - {'feed_dict':feed_list}) -) - -#urlpatterns += patterns('django.views.generic.date_based', - #(r'^entries/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[\d\w-]+)/$', 'object_detail', - #dict(queryset=Entry.objects.all(), date_field='date')), - #(r'^entries/(?P<year>\d{4})/(?P<month>\d{2})/$', 'archive_month', - #dict(queryset=Entry.objects.all(), date_field='date')), - #(r'^entries/(?P<year>\d{4})/$', 'archive_year', - #dict(queryset=Entry.objects.all(), date_field='date')), - #(r'^microentries/(?P<year>\d{4])/(?P<month>\d{2})/(?P<day>\d{2})/(?P<object_id>\d+)/$', 'object_detail', - #dict(queryset=MicroEntry.objects.all())), - #(r'^microentries/(?P<year>\d{4})/(?P<month>\d{2})/$', 'archive_month', - #dict(queryset=MicroEntry.objects.all())), - #(r'^microentries/(?P<year>\d{4])/$', 'archive_year', - #dict(queryset=MicroEntry.objects.all())), -#) diff --git a/bn_django/journal/views.py b/bn_django/journal/views.py deleted file mode 100644 index 60f00ef..0000000 --- a/bn_django/journal/views.py +++ /dev/null @@ -1 +0,0 @@ -# Create your views here. diff --git a/bn_django/manage.py b/bn_django/manage.py deleted file mode 100755 index 5e78ea9..0000000 --- a/bn_django/manage.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python -from django.core.management import execute_manager -try: - import settings # Assumed to be in the same directory. -except ImportError: - import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) - sys.exit(1) - -if __name__ == "__main__": - execute_manager(settings) diff --git a/bn_django/photos/__init__.py b/bn_django/photos/__init__.py deleted file mode 100644 index 52af441..0000000 --- a/bn_django/photos/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Strongly based on code from the stockphoto project (google it?)""" diff --git a/bn_django/photos/admin.py b/bn_django/photos/admin.py deleted file mode 100644 index a32ae7e..0000000 --- a/bn_django/photos/admin.py +++ /dev/null @@ -1,6 +0,0 @@ -from bn_django.photos.models import Photo, Gallery -from django.contrib import admin - -admin.site.register(Photo) -admin.site.register(Gallery) - diff --git a/bn_django/photos/manual_import.py b/bn_django/photos/manual_import.py deleted file mode 100644 index 8311445..0000000 --- a/bn_django/photos/manual_import.py +++ /dev/null @@ -1,64 +0,0 @@ -# Create your views here. - -# django imports -from django.conf import settings - -# other imports -import zipfile -import os -import stat -import shutil -from datetime import datetime -from tempfile import NamedTemporaryFile, mkdtemp -import Image -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO - -# Handling settings here -STOCKPHOTO_BASE = 'photos' - -# models -from bn_django.photos.models import Gallery, Photo - -# views - - -def manual_import_photos(thezipfile, thegallery): - # Check if the gallery is valid - gallery = thegallery; - - f = file(thezipfile); - zip = zipfile.ZipFile(f) - #date = the_date - #if not date: - date = datetime.date(datetime.now()) - - destdir= os.path.join(settings.MEDIA_ROOT, STOCKPHOTO_BASE, - datetime.strftime(datetime.now(), - "%Y/%m/%d/")) - if not os.path.isdir(destdir): - os.makedirs(destdir, 0775) - for filename in zip.namelist(): - photopath = os.path.join(destdir, os.path.basename(filename)) - data = zip.read(filename) - file_data = StringIO(data) - try: - Image.open(file_data) - except: - # don't save and process non Image files - continue - photo = file(photopath, "wb") - photo.write(data) - - # Create the object - if photopath.startswith(os.path.sep): - photopath = photopath[len(settings.MEDIA_ROOT):] - photo = Photo(image=photopath, date=date, - photographer='Bryan Newbold', - title = os.path.basename(filename), - gallery_id = thegallery) - # Save it -- the thumbnails etc. get created. - photo.save() - return diff --git a/bn_django/photos/models.py b/bn_django/photos/models.py deleted file mode 100644 index 4964467..0000000 --- a/bn_django/photos/models.py +++ /dev/null @@ -1,272 +0,0 @@ -from django.db import models -from django.utils.translation import ugettext as _ -import django.contrib.auth.models as auth -from django.conf import settings -from django.dispatch import dispatcher -from django.db.models import signals - -import os, os.path -import Image - -# Handle settings here -try: - STOCKPHOTO_BASE = settings.STOCKPHOTO_BASE.strip('/') -except AttributeError: - STOCKPHOTO_BASE='photos' - -STOCKPHOTO_URL='http://media.bnewbold.net/hosted-photos' - -try: - ADMIN_URL = settings.ADMIN_URL -except AttributeError: - ADMIN_URL='/admin' -if ADMIN_URL[-1] == '/': - ADMIN_URL=ADMIN_URL[:-1] - -# Create your models here. -class Gallery(models.Model): - title = models.CharField("title", max_length=80) - slug = models.SlugField() - date = models.DateField("publication date", auto_now_add=True) - created = models.ForeignKey(auth.User, - verbose_name="gallery created by" - ) - display_width = models.IntegerField( - "width to display full images", - default=640) - display_height = models.IntegerField( - "height to display full images", - default=480) - thumbnail_width = models.IntegerField( - "width to display thumbnails", - default=150) - thumbnail_height = models.IntegerField( - "height to display thumbnails", - default=100) - - class Meta: - get_latest_by = 'date' - - class Admin: - ordering = ['date'] - prepopulated_fields = {'slug': 'title'} - - def __str__(self): - return self.title - def get_absolute_url(self): - return "%s/%s/" % (STOCKPHOTO_BASE, self.slug) - def get_admin_url(self): - return "%s/photos/gallery/%d/" % (ADMIN_URL, self.id) - def was_published_today(self): - return self.date.date() == datetime.date.today() - - def first(self): - try: - return self.photo_set.all()[0] - except IndexError: - return None - def update_thumbs(self): - for photo in self.photo_set.all(): - photo.create_disp() - photo.create_thumb() - -class Photo(models.Model): - # import os, os.path, Image - image = models.ImageField("Photograph", - upload_to= STOCKPHOTO_BASE + "/%Y/%m/%d/") - title = models.CharField("title", max_length=80) - desc = models.TextField("description", blank=True) - gallery = models.ForeignKey(Gallery, blank=True, null=True) - photographer = models.CharField("photographer", max_length=80, - blank=True) - date = models.DateField("date photographed", blank=True, null=True) - extra = models.TextField("any extra information about the photo", - blank=True) - class META: - get_latest_by = ['date'] - - class Admin: - list_display = ('title', 'date', 'gallery', 'id') - ordering = ['id'] - list_filter = ['gallery'] - search_fields = ['title'] - - def __str__(self): - return self.title - - def delete_thumbnails(self): - """Remove thumbnail and display-sized images when deleting. - - This may fail if, for example, they don't exist, so it should - fail silently. It may not be a good idea to delete the - original, as the user may not understand that deleting it from - the gallery deletes it from the filesystem, so currently we - don't do that. - - """ - try: - os.unlink(self.thumbpath()) - except (IOError, OSError): - pass - try: - os.unlink(self.disppath()) - except (IOError, OSError): - pass - # Deleting the original might be a bad thing. - #os.unlink(self.fullpath()) - - def get_absolute_url(self): - return "%s/detail/%d/" % (STOCKPHOTO_BASE, self.id) - - def get_admin_url(self): - return "%s/photos/photos/%d/" % (ADMIN_URL, self.id) - - def thumbpath(self): - """Path to the thumbnail - """ - photobase = self.image.name[len(STOCKPHOTO_BASE)+1:] - return os.path.join( settings.MEDIA_ROOT, STOCKPHOTO_BASE, - "cache", "thumbs", photobase) - - def thumburl(self): - """URL to the thumbnail - """ - photobase = self.image.name[len(STOCKPHOTO_BASE)+1:] - return STOCKPHOTO_URL + "/cache/thumbs/" + photobase - - def disppath(self): - photobase = self.image.name[len(STOCKPHOTO_BASE)+1:] - return os.path.join( settings.MEDIA_ROOT, STOCKPHOTO_BASE, - "cache", photobase) - - def dispurl(self): - photobase = self.image.name[len(STOCKPHOTO_BASE)+1:] - return STOCKPHOTO_URL + "/cache/" + photobase - - def fullpath(self): - if self.image.name.startswith(os.path.sep): - return self.image.name - return os.path.join(settings.MEDIA_ROOT, self.image.name) - - def fullurl(self): - if(self.image.name.startswith("photos/")): - return STOCKPHOTO_URL + '/' + self.image.name[7:] - else: - return STOCKPHOTO_URL + '/' + self.image.name - - - def next(self): - '''Return id of 'next' photo in the same gallery or None if at - the end.''' - # we could probably be more clever here by using the new nifty - # db access filters and queries, but for now, this is good enough - photo_list = [x for x in self.gallery.photo_set.all()] - ind = photo_list.index(self) - if (ind +1) == len(photo_list): - return None - else: - return photo_list[ind + 1] - - def prev(self): - """Return id of 'previous' photo in the same gallery or None - if at the beginning - """ - photo_list = [x for x in self.gallery.photo_set.all()] - ind = photo_list.index(self) - if ind == 0: - return False - else: - return photo_list[ind - 1] - - def full_exists(self): - return os.path.exists( self.fullpath() ) - - def disp_exists(self): - return os.path.exists( self.disppath() ) - - def thumb_exists(self): - return os.path.exists( self.thumbpath() ) - - def create_disp(self): - im = Image.open( self.fullpath() ) - format = im.format - # create the path for the display image - disp_path = self.disppath() - disp_dir = os.path.dirname(disp_path) - if not os.path.exists(disp_dir): - os.makedirs(disp_dir, 0775) - - # Make a copy of the image, scaled, if needed. - maxwidth = self.gallery.display_width - maxheight = self.gallery.display_height - width, height = im.size - if (width > maxwidth) and width > height: - scale = float(maxwidth)/width - width = int(width * scale) - height = int(height * scale) - newim = im.resize( (width, height), Image.ANTIALIAS ) - elif (height > maxheight) and height >= width: - scale = float(maxheight)/height - width = int(width * scale) - height = int(height * scale) - newim = im.resize( (width, height), Image.ANTIALIAS ) - else: - newim = im - newim.save(disp_path, format) - - def create_thumb(self): - im = Image.open( self.fullpath() ) - format = im.format - # create the path for the thumbnail image - thumb_path = self.thumbpath() - thumb_dir = os.path.dirname(thumb_path) - if not os.path.exists(thumb_dir): - os.makedirs(thumb_dir, 0775) - - # Make a copy of the image, scaled, if needed. - maxwidth = self.gallery.thumbnail_width - maxheight = self.gallery.thumbnail_height - width, height = im.size - if (width > maxwidth) and (width > height): - scale = float(maxwidth)/width - width = int(width * scale) - height = int(height * scale) - newim = im.resize( (width, height), Image.ANTIALIAS ) - elif (height > maxheight): - scale = float(maxheight)/height - width = int(width * scale) - height = int(height * scale) - newim = im.resize( (width, height), Image.ANTIALIAS ) - else: - newim = im - newim.save(thumb_path, format) - - def build_display_images(self): - """Make thumbnail and display-sized images after saving. - - For some reason, this may fail on a first pass (self.image may - be empty when this is called), but if we just let it fail - silently, it will apparently get called again and succeed. - """ - if self.image: - if not self.thumb_exists(): - self.create_thumb() - if not self.disp_exists(): - self.create_disp() - -def build_display_images(sender, instance, signal, *args, **kwargs): - """Simple hook for save-after trigger - """ - instance.build_display_images() -def delete_thumbnails(sender, instance, signal, *args, **kwargs): - """Simple hook for pre-delete trigger. - """ - instance.delete_thumbnails() - -signals.post_save.connect(build_display_images, sender=Photo) -signals.pre_delete.connect(delete_thumbnails, sender=Photo) - -#dispatcher.connect(build_display_images, signal=signals.post_save, -# sender=Photo) -#dispatcher.connect(delete_thumbnails, signal=signals.pre_delete, -# sender=Photo) diff --git a/bn_django/photos/templates/photos/base.html b/bn_django/photos/templates/photos/base.html deleted file mode 100644 index d229057..0000000 --- a/bn_django/photos/templates/photos/base.html +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "base.html" %} - -{% block path %} - <a href="/photos/">photos</a> -{% endblock %} diff --git a/bn_django/photos/templates/photos/gallery_detail.html b/bn_django/photos/templates/photos/gallery_detail.html deleted file mode 100644 index 0b3a4af..0000000 --- a/bn_django/photos/templates/photos/gallery_detail.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends "photos/base.html" %} -{# {% load markup %} #} -{% block path %} -{{ block.super }} -{% if object %} - » - <a href="../{{ object.slug }}/">{{ object.title }}</a> -{% endif %} {% endblock %} -{% block title %} -{% if object %}Photo Set: {{ object.title }} {% endif %} -{% endblock %} -{% block content %} -{% if object %} -{% if object.photo_set.count %} -<table width="100%" class="thumbs"> -{% for item in object.photo_set.all %} {% cycle <tr/>, , , %} - <td class="photo_thumb"> - <a href="../detail/{{ item.id }}/"> - <img src="{{ item.thumburl }}" - alt="{{ item.title }}" /> - </td> {% endfor %} -</table> -{% else %} -<p>There are no photos in this gallery. If you just uploaded a batch -of photos, try hitting your browser's reload button to see if they -show up.</p> {% endif %} - -<!-- -{% if not user.is_anonymous %} -<p> - <a href="{{ object.get_admin_url }}">Edit this gallery.</a><br/> - <a href="{{ admin_url }}/photos/photo/add/">Add a photo to - this gallery.</a><br/> - <a href="{{photos_url}}/import/{{ object.id }}/">Add a bunch - of photos to this gallery.</a> -</p> -{% else %} -<p> - <a href="/accounts/login/?next={{ request.path }}"> - Login</a> to add or edit photos -</p> -{% endif %} ---> -{% else %} <p>This is not the gallery you are looking for.</p> {% endif %} -{% endblock %} diff --git a/bn_django/photos/templates/photos/gallery_list.html b/bn_django/photos/templates/photos/gallery_list.html deleted file mode 100644 index 11c7289..0000000 --- a/bn_django/photos/templates/photos/gallery_list.html +++ /dev/null @@ -1,57 +0,0 @@ -{% extends "photos/base.html" %} -{# {% load markup %} #} - -{% block title %}Photo Sets{% endblock %} - -{% block content %} -{% if object_list %} - <table width="100%"> - {% for item in object_list %} - <tr> - <td class="photo_thumb"> - <a href="{{ item.slug }}/"> - {% if item.first %} - <img src="{{ item.first.thumburl }}" - alt="{{ item.first.title }}" /> - {% else %} - (No photo available) - {% endif %} - </a> - </td><td style="vertical-align: top; padding-left: 14px;" > - <h3 style="font-size: 150%;"> - <a href="{{ item.slug }}/">{{ item.title }}</a></h3> - {{ item.photo_set.count }} photo{{ item.photo_set.count|pluralize}} - {% if item.first.date %} - starting in {{ item.first.date|date:"M, Y" }}{% endif %} - </td></tr> - {% endfor %} - </table> -{% else %} - <p>No galleries have been set up yet.</p> -{% endif %} - - -{% if is_paginated %} - -{% if has_previous %} -<a href="./?page={{ previous }}">« previous</a> | -{% endif %} -{% if has_next %} -<a href="./?page={{ next }}">next »</a> -{% endif %} -{% endif %} - -<!-- -{% if not user.is_anonymous %} -<p> - <a href="{{admin_url}}/photos/gallery/add/">Create a new gallery.</a> -</p> -{% else %} -<p> - <a href="/accounts/login/?next={{ request.path }}"> - Login</a> to create a new gallery. -</p> -{% endif %} ---> - -{% endblock %} diff --git a/bn_django/photos/templates/photos/import_form.html b/bn_django/photos/templates/photos/import_form.html deleted file mode 100644 index bd01a9a..0000000 --- a/bn_django/photos/templates/photos/import_form.html +++ /dev/null @@ -1,62 +0,0 @@ -{% extends "photos/base.html" %} -{# {% load markup %} #} -{% block title %}Import photos into a gallery -{% if gallery%} ({{gallery.title}}){% endif %}{% endblock %} - -{% block content %} -{% if gallery %} - -<form action="../../import/{{ gallery.id }}/" method="post" - enctype="multipart/form-data"> - <div> - {%if form.zipfile.errors %} - <span style="color: red;"> - {{ form.zipfile.errors|join:", " }} - </span><br/> - {% endif %} - - <label class="fortextinput" for="id_zipfile"> - ZIP archive to upload: - </label> - {{ form.zipfile }}<br/><br/> - - {%if form.photographer.errors %} - <span style="color: red;"> - {{ form.photographer.errors|join:", " }} - </span><br/> - {% endif %} - - <label class="fortextinput" for="id_photographer"> - Name of photographer: - </label> - {{ form.photographer }}<br/><br/> - - {%if form.date.errors %} - <span style="color: red;"> - {{ form.date.errors|join:", " }} - </span><br/> - {% endif %} - - <label class="fortextinput" for="id_date"> - Date photos were taken: - </label> - {{ form.date }}<br/><br/> - <input type="submit" value="Upload"/> - </div> -</form> -<p> - When you upload a batch of photos in a zipfile, it will give each of - them a title based on its filename, and assigns them all the same - photographer and date. That's probably not always what you want, so - you can change any of these settings on a per-photo basis - <em>after</em> you upload the images. -</p> -<p> - <b>UPDATE:</b> The title and rotation will be guessed from EXIF data... -</p> - -{% else %} -<p>Oops! No gallery here!</p> -{% endif %} - -{% endblock %} diff --git a/bn_django/photos/templates/photos/photo_detail.html b/bn_django/photos/templates/photos/photo_detail.html deleted file mode 100644 index 78b95fe..0000000 --- a/bn_django/photos/templates/photos/photo_detail.html +++ /dev/null @@ -1,111 +0,0 @@ -{% extends "photos/base.html" %} -{# {% load markup %} #} - -{% load comments %} - -{% block path %} - {{ block.super }} - » - <a href="../../{{ object.gallery.slug }}/">{{ object.gallery.title }}</a> - » - <a href="../{{ object.id }}">{{ object.title }}</a> -{% endblock %} - -{% block title %} -{% if object %} -{{ object.title }} -{% endif %} -{% endblock %} - -{% block content %} - -{% if object %} -<div class="right_stuff"> -{% if object.date %} -<p class="photodate">Photo taken {{ object.date }}{% if object.photographer %} -by {{ object.photographer }}.</p> -{% else %}.</p> -{% endif %} -{% else %} -{% if object.photographer %} -<p class="photographer">Photo by {{ object.photographer }}.</p> -{% endif %} -{% endif %} -</div> -{% if object.next %} -<div class="right_stuff" style="clear: right;"> -<div class="small-image-box"> -<br /><br /><br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /><br /> - <a href="../{{ object.next.id }}/"> - Next:<br/> - <img src="{{ object.next.thumburl}}" alt="{{ object.next.title }}"/> - </a> -</div></div> - -{% endif %} -{% if object.prev %} -<div class="right_stuff" style="clear: right;"> -<div class="small-image-box"> -<br /> <br /><br /> <br /> - <a href="../{{ object.prev.id }}/"> - Previous:<br /> - <img src="{{ object.prev.thumburl}}" alt="{{ object.prev.title }}"/> - </a> -</div> -</div> -{% endif %} - -<center> -<div id="centerize"> - <a href="{{ object.fullurl }}"> - <img src="{{ object.dispurl }}" - alt="{{ object.title }}" /> - </a> - <div> - <p class="photodesc"> {{ object.desc|safe }} </p> - {% if object.extra %} - <h3 class="photoextra">More information</h3> - <p class="photoextra">{{ object.extra|safe }}</p> - {% endif %} - </div> -</div> -</center> -{% if object.prev %} - <a href="../{{ object.prev.id }}/" class="lefty"> - « previous - </a> -{% endif %} -{% if object.next %} - <a href="../{{ object.next.id }}/" class="righty"> - next » - </a> -{% endif %} -<br /> - -<!-- -{% if not user.is_anonymous %} -<p> - <a href="{{ admin_url }}/photos/photo/{{ object.id }}/"> - Edit this image. - </a> -</p> -{%else %} -<p> - <a href="/accounts/login/?next={{ request.path }}"> - Login</a> to edit this image. -</p> -{% endif %} ---> -{% else %} -<p>This is not the photo you are looking for.</p> -{% endif %} -{% endblock %} - -{% block commentary %} -<div class='content' id='commentary'> -<h3>Post a comment</h3> -{% render_comment_form for object %} -{% get_comment_list for object as comments %} -{% include "comment_list" %} -</div> -{% endblock %} diff --git a/bn_django/photos/urls.py b/bn_django/photos/urls.py deleted file mode 100644 index 233ccc4..0000000 --- a/bn_django/photos/urls.py +++ /dev/null @@ -1,23 +0,0 @@ -from django.conf.urls.defaults import * -from django.conf import settings - -from models import Gallery, Photo, ADMIN_URL, STOCKPHOTO_URL - -info_dict = { 'extra_context': { 'admin_url': ADMIN_URL, - 'stockphoto_url': STOCKPHOTO_URL} } - -urlpatterns = patterns('django.views.generic.list_detail', - (r'^$', 'object_list', - dict(info_dict, queryset=Gallery.objects.order_by('-date'), - paginate_by=35, allow_empty= True)), - (r'^(?P<slug>[\d\w-]+)/$', 'object_detail', - dict(info_dict, queryset=Gallery.objects.all(), slug_field='slug')), - (r'^(?P<object_id>\d+)/$', 'object_detail', - dict(info_dict, queryset=Gallery.objects.all())), - (r'^detail/(?P<object_id>\d+)/$', 'object_detail', - dict(info_dict, queryset=Photo.objects.all())), -) -urlpatterns += patterns('bn_django.photos.views', - (r'^import/(?P<thegallery>\d+)/$', 'import_photos'), - #(r'^export/(\d+)/$', 'export'), -) diff --git a/bn_django/photos/views.py b/bn_django/photos/views.py deleted file mode 100644 index a6459f6..0000000 --- a/bn_django/photos/views.py +++ /dev/null @@ -1,185 +0,0 @@ -# Create your views here. - -# django imports -from django.conf import settings -from django import forms, http, template -from django.contrib.auth.decorators import login_required -from django.shortcuts import get_object_or_404, render_to_response -from django.http import HttpResponse - -# other imports -import zipfile -import os -import stat -import shutil -from datetime import datetime -from tempfile import NamedTemporaryFile, mkdtemp -import Image -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO - -# Handling settings here -try: - STOCKPHOTO_BASE = settings.STOCKPHOTO_BASE.strip('/') -except AttributeError: - STOCKPHOTO_BASE = 'photos' - -# models -from bn_django.photos.models import Gallery, Photo - -# views - -class ImportForm(forms.Form): - zipfile = forms.FileField() - photographer = forms.CharField() - date = forms.DateField() - - def valid_zipfile(self, field_data, all_data): - zip_file = StringIO(field_data['content']) - zip = zipfile.ZipFile(zip_file) - return not zip.testzip() - -@login_required -def import_photos(request, thegallery): - """Import a batch of photographs uploaded by the user. - - Import a batch of photographs uploaded by the user, all with - the same information for gallery, photographer and date. The - title will be set from the filename, and the description will be - blank. Self-respecting photographers will edit the fields for - each photograph; this is just a way to get a bunch of photographs - uploaded quickly. - - The photographs should be wrapped up in a zip archive. The - archive will be unpacked (and flattened) in a temporary directory, - and all image files will be identified and imported into the - gallery. Other files in the archive will be silently ignored. - - After importing the images, the view will display a page which may - contain the number of images imported, and a link to the gallery - into which the images were imported. - """ - # Check if the gallery is valid - gallery = get_object_or_404(Gallery, pk=thegallery) - # And that the user has permission to add photos - if not request.user.has_perm('gallery.add_photo'): - return http.HttpResponseForbidden("No permission to add photos") - - if request.POST: - #new_data = request.POST.copy() - #new_data.update(request.FILES) - form = ImportForm(request.POST, request.FILES) - if not form.is_valid(): - return render_to_response('photos/import_form.html', - dict(form=form, gallery=gallery)) - # So now everything is okay - f = request.FILES['zipfile'] # the zip"file" - zip = zipfile.ZipFile(f) - date = request.POST['date'] - if not date: - date = datetime.date(datetime.now()) - destdir= os.path.join(settings.MEDIA_ROOT, STOCKPHOTO_BASE, - datetime.strftime(datetime.now(), "%Y/%m/%d/")) - - if not os.path.isdir(destdir): - os.makedirs(destdir, 0775) - for filename in zip.namelist(): - photopath = os.path.join(destdir, os.path.basename(filename)) - data = zip.read(filename) - file_data = StringIO(data) - try: - Image.open(file_data) - except: - # don't save and process non Image files - continue - photo = file(photopath, "wb") - photo.write(data) - f = photo - - # Create the object - if photopath.startswith(os.path.sep): - photopath = photopath[len(settings.MEDIA_ROOT):] - photo = Photo(image=photopath, date=date, - photographer=request.POST['photographer'], - title = 'untitled', - gallery_id = thegallery) - - # Save it -- the thumbnails etc. get created. - photo.save() - - # Try to harvest EXIF data - try: - import EXIF - tags = EXIF.process_file(open(photo.image.path)) - try: - if tags.has_key('Image DateTime'): - exifdate = tags['Image DateTime'].printable - photo.date = apply(datetime, map(int, exifdate.split(' ')[0].split(':'))) - except Exception, E: - print E - pass - try: - if tags.has_key('EXIF UserComment'): - exiftitle = tags['EXIF UserComment'].printable - if not exiftitle == []: - photo.title = exiftitle - - except Exception, E: - print E - pass - try: - if tags.has_key('Image Orientation'): - exifrot = tags['EXIF UserComment'].printable - if exifrot == 'Rotated 90 CCW': - #DO ROTATION - pass - except Exception, E: - print E - pass - except Exception, E: - print E - pass - finally: - photo.save() - - # And jump to the directory for this gallery - response = http.HttpResponseRedirect(gallery.get_absolute_url()) - response['Pragma'] = 'no cache' - response['Cache-Control'] = 'no-cache' - return response - else: - form = ImportForm() - return render_to_response('photos/import_form.html', - dict(form=form, gallery=gallery)) - # request, - -#@login_required -#def export(request, thegallery): - #"""Export a gallery to a zip file and send it to the user. - #""" - ## Check if the gallery is valid - #gallery = get_object_or_404(Gallery, pk=thegallery) - # - ## gather up the photos into a new directory - #tmpdir = mkdtemp() - #for photo in gallery.photo_set.all(): - #shutil.copy(photo.get_image_filename(), - #tmpdir) - #files = [ os.path.join(tmpdir, ff) for ff in os.listdir(tmpdir) ] - #outfile = NamedTemporaryFile() - #zf = zipfile.ZipFile(outfile, "w", - #compression=zipfile.ZIP_DEFLATED) - #for filename in files: - #zf.write(filename, arcname=os.path.basename(filename)) - #zf.close() - ##outfile.flush() - #outfile.seek(0) - #shutil.rmtree(tmpdir) - #response = HttpResponse(outfile) - #response['Content-Type'] = "application/zip" - #response['Content-Length'] = str(os.stat(outfile.name)[stat.ST_SIZE]) - #response['Content-Disposition'] = "attachment; filename=photos.zip" - #return response - # diff --git a/bn_django/settings.py.example b/bn_django/settings.py.example deleted file mode 100644 index c16b9c8..0000000 --- a/bn_django/settings.py.example +++ /dev/null @@ -1,91 +0,0 @@ -# Django settings for bn_django project. - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -ADMINS = ( - # ('Your Name', 'your_email@domain.com'), - ('Bryan Newbold', 'bnewbold@mit.edu'), -) - -MANAGERS = ADMINS - -DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. -DATABASE_NAME = '/home/bnewbold/bn-project/bn_django/bn_django.db' # Or path to database file if using sqlite3. -DATABASE_USER = '' # Not used with sqlite3. -DATABASE_PASSWORD = '' # Not used with sqlite3. -DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. - -# Local time zone for this installation. All choices can be found here: -# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE -TIME_ZONE = 'America/Boston' - -# Language code for this installation. All choices can be found here: -# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes -# http://blogs.law.harvard.edu/tech/stories/storyReader$15 -LANGUAGE_CODE = 'en-us' - -SITE_ID = 1 - -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. -USE_I18N = True - -# Absolute path to the directory that holds media. -# Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = '/home/bnewbold/bn-project/static/' - -# URL that handles the media served from MEDIA_ROOT. -# Example: "http://media.lawrence.com" -MEDIA_URL = '/static/' - -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = '/static/django-admin/' - -# Make this unique, and don't share it with anybody. -SECRET_KEY = 'jdsgk29845ldsfg0090204tv(GFD8g0(%$)*@$#R%U)#*ifd;/q' - -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.load_template_source', - 'django.template.loaders.app_directories.load_template_source', -# 'django.template.loaders.eggs.load_template_source', -) - -MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', - 'django.contrib.csrf.middleware.CsrfMiddleware', - 'django.middleware.doc.XViewMiddleware', -) - -ROOT_URLCONF = 'bn_django.urls' - -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. - '/home/bnewbold/bn-project/bn_django/templates', -) - -INSTALLED_APPS = ( - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.admin', - 'django.contrib.flatpages', - 'django.contrib.markup', - 'django.contrib.comments', - 'bn_django.photos', - 'bn_django.git_wiki', - 'bn_django.journal', -) - -#Don't have much memory, so never use MemoryFileUploadHandler -FILE_UPLOAD_HANDLERS = ("django.core.files.uploadhandler.TemporaryFileUploadHandler", ) diff --git a/bn_django/templates/404.html b/bn_django/templates/404.html deleted file mode 100644 index e1f116e..0000000 --- a/bn_django/templates/404.html +++ /dev/null @@ -1,3 +0,0 @@ -{% extends "base.html"%} -{% block title %}For oh four{% endblock %} -{% block content %}Whoopsie!{% endblock %} diff --git a/bn_django/templates/500.html b/bn_django/templates/500.html deleted file mode 100644 index 78786b7..0000000 --- a/bn_django/templates/500.html +++ /dev/null @@ -1,3 +0,0 @@ -{% extends "base.html"%} -{% block title %}Server Error{% endblock %} -{% block content %}Sorry...{% endblock %} diff --git a/bn_django/templates/about.html b/bn_django/templates/about.html deleted file mode 100644 index 39ac311..0000000 --- a/bn_django/templates/about.html +++ /dev/null @@ -1,29 +0,0 @@ -{% extends "base.html" %} - -{% block path %}{% endblock %} - -{% block title %}About bnewbold.net{% endblock %} - -{% block right_stuff %} -{% endblock %} - -{% block content %} -<div class="righty_content"> - <img src="/static/img/orange_small.jpg" - alt="the author" /> - <br /> - <div class="content_caption">the perp</div> -</div> -This website is the web presence of Bryan Newbold. Chunks of the homunculus -include: -<dl> - <dt /><a href="http://know.bnewbold.net/">brain dump</a> - <dt /><a href="/photos/">photo gallery</a> - <dt /><a href="http://journal.bnewbold.net/">journal</a> - <dt /><a href="http://feeds.bnewbold.net/">rss aggregator</a> - <dt /><a href="http://git.bnewbold.net/">browsable code repository</a> -</dl> -<p /> -There's a lot of borrowed software under the hood; see <a -href="/credits/">credits</a>. -<br /> {% endblock %} diff --git a/bn_django/templates/base.html b/bn_django/templates/base.html deleted file mode 100644 index 568bf62..0000000 --- a/bn_django/templates/base.html +++ /dev/null @@ -1,64 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -{% block stylesheets %} -<link rel="stylesheet" type="text/css" href="/static/style/reset.css" /> -<link rel="stylesheet" type="text/css" href="/static/style/default.css" /> -<link rel="stylesheet" type="text/css" href="/static/style/commentary.css" /> -<link rel="icon" href="http://static.bnewbold.net/img/nudie_favicon.png" /> -{% endblock %} -{% block externaljs %} {% endblock %} {% block otherhead %} {% endblock %} -<title>{% block windowtitle %}bnewbold.net{% endblock %}</title> -</head> -<body> -<div id="top_bar"> - <div id="top_bar_content"> - <span class="righty"> - <a href="http://journal.bnewbold.net">journal</a> - <a href="/photos/">photos</a> - <a href="http://git.bnewbold.net/">code</a> - <a href="http://know.bnewbold.net/">knowledge</a></span> - <span class="lefty"><a href="/">bnewbold.net</a></span> - </div> -</div> -<div class="content" id="main_title"> -<div class="right_stuff"> -<form name="search" method="get" action="https://www.google.com/search"> -<br/> -<input class="search_box" type="text" size="21" value=" search!" - name="q" id="search_text" - onfocus="var box=document.forms['search'].elements['q']; if(box.value == ' search!') box.value=''; return;" /> -<input type="hidden" name="domains" value="bnewbold.net" /> -<input type="hidden" name="sitesearch" value="bnewbold.net" /> -</form> -<span class="righty"></span> -</div> -<span class="path"> -{% block path %}{% endblock %} -</span> -<h1 class="pagetitle">{% block title %}Hey Hey Hey!{% endblock %}</h1> -<h2 class="pagesubtitle">{% block subtitle %}{% endblock %}</h2> -<div class="right_stuff"> -{% block right_stuff %} -{% endblock %} -</div> -</div> - - -<div class="content" id="main_content"> -{% block content %} -Here lies content! -{% endblock %} -</div> -{% block commentary %} {% endblock %} -<div class="content_footer" id="footer"> - -<a href="/">home</a> -<a href="/about/">about</a> -<a href="/credits/">credits</a> -<a href="mailto:webmeisterATbnewbold.net">email the webmaster</a> -produced 2007-2015 by bryan newbold, <a href="/copyright/">all rights ignored</a> -</div> -</body> -</html> diff --git a/bn_django/templates/comment_list b/bn_django/templates/comment_list deleted file mode 100644 index d00dc6a..0000000 --- a/bn_django/templates/comment_list +++ /dev/null @@ -1,41 +0,0 @@ -{% if comments or free_comments %} -{% comment %}TODO: this needs to be rewriten!{% endcomment %} - -<br /> -<table class="comments"> -{% for c in comments %} -<tr><td class="comment_info"> - Posted by <span class="comment_user"> - {% if c.user.username %} {{ c.user.username }} - {% else %}{{ c.user_name }} {% endif %}</span><br /> - on <span class="comment_date"> - {{ c.submit_date|date:"F j, Y" }}</span><br /> - at <span class="comment_time">{{ c.submit_date|date:"H:i" }}</span> - </td><td class="comment_content"> - {% if c.headline %} - <span class="comment_headline">{{ c.headline|escape|wordwrap:80 }}</span> - <br /> - {% endif %} - <span class="comment_content">{{ c.comment|escape|linebreaks|wordwrap:80 }}</span> -</td></tr> -{% endfor %} -{% for c in free_comments %} -<tr><td class="comment_info"> - Posted by <span class="comment_user"> - {% if c.person_name %}{{ c.person_name}}{% else %}anonymous{% endif %}</span><br /> - on <span class="comment_date"> - {{ c.submit_date|date:"F j, Y" }}</span><br /> - at <span class="comment_time">{{ c.submit_date|date:"H:i T" }}</span> - </td><td class="comment_content"> - {% if c.headline %} - <span class="comment_headline">{{ c.headline|escape|wordwrap:80 }}</span> - <br /> - {% endif %} - <span class="comment_content">{{ c.comment|escape|wordwrap:80 }}</span> -</td></tr> -{% endfor %} -</table> -<br /><br /> -{% else %} -<h3>No comments yet!</h3> -{% endif %} diff --git a/bn_django/templates/comments/form.html b/bn_django/templates/comments/form.html deleted file mode 100644 index e69de29..0000000 --- a/bn_django/templates/comments/form.html +++ /dev/null diff --git a/bn_django/templates/comments/posted.html b/bn_django/templates/comments/posted.html deleted file mode 100644 index e3eb0d2..0000000 --- a/bn_django/templates/comments/posted.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %}{% trans "Thanks for your comment" %}.{% endblock %} - -{% block content %} -<br /> -{% endblock %} diff --git a/bn_django/templates/comments/preview.html b/bn_django/templates/comments/preview.html deleted file mode 100644 index dbbc6c3..0000000 --- a/bn_django/templates/comments/preview.html +++ /dev/null @@ -1,69 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %}{% trans "Comment Submission" %}{% endblock %} - -{% block content %}</div><div class='content' id='commentary'> -<br /> - {% load comments %} - <form action="{% comment_form_target %}" method="post"> - {% if form.errors %} - <h4>{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}</h4> - {% else %} - <h4>{% trans "Preview your comment:" %}</h4> - -<table class="comments"> -{% if comment.person_name %} -<tr><td class="comment_info"> - Posted by <span class="comment_user"> - {% if comment.person_name %}{{ comment.person_name}}{% else %}anonymous{% endif %}</span><br /> - on <span class="comment_date"> - {{ comment.submit_date|date:"F j, Y" }}</span><br /> - at <span class="comment_time">{{ comment.submit_date|date:"H:i T" }}</span> - </td><td class="comment_content"> - {% if comment.headline %} - <span class="comment_headline">{{ comment.headline|escape|wordwrap:80 }}</span> - <br /> - {% endif %} - <span class="comment_content">{{ comment|escape|wordwrap:80 }}</span> -</td></tr> -{% else %} -<tr><td class="comment_info"> - Posted by <span class="comment_user"> - {% if comment.user.username %} {{ comment.user.username }} - {% else %}{{ comment.user_name }} {% endif %}</span><br /> - on <span class="comment_date"> - {{ comment.submit_date|date:"F j, Y" }}</span><br /> - at <span class="comment_time">{{ comment.submit_date|date:"H:i" }}</span> - </td><td class="comment_content"> - {% if comment.headline %} - <span class="comment_headline">{{ comment.headline|escape|wordwrap:80 }}</span> - <br /> - {% endif %} - <span class="comment_content">{{ comment|escape|wordwrap:80 }}</span> -</td></tr> -{% endif %} -</table> - <p> - {% trans "and" %} <input type="submit" name="submit" class="submit-post" value="{% trans "Post your comment" %}" id="submit" /> {% trans "or make changes" %}: - </p> - {% endif %} -<table> - {% for field in form %} {% if field.is_hidden %} {{ field }} {% else %} - {% ifequal field.name "honeypot" %} - <span style="display:none;">{{ field.label_tag }}{{ field }}</span> - {% else %} -<tr><td class="comment_field_name"> - <span {% if field.errors %} class="error"{% endif %}> - {{ field.label_tag }} - </span></td><td>{{ field }} - {% if field.errors %}{{ field.errors }}{% endif %} -</td></tr> {% endifequal %} {% endif %} {% endfor %} -<tr><td class="comment_field_name"></td><td> - <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" /> - <input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" /> - <i>(no HTML or other markup)</i> -</td></tr> -</table> - -{% endblock %} diff --git a/bn_django/templates/copyright.html b/bn_django/templates/copyright.html deleted file mode 100644 index c48b304..0000000 --- a/bn_django/templates/copyright.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Fuck Copyrights{% endblock %} - -{% block right_stuff %} -{% endblock %} - -{% block content %} -<p />I'm not a big fan of copyrights or licensing. Feel free to use the content and code from this website however you please. I would appreciate attribution or at least letting me know if you're doing something cool, but it's not required. -<p />If I had to chose a license it would probably be MIT or BSD style. -<p />I don't think I've violated any other person's rights, but if you think something is a copied and/or unattributed drop a dime! -{% endblock %} diff --git a/bn_django/templates/credits.html b/bn_django/templates/credits.html deleted file mode 100644 index 954a26d..0000000 --- a/bn_django/templates/credits.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Software credits{% endblock %} - -{% block right_stuff %} -{% endblock %} - -{% block content %} -This site uses a variety of delicious software! -<h3>operating system</h3> -<p />It's <a href="http://freebsd.org">freeBSD</a> under the hood when not hosted elsewhere. -<h3>web framework</h3> -<p />The site is powered by the <a href="http://djangoproject.com/">django</a> toolkit (which runs on <a href="http://python.org">python</a>). -<p />I use the <a href="http://www.carcosa.net/jason/software/django/stockphoto/">stockphoto</a> app written by Jason McBrayer for the photos section. -<h3>text editor</h3> -<p /><a href="http://vim.org">vim</a>! fuck emacs! -<h3>versioning system</h3> -<p />I use git as a revisioning system for the <a href="/knowledge/">knowledge wiki</a> and my <a href="/code/">software</a> (including this site!). - -{% endblock %} diff --git a/bn_django/templates/flatpages/default.html b/bn_django/templates/flatpages/default.html deleted file mode 100644 index 49c773a..0000000 --- a/bn_django/templates/flatpages/default.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ flatpage.title }}{% endblock %} - -{% block content %} -{{ flatpage.content }} -{% endblock %} diff --git a/bn_django/templates/frontpage.html b/bn_django/templates/frontpage.html deleted file mode 100644 index 6d3652a..0000000 --- a/bn_django/templates/frontpage.html +++ /dev/null @@ -1,97 +0,0 @@ -{% extends "base.html" %} - -{% block stylesheets %} -<link rel="openid.server" href="http://www.myopenid.com/server" /> -<link rel="openid.delegate" href="http://bnewbold.myopenid.com" /> -<meta http-equiv="X-XRDS-Location" - content="http://bnewbold.myopenid.com/xrds" /> -<link rel="STYLESHEET" type="text/css" href="/static/style/git_wiki.css" /> - -{{ block.super }}{% endblock %} - -{% block path %}{% endblock %} - -{% block title %}{% endblock %} - -{% block right_stuff %} -<br /> -<br /> -<br /> -<br /> -RSS feeds: <br /> -{% comment %} - <a href="/journal/rss/latest_entries/"> journal entries</a><br />{% endcomment %} - - <a href="/journal/rss/latest_links/"> web links</a><br /> - - <a href="http://git.bnewbold.net/?p=bnewnet.git;a=rss;opt=--no-merges"> site code changes</a><br /> -<br /><br /> -Other sites: <br /> - - <a href="https://github.com/bnewbold"> github</a><br /> - - <a href="https://keybase.io/bnewbold"> keybase</a><br /> - - <a href="http://equator.memeschemes.com"> equator</a><br /> -{% endblock %} - -{% block content %} -<br /> -<center><img style="border: none;" src="/static/img/iceland_beach.jpg"></center> -<br /> -<br /> - <h3>Where am I?</h3> -As of Fall 2015 I am living in Seattle (WA) working as a freelance embedded -engineer. I spent the last year working remotely, building digital control -systems for optical atomic magnetometers at -<a href="http://www.twinleaf.com">Twinleaf </a>, a small company headquartered -in Princeton, NJ. - -<!-- -As of Summer 2014 i'm living in Princeton (NJ) building digital control systems -for optical atomic magnetometers for a <a href="http://www.twinleaf.com">small -company</a>. I spent the last year living in a co-op in Cambridge (MA) working -on various embedded engineering projects. In the fall I will be moving to West -to Seattle. ---> -<!-- -As of Fall 2012 i'm living in Berlin designing an open wireless router called -<a href="http://rooter.is">rooter</a>. I spent the past year living in New York -City working at <a href="http://octopart.com">Octopart</a> (an electronic parts -search engine), building <a href="http://thefnf.org">Free Networks</a>, -watching <a href="http://toorcamp.org">blinkenlights</a> on far shores, and -tramping around Iceland and the UK. ---> -<!-- - As of Spring 2011 I am living in New York City working at <a - href="http://octopart.com">Octopart</a>. I spent the past year working with - friends at <a href="http://leaflabs.com">LeafLabs</a> (an open source hardware - startup in Cambridge) and the <a href="http://www.cfa.harvard.edu/">Harvard - Center for Astrophysics</a>, as well as traveling to Newfoundland/Labrador and - <a href="http://s3.amazonaws.com/data.tumblr.com/tumblr_lf6yjdx8mB1qae4w7o1_1280.jpg?AWSAccessKeyId=AKIAJ6IHWSU3BX3X7X3Q&Expires=1305862294&Signature=eHzThxstLcQh5FE%2FJlmfX8YMyjs%3D">Iceland</a>. ---> - -<i><a href="/whatsup/"> More...</a></i> -<br /> - -<br /> - -<!-- -<h2 class="ruled">Photos!</h2> -{% if latest_galleries %} - Most recently I have shots from: - {% for gallery in latest_galleries %} - <a href="{{gallery.get_absolute_url}}">{{gallery.title}}</a> - {% endfor %} -{% endif %} -{% if latest_photos %} -<br /> -<table class="thumbs" width="100%"><tbody><tr> -{% for photo in latest_photos %} -<td class="photo_thumb"> -<a href="{{ photo.get_absolute_url }}"><img src="{{ photo.thumburl }}" - alt="{{ photo.title }}" /></a> </td> -{% endfor %} -</tbody></table> -{% else %} -<br/><br />None yet! -{% endif %} -<br /> -<br /><br /> ---> -{% endblock %} - diff --git a/bn_django/templates/newcomments_table b/bn_django/templates/newcomments_table deleted file mode 100644 index c01863d..0000000 --- a/bn_django/templates/newcomments_table +++ /dev/null @@ -1,16 +0,0 @@ -<table class="listing"> -{% for c in latest_comments %} -<tr> - <td class="date"> - {{ c.submit_date|date:"F jS" }}</td> - <td class="description"> - {% if c.user.username %}{{ c.user.username }} - {% else %}{{c.user_name}}{% endif%} </td> - <td class="description"> - {{ c.comment|truncatewords:10 }} - <td class="description"> - <a href="{{c.get_content_object_url}}"> - {{ c.content_type.name }}</a></td> - </tr> -{% endfor %} -</table> diff --git a/bn_django/templates/newknowldge_table b/bn_django/templates/newknowldge_table deleted file mode 100644 index 686a12f..0000000 --- a/bn_django/templates/newknowldge_table +++ /dev/null @@ -1,13 +0,0 @@ -{% if latest_knowledge %} -<table class="listing"> -{% for l in latest_knowledge %} -<tr> - <td class="date"> - {{ l.date }}</td> - <td class="description"> - <a href="/k/commit/{{ l.hash }}/" class="description"> - {{ l.description|truncatewords:6 }}</a></td> - </tr> -{% endfor %} -</table> -{% else %}No shortlog!{% endif %} diff --git a/bn_django/templates/nogo.html b/bn_django/templates/nogo.html deleted file mode 100644 index ca83269..0000000 --- a/bn_django/templates/nogo.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Unstable{% endblock %} - -{% block right_stuff %} -{% endblock %} - -{% block content %} -The dynamic portions of this website are extremely unstable right now, leading -to runaway cpu utilization on my virtual host and locking up of more imporant -services (static html, etc). So for the time being i'm freezing large portions, -hopefully everything will be back soon; a number of new python wrappers for python look promising and i'm excited to implement jsMath to replace the current clunky math system. - -For now try a more generic git cgi interface to my content at <a href="http://git.bnewbold.net/">http://git.bnewbold.net</a>. -{% endblock %} diff --git a/bn_django/templates/search.html b/bn_django/templates/search.html deleted file mode 100644 index 27fb35d..0000000 --- a/bn_django/templates/search.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Search?{% endblock %} - -{% block right_stuff %} -{% endblock %} - -{% block content %} -<p />Seach isn't implemented yet! -{% endblock %} diff --git a/bn_django/templates/static/directory_index b/bn_django/templates/static/directory_index deleted file mode 100644 index 61e7f02..0000000 --- a/bn_django/templates/static/directory_index +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "base.html" %} - -{% block title %} -<h1>Index of /{{ directory }}</h1> -{% endblock %} - -{% block content %} -<br /> -<ul> -{% for f in file_list %} -<li><a href="{{ f }}">{{ f }}</a></li> -{% endfor %} -</ul> -<br /> -<br /> -<br /> - -{% endblock %} diff --git a/bn_django/urls.py.example b/bn_django/urls.py.example deleted file mode 100644 index df261c7..0000000 --- a/bn_django/urls.py.example +++ /dev/null @@ -1,63 +0,0 @@ -from django.conf import settings -from django.conf.urls.defaults import * -from photos.models import Photo, Gallery -from django.contrib.comments.models import Comment -from django.contrib import admin -import git_wiki.models - -admin.autodiscover() - -urlpatterns = patterns('', - # Example: - # (r'^bn_django/', include('bn_django.foo.urls')), - (r'^$', 'django.views.generic.simple.direct_to_template', - {'template': 'frontpage.html','extra_context':dict({ \ - 'latest_photos':Photo.objects.order_by('-date')[:2], \ - 'latest_galleries':Gallery.objects.order_by('-date')[:4], \ - #'latest_comments':Photo.objects.order_by('date')[:4] \ - 'latest_knowledge':git_wiki.models.shortlog(), \ - 'latest_comments':Comment.objects.order_by('-submit_date')[:8], \ - 'newitems':git_wiki.models.newest_items(), \ - })}), - (r'^about/$', 'django.views.generic.simple.direct_to_template', - {'template': 'about.html'}), - (r'^credits/$', 'django.views.generic.simple.direct_to_template', - {'template': 'credits.html'}), - (r'^copyright/$', 'django.views.generic.simple.direct_to_template', - {'template': 'copyright.html'}), - - (r'^knowledge/$', 'bn_django.git_wiki.views.frontpage',), - #(r'^k/$', 'django.views.generic.simple.direct_to_template', - # {'template': 'nogo.html'}), - (r'^k/', include('bn_django.git_wiki.urls')), - (r'^code/$', 'django.views.generic.simple.direct_to_template', - {'template': 'nogo.html'}), - #(r'^code/', include('bn_django.git_browse.urls')), - (r'^photos/', include('bn_django.photos.urls')), - - #(r'^search/', include('bn_django.search.urls')), - - # Uncomment this for admin: - (r'^admin/doc/', include('django.contrib.admindocs.urls')), - (r'^admin/(.*)', admin.site.root), - (r'^comments/', include('django.contrib.comments.urls')), - - (r'^journal/', include('bn_django.journal.urls')), - (r'^artifacts/$', 'django.views.generic.simple.direct_to_template', - {'template': 'journal/artifacts.html'}), - (r'^artifacts/', include('bn_django.journal.artifact_urls')), - - # uncomment for development - #(r'^static/(?P<path>.*)$', 'django.views.static.serve', - # {'document_root': '/home/bnewbold/code/bn-project/static', - # 'show_indexes': True}), - #(r'^style/(?P<path>.*)$', 'django.views.static.serve', - # {'document_root': '/home/bnewbold/code/bn-project/static/style'}), - #(r'^media/(?P<path>.*)$', 'django.views.static.serve', - # {'document_root': '/home/bnewbold/code/bn-project/media'}), -) - -if settings.DEBUG: - urlpatterns += patterns('', - (r'^static/(?P<path>.*)$', 'django.views.static.serve', - {'document_root': '/path/to/media'}), ) |