Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:nathanborror/django-basic-apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Borror committed Dec 10, 2009
2 parents ef4fe40 + 3f02e21 commit 4f66b74
Show file tree
Hide file tree
Showing 17 changed files with 243 additions and 47 deletions.
7 changes: 4 additions & 3 deletions basic/blog/templates/blog/category_detail.html
@@ -1,21 +1,22 @@
{% extends "blog/base_blog.html" %} {% extends "blog/base_blog.html" %}


{% load i18n %}


{% block title %}Posts for {{ category.title }}{% endblock %} {% block title %}{% trans "Posts for" %} {{ category.title }}{% endblock %}
{% block body_class %}{{ block.super }} category_detail{% endblock %} {% block body_class %}{{ block.super }} category_detail{% endblock %}
{% block body_id %}category_{{ category.id }}{% endblock %} {% block body_id %}category_{{ category.id }}{% endblock %}




{% block content_title %} {% block content_title %}
<h2>Posts for {{ category.title }}</h2> <h2>{% trans "Posts for" %} {{ category.title }}</h2>
{% endblock %} {% endblock %}




{% block content %} {% block content %}
<div class="post_list"> <div class="post_list">
{% for post in object_list %} {% for post in object_list %}
<div> <div>
<h3 class="title"><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h3> <h3 class="title"><a href="{{ post.get_absolute_url }}" title="{% trans "View this post" %}">{{ post.title }}</a></h3>
<p class="date">{{ post.publish|date:"Y F d" }}</p> <p class="date">{{ post.publish|date:"Y F d" }}</p>
<p class="tease">{{ post.tease|safe }}</p> <p class="tease">{{ post.tease|safe }}</p>
</div> </div>
Expand Down
7 changes: 4 additions & 3 deletions basic/blog/templates/blog/category_list.html
@@ -1,19 +1,20 @@
{% extends "blog/base_blog.html" %} {% extends "blog/base_blog.html" %}


{% load i18n %}


{% block title %}Post categories{% endblock %} {% block title %}{% trans "Post categories" %}{% endblock %}
{% block body_class %}{{ block.super }} category_list{% endblock %} {% block body_class %}{{ block.super }} category_list{% endblock %}




{% block content_title %} {% block content_title %}
<h2>Post categories</h2> <h2>{% trans "Post categories" %}</h2>
{% endblock %} {% endblock %}




{% block content %} {% block content %}
<ul class="link_list"> <ul class="link_list">
{% for category in object_list %} {% for category in object_list %}
<li><a href="{{ category.get_absolute_url }}">{{ category }}</a></li> <li><a href="{{ category.get_absolute_url }}" title="{% trans "View posts in this category" %}">{{ category }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock %} {% endblock %}
7 changes: 4 additions & 3 deletions basic/blog/templates/blog/post_archive_day.html
@@ -1,20 +1,21 @@
{% extends "blog/base_blog.html" %} {% extends "blog/base_blog.html" %}


{% load i18n %}


{% block title %}Post archive for {{ day|date:"d F Y" }}{% endblock %} {% block title %}{% trans "Post archive for" %} {{ day|date:"d F Y" }}{% endblock %}
{% block body_class %}{{ block.super }} post_archive_day{% endblock %} {% block body_class %}{{ block.super }} post_archive_day{% endblock %}




{% block content_title %} {% block content_title %}
<h2>Post archive for {{ day|date:"d F Y" }}</h2> <h2>{% trans "Post archive for" %} {{ day|date:"d F Y" }}</h2>
{% endblock %} {% endblock %}




{% block content %} {% block content %}
<div class="post_list"> <div class="post_list">
{% for post in object_list %} {% for post in object_list %}
<div> <div>
<h3 class="title"><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h3> <h3 class="title"><a href="{{ post.get_absolute_url }}" title="{% trans "View this post" %}">{{ post.title }}</a></h3>
<p class="date">{{ post.publish|date:"Y F d" }}</p> <p class="date">{{ post.publish|date:"Y F d" }}</p>
<p class="tease">{{ post.tease|safe }}</p> <p class="tease">{{ post.tease|safe }}</p>
</div> </div>
Expand Down
7 changes: 4 additions & 3 deletions basic/blog/templates/blog/post_archive_month.html
@@ -1,20 +1,21 @@
{% extends "blog/base_blog.html" %} {% extends "blog/base_blog.html" %}


{% load i18n %}


{% block title %}Post archive for {{ month|date:"F Y" }}{% endblock %} {% block title %}{% trans "Post archive for" %} {{ month|date:"F Y" }}{% endblock %}
{% block body_class %}{{ block.super }} post_archive_month{% endblock %} {% block body_class %}{{ block.super }} post_archive_month{% endblock %}




{% block content_title %} {% block content_title %}
<h2>Post archive for {{ month|date:"F Y" }}</h2> <h2>{% trans "Post archive for" %} {{ month|date:"F Y" }}</h2>
{% endblock %} {% endblock %}




{% block content %} {% block content %}
<div class="post_list"> <div class="post_list">
{% for post in object_list %} {% for post in object_list %}
<div> <div>
<h3 class="title"><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h3> <h3 class="title"><a href="{{ post.get_absolute_url }}" title="{% trans "View this post" %}">{{ post.title }}</a></h3>
<p class="date">{{ post.publish|date:"Y F d" }}</p> <p class="date">{{ post.publish|date:"Y F d" }}</p>
<p class="tease">{{ post.tease|safe }}</p> <p class="tease">{{ post.tease|safe }}</p>
</div> </div>
Expand Down
7 changes: 4 additions & 3 deletions basic/blog/templates/blog/post_archive_year.html
@@ -1,19 +1,20 @@
{% extends "blog/base_blog.html" %} {% extends "blog/base_blog.html" %}


{% load i18n %}


{% block title %}Post archive for {{ year }}{% endblock %} {% block title %}{% trans "Post archive for" %} {{ year }}{% endblock %}
{% block body_class %}{{ block.super }} post_archive_year{% endblock %} {% block body_class %}{{ block.super }} post_archive_year{% endblock %}




{% block content_title %} {% block content_title %}
<h2>Post archive for {{ year }}</h2> <h2>{% trans "Post archive for" %} {{ year }}</h2>
{% endblock %} {% endblock %}




{% block content %} {% block content %}
<ul class="link_list"> <ul class="link_list">
{% for month in date_list %} {% for month in date_list %}
<li><a href="{% url blog_index %}{{ year }}/{{ month|date:"b" }}/">{{ month|date:"F" }}</a></li> <li><a href="{% url blog_index %}{{ year }}/{{ month|date:"b" }}/" title="{% trans "View items posted this month" %}">{{ month|date:"F" }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock %} {% endblock %}
19 changes: 10 additions & 9 deletions basic/blog/templates/blog/post_detail.html
@@ -1,5 +1,6 @@
{% extends "blog/base_blog.html" %} {% extends "blog/base_blog.html" %}


{% load i18n %}


{% block title %}{{ object.title }}{% endblock %} {% block title %}{{ object.title }}{% endblock %}
{% block body_class %}{{ block.super }} post_detail{% endblock %} {% block body_class %}{{ block.super }} post_detail{% endblock %}
Expand All @@ -10,10 +11,10 @@
<h2>{{ object.title }}</h2> <h2>{{ object.title }}</h2>
<p class="other_posts"> <p class="other_posts">
{% if object.get_previous_by_publish %} {% if object.get_previous_by_publish %}
<a class="previous" href="{{ object.get_previous_post.get_absolute_url }}">&laquo; {{ object.get_previous_post }}</a> <a class="previous" href="{{ object.get_previous_post.get_absolute_url }}" title="{% trans "View previous post" %}">&laquo; {{ object.get_previous_post }}</a>
{% endif %} {% endif %}
{% if object.get_next_by_publish %} {% if object.get_next_by_publish %}
| <a class="next" href="{{ object.get_next_post.get_absolute_url }}">{{ object.get_next_post }} &raquo;</a> | <a class="next" href="{{ object.get_next_post.get_absolute_url }}" title="{% trans "View next post" %}">{{ object.get_next_post }} &raquo;</a>
{% endif %} {% endif %}
</p> </p>
{% endblock %} {% endblock %}
Expand All @@ -30,7 +31,7 @@ <h2>{{ object.title }}</h2>


{% tags_for_object object as tag_list %} {% tags_for_object object as tag_list %}
{% if tag_list %} {% if tag_list %}
<p class="inline_tag_list"><strong>Related tags:</strong> <p class="inline_tag_list"><strong>{% trans "Related tags" %}:</strong>
{% for tag in tag_list %} {% for tag in tag_list %}
{{ tag }}{% if not forloop.last %}, {% endif %} {{ tag }}{% if not forloop.last %}, {% endif %}
{% endfor %} {% endfor %}
Expand All @@ -41,16 +42,16 @@ <h2>{{ object.title }}</h2>
{% if comment_list %} {% if comment_list %}
<div id="comments"> <div id="comments">
<a name="comments"></a> <a name="comments"></a>
<h3 class="comments_title">Comments</h3> <h3 class="comments_title">{% trans "Comments" %}</h3>
{% for comment in comment_list %} {% for comment in comment_list %}
{% if comment.is_public %} {% if comment.is_public %}
<div class="comment"> <div class="comment">
<h5 class="name"> <h5 class="name">
<a name="c{{ comment.id }}" href="{{ comment.get_absolute_url }}" title="Permalink to {{ comment.person_name }}'s comment" class="count">{{ forloop.counter }}</a> <a name="c{{ comment.id }}" href="{{ comment.get_absolute_url }}" title="{% trans "Permalink to" %} {% blocktrans with comment.user_name as user_name %}{{ user_name }}'s{% endblocktrans %} {% trans "comment" %}" class="count">{{ forloop.counter }}</a>
{% if comment.user_url %}<a href="{{ comment.user_url }}">{{ comment.user_name }}</a>{% else %}{{ comment.user_name }}{% endif %} says... {% if comment.user_url %}<a href="{{ comment.user_url }}" title="{% trans "View" %} {% blocktrans with comment.user_name as user_name %}{{ user_name }}'s{% endblocktrans %} {% trans "website" %}">{{ comment.user_name }}</a>{% else %}{{ comment.user_name }}{% endif %} {% trans "says" %}...
</h5> </h5>
{{ comment.comment|urlizetrunc:"60"|markdown:"safe" }} {{ comment.comment|urlizetrunc:"60"|markdown:"safe" }}
<p class="date">Posted at {{ comment.submit_date|date:"P" }} on {{ comment.submit_date|date:"F j, Y" }}</p> <p class="date">{% trans "Posted at" %} {{ comment.submit_date|date:"P" }} {% trans "on" %} {{ comment.submit_date|date:"F j, Y" }}</p>
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
Expand All @@ -60,8 +61,8 @@ <h5 class="name">
{% render_comment_form for object %} {% render_comment_form for object %}
{% else %} {% else %}
<div id="comment_form"> <div id="comment_form">
<h3>Comments are closed.</h3> <h3>{% trans "Comments are closed" %}.</h3>
<p>Comments have been close for this post.</p> <p>{% trans "Comments have been closed for this post" %}.</p>
</div> </div>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
11 changes: 6 additions & 5 deletions basic/blog/templates/blog/post_list.html
@@ -1,20 +1,21 @@
{% extends "blog/base_blog.html" %} {% extends "blog/base_blog.html" %}


{% load i18n %}


{% block title %}Post archive{% endblock %} {% block title %}{% trans "Post archive" %}{% endblock %}
{% block body_class %}{{ block.super }} post_list{% endblock %} {% block body_class %}{{ block.super }} post_list{% endblock %}




{% block content_title %} {% block content_title %}
<h2>Post archive</h2> <h2>{% trans "Post archive" %}</h2>
{% endblock %} {% endblock %}




{% block content %} {% block content %}
<div class="post_list"> <div class="post_list">
{% for post in object_list %} {% for post in object_list %}
<div> <div>
<h3 class="title"><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h3> <h3 class="title"><a href="{{ post.get_absolute_url }}" title="{% trans "View this post" %}">{{ post.title }}</a></h3>
<p class="date">{{ post.publish|date:"Y F d" }}</p> <p class="date">{{ post.publish|date:"Y F d" }}</p>
<p class="tease">{{ post.tease|safe }}</p> <p class="tease">{{ post.tease|safe }}</p>
</div> </div>
Expand All @@ -24,11 +25,11 @@ <h3 class="title"><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h3
{% if is_paginated %} {% if is_paginated %}
<p class="pagination"> <p class="pagination">
{% if has_next %} {% if has_next %}
<a class="older" href="?page={{ next }}">Older</a> <a class="older" href="?page={{ next }}" title="{% trans "View older posts" %}">{% trans "Older" %}</a>
{% endif %} {% endif %}
{% if has_next and has_previous %} | {% endif %} {% if has_next and has_previous %} | {% endif %}
{% if has_previous %} {% if has_previous %}
<a class="newer" href="?page={{ previous }}">Newer</a> <a class="newer" href="?page={{ previous }}" title="{% trans "View newer posts" %}">{% trans "Newer" %}</a>
{% endif %} {% endif %}
</p> </p>
{% endif %} {% endif %}
Expand Down
11 changes: 6 additions & 5 deletions basic/blog/templates/blog/post_search.html
@@ -1,20 +1,21 @@
{% extends "blog/base_blog.html" %} {% extends "blog/base_blog.html" %}


{% load i18n %}


{% block title %}Post search{% endblock %} {% block title %}{% trans "Post search" %}{% endblock %}
{% block body_class %}{{ block.super }} post_search{% endblock %} {% block body_class %}{{ block.super }} post_search{% endblock %}




{% block content_title %} {% block content_title %}
<h2>Search</h2> <h2>{% trans "Search" %}</h2>
{% endblock %} {% endblock %}




{% block content %} {% block content %}
<form action="." method="get" id="post_search_form"> <form action="." method="get" id="post_search_form">
<p> <p>
<input type="text" name="q" value="{{ search_term }}" id="search"> <input type="text" name="q" value="{{ search_term }}" id="search">
<input type="submit" class="button" value="Search"> <input type="submit" class="button" value="{% trans "Search" %}">
</p> </p>
</form> </form>


Expand All @@ -26,10 +27,10 @@ <h2>Search</h2>
<div class="post_list"> <div class="post_list">
{% for post in object_list %} {% for post in object_list %}
<div> <div>
<h3 class="title"><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h3> <h3 class="title"><a href="{{ post.get_absolute_url }}" title="{% trans "View this post" %}">{{ post.title }}</a></h3>
<p class="date">{{ post.publish|date:"Y F d" }}</p> <p class="date">{{ post.publish|date:"Y F d" }}</p>
<p class="tease">{{ post.tease|safe }}</p> <p class="tease">{{ post.tease|safe }}</p>
<p class="comments">{% if comment_count %}{{ comment_count }} comment{{ comment_count|pluralize }}{% endif %}</p> <p class="comments">{% if comment_count %}{{ comment_count }} {% blocktrans with comment_count|pluralize as pluralize %}comment{{ pluralize }}{% endblocktrans %}{% endif %}</p>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
Expand Down
7 changes: 4 additions & 3 deletions basic/blog/templates/blog/tag_detail.html
@@ -1,21 +1,22 @@
{% extends "blog/base_blog.html" %} {% extends "blog/base_blog.html" %}


{% load i18n %}


{% block title %}Posts for {{ tag.name }}{% endblock %} {% block title %}{% trans "Posts for" %} {{ tag.name }}{% endblock %}
{% block body_class %}{{ block.super }} tag_detail{% endblock %} {% block body_class %}{{ block.super }} tag_detail{% endblock %}
{% block body_id %}tag_{{ tag.id }}{% endblock %} {% block body_id %}tag_{{ tag.id }}{% endblock %}




{% block content_title %} {% block content_title %}
<h2>Posts for {{ tag.name }}</h2> <h2>{% trans "Posts for" %} {{ tag.name }}</h2>
{% endblock %} {% endblock %}




{% block content %} {% block content %}
<div class="post_list"> <div class="post_list">
{% for post in object_list %} {% for post in object_list %}
<div> <div>
<h3 class="title"><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h3> <h3 class="title"><a href="{{ post.get_absolute_url }}" title="{% trans "View this post" %}">{{ post.title }}</a></h3>
<p class="date">{{ post.publish|date:"Y F d" }}</p> <p class="date">{{ post.publish|date:"Y F d" }}</p>
<p class="tease">{{ post.tease|safe }}</p> <p class="tease">{{ post.tease|safe }}</p>
</div> </div>
Expand Down
9 changes: 5 additions & 4 deletions basic/blog/templates/blog/tag_list.html
@@ -1,19 +1,20 @@
{% extends "blog/base_blog.html" %} {% extends "blog/base_blog.html" %}


{% load i18n %}


{% block title %}Post tags{% endblock %} {% block title %}{% trans "Post tags" %}{% endblock %}
{% block body_class %}{{ block.super }} tag_list{% endblock %} {% block body_class %}{{ block.super }} tag_list{% endblock %}




{% block content_title %} {% block content_title %}
<h2>Post tags</h2> <h2>{% trans "Post tags" %}</h2>
{% endblock %} {% endblock %}




{% block content %} {% block content %}
<ul class="link_list"> <ul class="link_list">
{% for category in object_list %} {% for tag in object_list %}
<li><a href="{{ category.get_absolute_url }}">{{ category }}</a></li> <li><a href="{{ tag.get_absolute_url }}" title="{% trans "View posts tagged" %} {{ tag }}">{{ tag }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock %} {% endblock %}
2 changes: 1 addition & 1 deletion basic/blog/views.py
Expand Up @@ -187,7 +187,7 @@ def search(request, template_name='blog/post_search.html'):
cleaned_search_term = stop_word_list.sub('', search_term) cleaned_search_term = stop_word_list.sub('', search_term)
cleaned_search_term = cleaned_search_term.strip() cleaned_search_term = cleaned_search_term.strip()
if len(cleaned_search_term) != 0: if len(cleaned_search_term) != 0:
post_list = Post.objects.published().filter(Q(body__icontains=cleaned_search_term) | Q(tags__icontains=cleaned_search_term) | Q(categories__title__icontains=cleaned_search_term)) post_list = Post.objects.published().filter(Q(title__icontains=cleaned_search_term) | Q(body__icontains=cleaned_search_term) | Q(tags__icontains=cleaned_search_term) | Q(categories__title__icontains=cleaned_search_term))
context = {'object_list': post_list, 'search_term':search_term} context = {'object_list': post_list, 'search_term':search_term}
else: else:
message = 'Search term was too vague. Please try again.' message = 'Search term was too vague. Please try again.'
Expand Down
27 changes: 27 additions & 0 deletions basic/media/templates/inlines/media_photo.html
@@ -0,0 +1,27 @@
{# The reason that we did not indent this code is because if we did, Markdown would treat it as code rather than HTML. #}

{% load i18n %}

{% if object %}

<div{% if class %} class="{{ class }}"{% endif %}>
<p class="photo">
<a href="{% url photo_detail object.slug %}" title="{% trans "View the full image" %}"><img src="{{ settings.MEDIA_URL }}{{ object.photo }}" alt="{{ object }}" /></a>
</p>
{% if object.taken_by %}<p class="taken_by">{% trans "By" %} {{ object.taken_by }}</p>{% endif %}
{% if object.description %}<p class="description">{{ object.description }}</p>{% endif %}
</div>

{% else %}

<div{% if class %} class="{{ class }}"{% endif %}>
{% for object in object_list %}
<p class="photo">
<a href="{% url photo_detail object.slug %}" title="{% trans "View the full image" %}"><img src="{{ settings.MEDIA_URL }}{{ object.photo }}" alt="{{ object }}" /></a>
</p>
{% if object.taken_by %}<p class="taken_by">{% trans "By" %} {{ object.taken_by }}</p>{% endif %}
{% if object.description %}<p class="description">{{ object.description }}</p>{% endif %}
{% endfor %}
</div>

{% endif %}
@@ -0,0 +1,39 @@
{% extends "relationships/base_relationships.html" %}


{% block title %}{{ block.super }} | Followers{% endblock %}
{% block body_class %}{{ block.super }} relationship_followers{% endblock %}


{% block content_title %}
<h2>Followers</h2>
{% endblock %}


{% block content %}
{% load relationships %}
<ul>
{% for follower in page.object_list %}
<li>
{{ follower.username }} -
{% if user|follows:follower %}
<a href="{% url relationship_unfollow to_user_id=follower.id %}">Unfollow</a>
{% else %}
<a href="{% url relationship_follow to_user_id=follower.id %}">Follow</a>
{% endif %}
</li>
{% endfor %}
</ul>

{% if page.has_other_pages %}
<p class="pagination">
{% if page.has_previous %}
<a class="older" href="?page={{ page.previous_page_number }}">Previous</a>
{% endif %}
{% if page.has_next and page.has_previous %} | {% endif %}
{% if page.has_next %}
<a class="newer" href="?page={{ page.next_page_number }}">Next</a>
{% endif %}
</p>
{% endif %}
{% endblock %}

0 comments on commit 4f66b74

Please sign in to comment.