aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@eta.mit.edu>2009-01-25 13:05:25 -0500
committerbnewbold <bnewbold@eta.mit.edu>2009-01-25 13:05:25 -0500
commit75bc6a976f98e36a9426e6115d3f628a8fa73762 (patch)
treeabf42e0d4b94146506e0208a08afe8758eb11a93
parent296dc07f010d8692028db682d02ef3e88e525f01 (diff)
downloadbnewnet-75bc6a976f98e36a9426e6115d3f628a8fa73762.tar.gz
bnewnet-75bc6a976f98e36a9426e6115d3f628a8fa73762.zip
whew artifact stuff, all basic style
-rw-r--r--.gitignore1
-rw-r--r--bn_django/journal/artifact_urls.py27
-rw-r--r--bn_django/journal/models.py10
-rw-r--r--bn_django/journal/templates/journal/artifacts.html16
-rw-r--r--bn_django/journal/templates/journal/codeartifact_detail.html36
-rw-r--r--bn_django/journal/templates/journal/codeartifact_list.html27
-rw-r--r--bn_django/journal/templates/journal/entry_list.html2
-rw-r--r--bn_django/journal/templates/journal/imageartifact_detail.html40
-rw-r--r--bn_django/journal/templates/journal/imageartifact_list.html29
-rw-r--r--bn_django/journal/templates/journal/linkartifact_detail.html34
-rw-r--r--bn_django/journal/templates/journal/linkartifact_list.html27
-rw-r--r--bn_django/journal/templates/journal/microentry_detail.html32
-rw-r--r--bn_django/journal/templates/journal/microentry_list.html28
-rw-r--r--bn_django/journal/templates/journal/videoartifact_detail.html35
-rw-r--r--bn_django/journal/templates/journal/videoartifact_list.html27
-rw-r--r--bn_django/journal/urls.py12
-rw-r--r--bn_django/photos/models.py2
17 files changed, 375 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index dbae627..f9fc18b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ bn_django/git_browse/settings.py
knowledge
static/django-admin
static/latex2png
+static/artifacts
diff --git a/bn_django/journal/artifact_urls.py b/bn_django/journal/artifact_urls.py
new file mode 100644
index 0000000..9a3bde4
--- /dev/null
+++ b/bn_django/journal/artifact_urls.py
@@ -0,0 +1,27 @@
+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/models.py b/bn_django/journal/models.py
index 8836122..d296f1f 100644
--- a/bn_django/journal/models.py
+++ b/bn_django/journal/models.py
@@ -40,9 +40,9 @@ class MicroEntry(JournalCommon):
text_content = models.TextField("text version of content", blank=True,null=True)
class Artifact(JournalCommon):
- html_caption = models.TextField("html format caption", blank=False)
- text_caption = models.TextField("text format caption", blank=True,null=True)
- entry = models.ForeignKey(Entry, blank=True)
+ 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:
@@ -59,12 +59,11 @@ class CodeArtifact(Artifact):
blank=True)
class LinkArtifact(Artifact):
- url = models.URLField("external link to something wonderful!", blank=True)
+ url = models.URLField("external link to something wonderful!",verify_exists=False)
class ImageArtifact(Artifact,Photo):
"""Multiply inherets from the photo app
"""
- pass
def build_display_images(sender, instance, signal, *args, **kwargs):
"""Simple hook for save-after trigger
@@ -83,7 +82,6 @@ from django.contrib import admin
admin.site.register(Entry)
admin.site.register(MicroEntry)
admin.site.register(SubJournal)
-admin.site.register(Artifact)
admin.site.register(LinkArtifact)
admin.site.register(CodeArtifact)
admin.site.register(VideoArtifact)
diff --git a/bn_django/journal/templates/journal/artifacts.html b/bn_django/journal/templates/journal/artifacts.html
new file mode 100644
index 0000000..4b82573
--- /dev/null
+++ b/bn_django/journal/templates/journal/artifacts.html
@@ -0,0 +1,16 @@
+{% 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/codeartifact_detail.html b/bn_django/journal/templates/journal/codeartifact_detail.html
new file mode 100644
index 0000000..fefdea8
--- /dev/null
+++ b/bn_django/journal/templates/journal/codeartifact_detail.html
@@ -0,0 +1,36 @@
+{% extends "journal/base.html" %}
+{# {% load markup %} #}
+{% load comments %}
+{% block path %}<a href="/artifacts/">artifacts</a>
+ &raquo;<a href="/artifacts/code/"> code</a>
+ &raquo;<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
new file mode 100644
index 0000000..ee52afd
--- /dev/null
+++ b/bn_django/journal/templates/journal/codeartifact_list.html
@@ -0,0 +1,27 @@
+{% extends "journal/base.html" %}
+
+{% block path %}<a href="/artifacts/">artifacts</a>
+ &raquo;<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 }}">&laquo; previous</a> |
+{% endif %} {% if has_next %}
+<a href="./?page={{ next }}">next &raquo;</a>
+{% endif %} {% endif %}
+{% endblock %}
diff --git a/bn_django/journal/templates/journal/entry_list.html b/bn_django/journal/templates/journal/entry_list.html
index f103c4e..caa07af 100644
--- a/bn_django/journal/templates/journal/entry_list.html
+++ b/bn_django/journal/templates/journal/entry_list.html
@@ -8,7 +8,7 @@
{% if object_list %}
<ul>
{% for item in object_list %}
- <li /><a href="{{ item.slug }}/">{{item.title}}
+ <li /><a href="/journal/entries/{{ item.slug }}/">{{item.title}}
{% endfor %}
</ul>
{% else %}
diff --git a/bn_django/journal/templates/journal/imageartifact_detail.html b/bn_django/journal/templates/journal/imageartifact_detail.html
new file mode 100644
index 0000000..45ea1aa
--- /dev/null
+++ b/bn_django/journal/templates/journal/imageartifact_detail.html
@@ -0,0 +1,40 @@
+{% extends "journal/base.html" %}
+{# {% load markup %} #}
+{% load comments %}
+{% block path %}<a href="/artifacts/">artifacts</a>
+ &raquo;<a href="/artifacts/images/"> images</a>
+ &raquo;<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
new file mode 100644
index 0000000..6530773
--- /dev/null
+++ b/bn_django/journal/templates/journal/imageartifact_list.html
@@ -0,0 +1,29 @@
+{% extends "journal/base.html" %}
+
+{% block path %}<a href="/artifacts/">artifacts</a>
+ &raquo;<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/>,&nbsp;,&nbsp;,&nbsp; %}
+ <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 }}">&laquo; previous</a> |
+{% endif %} {% if has_next %}
+<a href="./?page={{ next }}">next &raquo;</a>
+{% endif %} {% endif %}
+{% endblock %}
diff --git a/bn_django/journal/templates/journal/linkartifact_detail.html b/bn_django/journal/templates/journal/linkartifact_detail.html
new file mode 100644
index 0000000..70f9656
--- /dev/null
+++ b/bn_django/journal/templates/journal/linkartifact_detail.html
@@ -0,0 +1,34 @@
+{% extends "journal/base.html" %}
+
+{% load comments %}
+
+{% block path %}<a href="/artifacts/">artifacts</a>
+ &raquo;<a href="/artifacts/links/"> links</a>
+ &raquo;<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
new file mode 100644
index 0000000..829e627
--- /dev/null
+++ b/bn_django/journal/templates/journal/linkartifact_list.html
@@ -0,0 +1,27 @@
+{% extends "journal/base.html" %}
+
+{% block path %}<a href="/artifacts/">artifacts</a>
+ &raquo;<a href="/artifacts/links/"> links</a>
+{% endblock %}
+
+{% block title %}Interesting Links{% endblock %}
+
+{% block content %}
+<br />
+{% if object_list %}
+<ul>
+ {% for item in object_list %}
+ <li /><a href="{{ item.id }}/">{{item.title}}</a>:
+ <i><a href="{{ item.url }}">{{item.url}}</a></i>
+ {% endfor %}
+</ul>
+{% else %}
+<p>No links have been entered yet.</p>
+{% endif %}
+
+{% if is_paginated %} {% if has_previous %}
+<a href="./?page={{ previous }}">&laquo; previous</a> |
+{% endif %} {% if has_next %}
+<a href="./?page={{ next }}">next &raquo;</a>
+{% endif %} {% endif %}
+{% endblock %}
diff --git a/bn_django/journal/templates/journal/microentry_detail.html b/bn_django/journal/templates/journal/microentry_detail.html
new file mode 100644
index 0000000..bb94853
--- /dev/null
+++ b/bn_django/journal/templates/journal/microentry_detail.html
@@ -0,0 +1,32 @@
+{% extends "journal/base.html" %}
+
+{% load comments %}
+{% block path %}{{ block.super }}
+ &raquo;<a href="/journal/microentries/"> microentries</a>
+ &raquo;<a href="/journal/microentries/{{ object.id }}"> {{ 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 }},{% 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
new file mode 100644
index 0000000..aac07e7
--- /dev/null
+++ b/bn_django/journal/templates/journal/microentry_list.html
@@ -0,0 +1,28 @@
+{% extends "journal/base.html" %}
+
+{% block path %}{{block.parent}}
+ &raquo;<a href="/journal/microentries/"> microentries</a>
+ &raquo;<a href="/journal/microentries/{{ object.id }}"> {{ object.title }}</a>{%endif%}
+
+{% block title %}Journal Micro-entries{% endblock %}
+
+{% block content %}
+<br />
+{% if object_list %}
+<ul>
+ {% for item in object_list %}
+ <li /><a href="/journal/microentries/{{ item.id }}/">
+ {% if item.title %}{{item.title}}{%else%}[Untitled]{%endif%}</a>
+ ({{item.date}})
+ {% endfor %}
+</ul>
+{% else %}
+<p>No entries have been entered yet.</p>
+{% endif %}
+
+{% if is_paginated %} {% if has_previous %}
+<a href="./?page={{ previous }}">&laquo; previous</a> |
+{% endif %} {% if has_next %}
+<a href="./?page={{ next }}">next &raquo;</a>
+{% endif %} {% endif %}
+{% endblock %}
diff --git a/bn_django/journal/templates/journal/videoartifact_detail.html b/bn_django/journal/templates/journal/videoartifact_detail.html
new file mode 100644
index 0000000..09b0ac2
--- /dev/null
+++ b/bn_django/journal/templates/journal/videoartifact_detail.html
@@ -0,0 +1,35 @@
+{% extends "journal/base.html" %}
+
+{% load comments %}
+{% block path %}<a href="/artifacts/">artifacts</a>
+ &raquo;<a href="/artifacts/videos/"> videos</a>
+ &raquo;<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
new file mode 100644
index 0000000..b5af050
--- /dev/null
+++ b/bn_django/journal/templates/journal/videoartifact_list.html
@@ -0,0 +1,27 @@
+{% extends "journal/base.html" %}
+
+{% block path %}<a href="/artifacts/">artifacts</a>
+ &raquo;<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 }}">&laquo; previous</a> |
+{% endif %} {% if has_next %}
+<a href="./?page={{ next }}">next &raquo;</a>
+{% endif %} {% endif %}
+{% endblock %}
diff --git a/bn_django/journal/urls.py b/bn_django/journal/urls.py
index 1730ac7..4267e17 100644
--- a/bn_django/journal/urls.py
+++ b/bn_django/journal/urls.py
@@ -1,12 +1,20 @@
from django.conf.urls.defaults import *
from django.conf import settings
-from models import Entry, MicroEntry, Artifact
+from models import Entry, MicroEntry
urlpatterns = patterns('django.views.generic.list_detail',
(r'^$', 'object_list',
dict(queryset=Entry.objects.order_by('-date'),
paginate_by=35, allow_empty=False)),
- (r'^(?P<slug>[\d\w-]+)/$', 'object_detail',
+ (r'^entries/$', 'object_list',
+ dict(queryset=Entry.objects.order_by('-date'),
+ paginate_by=35, allow_empty=False)),
+ (r'^entries/(?P<slug>[\d\w-]+)/$', 'object_detail',
dict(queryset=Entry.objects.all(), slug_field='slug')),
+ (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=MicroEntry.objects.all())),
)
diff --git a/bn_django/photos/models.py b/bn_django/photos/models.py
index 3d47cf0..fd31fa6 100644
--- a/bn_django/photos/models.py
+++ b/bn_django/photos/models.py
@@ -81,7 +81,7 @@ class Photo(models.Model):
upload_to= STOCKPHOTO_BASE + "/%Y/%m/%d/")
title = models.CharField("title", max_length=80)
desc = models.TextField("description", blank=True)
- gallery = models.ForeignKey(Gallery)
+ 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)