From 75bc6a976f98e36a9426e6115d3f628a8fa73762 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 25 Jan 2009 13:05:25 -0500 Subject: whew artifact stuff, all basic style --- bn_django/journal/artifact_urls.py | 27 +++++++++++++++ bn_django/journal/models.py | 10 +++--- bn_django/journal/templates/journal/artifacts.html | 16 +++++++++ .../templates/journal/codeartifact_detail.html | 36 +++++++++++++++++++ .../templates/journal/codeartifact_list.html | 27 +++++++++++++++ .../journal/templates/journal/entry_list.html | 2 +- .../templates/journal/imageartifact_detail.html | 40 ++++++++++++++++++++++ .../templates/journal/imageartifact_list.html | 29 ++++++++++++++++ .../templates/journal/linkartifact_detail.html | 34 ++++++++++++++++++ .../templates/journal/linkartifact_list.html | 27 +++++++++++++++ .../templates/journal/microentry_detail.html | 32 +++++++++++++++++ .../journal/templates/journal/microentry_list.html | 28 +++++++++++++++ .../templates/journal/videoartifact_detail.html | 35 +++++++++++++++++++ .../templates/journal/videoartifact_list.html | 27 +++++++++++++++ bn_django/journal/urls.py | 12 +++++-- bn_django/photos/models.py | 2 +- 16 files changed, 374 insertions(+), 10 deletions(-) create mode 100644 bn_django/journal/artifact_urls.py create mode 100644 bn_django/journal/templates/journal/artifacts.html create mode 100644 bn_django/journal/templates/journal/codeartifact_detail.html create mode 100644 bn_django/journal/templates/journal/codeartifact_list.html create mode 100644 bn_django/journal/templates/journal/imageartifact_detail.html create mode 100644 bn_django/journal/templates/journal/imageartifact_list.html create mode 100644 bn_django/journal/templates/journal/linkartifact_detail.html create mode 100644 bn_django/journal/templates/journal/linkartifact_list.html create mode 100644 bn_django/journal/templates/journal/microentry_detail.html create mode 100644 bn_django/journal/templates/journal/microentry_list.html create mode 100644 bn_django/journal/templates/journal/videoartifact_detail.html create mode 100644 bn_django/journal/templates/journal/videoartifact_list.html (limited to 'bn_django') 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\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\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\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\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 %}
+Oh golly oh golly! We've got + + + +Also check out journal entries and microentries. +{% 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 %}artifacts + » code + » {{ object.title }} +{% endblock %} + +{% block title %} +{% if object.title %}{{ object.title }}{% else %}[Untitled Code Snippet]{% endif %} +{% endblock %} + +{% block content %}
+{% if object %}
+

Code added {{ object.date }}, +{% if object.author %}
by {{ object.author }},{% endif %} +{% if object.last_edited %}
last edited {{ object.last_edited }}.{% endif %} +

+{% if object.language %}This is in {{object.language}}.

{%endif%} +
+{{object.code}}
+
+{% if object.html_caption|safe %}

{{object.html_caption}}{% endif %} +{% else %} +

This is not the artifact you are looking for.

+{% endif %} +{% endblock %} + +{% block commentary %} +
+{% get_comment_list for object as comments %} +{% include "comment_list" %} +

Post a comment

+{% render_comment_form for object %} +
+{% 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 %}artifacts + » code +{% endblock %} + +{% block title %}Code Snippets{% endblock %} + +{% block content %} +
+{% if object_list %} +
    + {% for item in object_list %} +
  • {{item.title}} + {% if item.language %} ({{item.language}}){% endif %} + {% endfor %} +
+{% else %} +

No code snippets have been uploaded yet.

+{% endif %} + +{% if is_paginated %} {% if has_previous %} +« previous | +{% endif %} {% if has_next %} +next » +{% 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 %} {% 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 %}artifacts + » images + » {{ object.title }} +{% endblock %} + +{% block title %} +{% if object.title %}{{ object.title }}{% else %}[Untitled Image]{% endif %} +{% endblock %} + +{% block content %}
+{% if object %}
+

Image uploaded {{ object.date }}, +{% if object.author %}
by {{ object.author }},{% endif %} +{% if object.last_edited %}
last edited {{ object.last_edited }}.{% endif %} +

+
+ +
+{% if object.html_caption %}

{{object.html_caption}}{% endif %} +{% else %} +

This is not the artifact you are looking for.

+{% endif %} +{% endblock %} + +{% block commentary %} +
+{% get_comment_list for object as comments %} +{% include "comment_list" %} +

Post a comment

+{% render_comment_form for object %} +
+{% 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 %}artifacts + » images{% endblock %} + +{% block title %}Uploaded Images{% endblock %} + +{% block content %} +
+{% if object_list %} + +{% for item in object_list %} {% cycle , , ,  %} + {% endfor %} +
+ + {{ item.title }} +
+{% else %} +

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.

{% endif %} + +{% if is_paginated %} {% if has_previous %} +« previous | +{% endif %} {% if has_next %} +next » +{% 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 %}artifacts + » links + » {{ object.title }} +{% endblock %} + +{% block title %} +{% if object.title %}{{ object.title }}{% else %}[Untitled Link]{% endif %} +{% endblock %} + +{% block content %}
+{% if object %}
+

Link created {{ object.date }}, +{% if object.author %}
by {{ object.author }},{% endif %} +{% if object.last_edited %}
last edited {{ object.last_edited }}.{% endif %} +

+{{object.url}} +{% if object.html_caption %}

{{object.html_caption|safe}}{% endif %} +{% else %} +

This is not the artifact you are looking for.

+{% endif %} +{% endblock %} + +{% block commentary %} +
+{% get_comment_list for object as comments %} +{% include "comment_list" %} +

Post a comment

+{% render_comment_form for object %} +
+{% 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 %}artifacts + » links +{% endblock %} + +{% block title %}Interesting Links{% endblock %} + +{% block content %} +
+{% if object_list %} + +{% else %} +

No links have been entered yet.

+{% endif %} + +{% if is_paginated %} {% if has_previous %} +« previous | +{% endif %} {% if has_next %} +next » +{% 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 }} + » microentries + » {{ object.title }} +{% endblock %} + +{% block title %} +{% if object.title %}{{ object.title }}{% else %}[Untitled Microentry]{% endif %} +{% endblock %} + +{% block content %}
+{% if object %}
+

dated {{ object.date }}, +{% if object.author %}
written by {{ object.author }},{% endif %} +{% if object.last_edited %}
last edited {{ object.last_edited }}.{% endif %} +

+

{{ object.html_content|safe }}

+{% else %} +

This is not the entry you are looking for.

+{% endif %} +{% endblock %} + +{% block commentary %} +
+{% get_comment_list for object as comments %} +{% include "comment_list" %} +

Post a comment

+{% render_comment_form for object %} +
+{% 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}} + » microentries + » {{ object.title }}{%endif%} + +{% block title %}Journal Micro-entries{% endblock %} + +{% block content %} +
+{% if object_list %} + +{% else %} +

No entries have been entered yet.

+{% endif %} + +{% if is_paginated %} {% if has_previous %} +« previous | +{% endif %} {% if has_next %} +next » +{% 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 %}artifacts + » videos + » {{ object.title }} +{% endblock %} + +{% block title %} +{% if object.title %}{{ object.title }}{% else %}[Untitled Video]{% endif %} +{% endblock %} + +{% block content %}
+{% if object %}
+

Video uploaded {{ object.date }}, +{% if object.author %}
by {{ object.author }},{% endif %} +{% if object.last_edited %}
last edited {{ object.last_edited }}.{% endif %} +

+{% if object.external_url %}View this video here

{%endif%} +Download the video. +

The video codec is {{ object.codec }}.
+{% if object.html_caption %}

{{object.html_caption|safe}}{% endif %} +{% else %} +

This is not the artifact you are looking for.

+{% endif %} +{% endblock %} + +{% block commentary %} +
+{% get_comment_list for object as comments %} +{% include "comment_list" %} +

Post a comment

+{% render_comment_form for object %} +
+{% 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 %}artifacts + » videos +{% endblock %} + +{% block title %}Videos{% endblock %} + +{% block content %} +
+{% if object_list %} +
    + {% for item in object_list %} +
  • {{item.title}} + {%if item.codec%} (codec: {{item.codec}}){% endif %} + {% endfor %} +
+{% else %} +

No videos have been entered yet.

+{% endif %} + +{% if is_paginated %} {% if has_previous %} +« previous | +{% endif %} {% if has_next %} +next » +{% 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[\d\w-]+)/$', 'object_detail', + (r'^entries/$', 'object_list', + dict(queryset=Entry.objects.order_by('-date'), + paginate_by=35, allow_empty=False)), + (r'^entries/(?P[\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\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) -- cgit v1.2.3