Anonymous avatar Anonymous committed c7049bc

Aggiunti i commenti e il feed rss

Comments (0)

Files changed (59)

Binary file modified.

Binary file modified.

coltrane/feeds.py

+from django.utils.feedgenerator import Atom1Feed
+from django.contrib.sites.models import Site
+from django.contrib.syndication.feeds import Feed
+from coltrane.models import Entry
+
+current_site = Site.objects.get_current()
+
+ITEMS_IN_FEED = 15
+
+class LatestEntriesFeed(Feed):
+    author_name = "Karim Gorjux"
+    copyright = "http://%s/copyright/" % current_site.domain
+    description = "Latest entries posted to %s" % current_site.name
+    feed_type = Atom1Feed
+    item_copyright = "http://%s/copyright/" % current_site.domain
+    item_author_name = "Karim Gorjux"
+    item_author_link = "http://%s/" % current_site.domain
+    link = "/feeds/entries/"
+    title = "%s: Latest entries" % current_site.name
+    
+    # il query set con le entries
+    def items(self):
+        return Entry.live.order_by('-pub_date')[:ITEMS_IN_FEED]
+    
+    def item_title(self, item):
+        return item.title
+        
+    def item_pubdate(self, item):
+        return item.pub_date
+    
+    # il tag che identifica univocamente l'item. E' costruito da
+    # "tag:" + dominio + data + url
+    def item_guid(self, item):
+        return "tag:%s,%s:%s" % (
+                        current_site.domain,
+                        item.pub_date.strftime('%Y-%m-%d'),
+                        item.get_absolute_url())
+    
+                        # la lista delle categorie
+    def item_categories(self, item):
+        return [c.title for c in item.categories.all()]

Binary file added.

Binary file modified.

Add a comment to this file

coltrane/templatetags/__init__.pyc

Binary file modified.

Add a comment to this file

coltrane/templatetags/coltrane_tags.pyc

Binary file modified.

Add a comment to this file

coltrane/urls/__init__.pyc

Binary file modified.

Add a comment to this file

coltrane/urls/categories.pyc

Binary file modified.

Add a comment to this file

coltrane/urls/entries.pyc

Binary file modified.

Add a comment to this file

coltrane/urls/links.pyc

Binary file modified.

Binary file modified.

Binary file modified.

Binary file modified.

Add a comment to this file

simplesite/__init__.pyc

Binary file modified.

Add a comment to this file

simplesite/search/__init__.pyc

Binary file modified.

Add a comment to this file

simplesite/search/admin.pyc

Binary file modified.

Add a comment to this file

simplesite/search/models.pyc

Binary file modified.

simplesite/settings.py

 TEMPLATE_LOADERS = (
     'django.template.loaders.filesystem.Loader',
     'django.template.loaders.app_directories.Loader',
-    'django.template.loaders.eggs.Loader',
+    #'django.template.loaders.eggs.Loader',
 )
 
 MIDDLEWARE_CLASSES = (
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
-    'django.contrib.sites',
+#    'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.admin',
     'django.contrib.admindocs',
     'simplesite.search',
     'tagging',
     'coltrane',
+    'django.contrib.comments',
+    'django.contrib.markup',
 )
Add a comment to this file

simplesite/settings.pyc

Binary file modified.

Add a comment to this file

simplesite/simplesite.db

Binary file modified.

Add a comment to this file

simplesite/template/.DS_Store

Binary file modified.

simplesite/template/coltrane/base.html

 <!DOCTYPE html>
 <html>
 <head>
-	<link rel="stylesheet" href="{{ MEDIA_URL }}/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
+	<link rel="stylesheet" href="{{ MEDIA_URL }}/style.css" type="text/css" media="screen" title="no title" charset="utf-8" />
+	<link rel="alternate" type="application/rss+xml"  title="RSS Feed for this site"  href="/feeds/entries" />
 	<title>
 		{% block title %}
 		{% endblock %}

simplesite/template/coltrane/category_list.html

 {% extends "coltrane/base.html" %}
 
+{% block title %}
+Categories List
+{% endblock %}
+
 {% block page_content %}
+<h1>Alle the categories with description</h1>
 {% if  object_list %}
 	{% for entry in object_list %}
 	<div id="post-{{ entry.id }} " class="post-{{ entry.id }} post type-post hentry category">

simplesite/template/coltrane/entry_archive.html

-{% extends "coltrane/base.html" %}
+{% extends "coltrane/base.html" %}
+{% block title %}
+	Welcome to My Blog!
+{% endblock %}

simplesite/template/coltrane/entry_archive_year.html

 {% extends "coltrane/base.html" %}
+{% block title %}
+	Entries Archive of Year
+{% endblock %}
 {% block page_content %}
 {% if  object_list %}
 	{% for entry in object_list %}

simplesite/template/coltrane/entry_detail.html

 			{{ object.body_html|safe }}
 		</div><!-- .entry-content --> 
 		
-		<div class="entry-utility"> 
-			<span class="edit-link">Edit</span>			
-		</div><!-- .entry-utility -->
+		<div class="comments-list">
+			{% load comments %}
+			{% get_comment_count for object as comment_count %}
+			<h2>Comments ({{ comment_count }})</h2> 
+			{% load markup %}
+			{% get_comment_list for object as comment_list %}
+			{% for comment in comment_list %}
+				<p>On {{ comment.submit_date|date:"F j, Y" }}, <strong>{{ comment.name }}</strong> said:</p>
+				<div class="the-comment" style="font-style: italic; margin: 0px 0px 0px 20px">{{ comment.comment|markdown:"safe" }}</div>
+			{% endfor %}
+		
+		</div>
+		<!-- Carica il form dei commenti --> 
+		<h2>Post a comment</h2>
+		{% load comments %}
+		{% render_comment_form for object %}
 </div><!-- #post-## -->
 {% endblock %}

simplesite/template/coltrane/entry_list.html

 {% extends "coltrane/base.html" %}
+
+{% block title %}
+	List of Entries
+{% endblock %}
+
 {% block page_content %}
 {% if  object_list %}
 	{% for entry in object_list %}

simplesite/template/coltrane/sidebar.html

 <!-- Qui inizia la parte della sidebar-->
-<div id="primary" class="widget-area" role="complementary"> 
+{% load coltrane_tags %}
+
+<div id="primary" class="widget-area"> 
 	{% block sidebar %}
-	<ul class="xoxo"> 
-		
-		<li id="search-2" class="widget-container widget_search">
-			<form role="search" method="get" id="searchform" action="http://forexstudent.net/" > 
-				<div><label class="screen-reader-text" for="s">Cerca:</label>
-					<input type="text" value="" name="s" id="s" />
-					<input type="submit" id="searchsubmit" value="Cerca" />
-				</div>
-			</form>
-		</li>
-		
-		<li id="recent-posts-2" class="widget-container widget_recent_entries">
+	<p>
+		<a href="/feeds/entries/"><img src="{{ MEDIA_URL}}/rss.jpeg" alt="Abbonati al Feed RSS" /></a>			
+	</p>
+	<ul> 
+		<li class="widget-container">
 			<h3 class="widget-title">Articoli recenti</h3>
-			{% load coltrane_tags %}
 			<ul> 
 				{% get_latest_content coltrane.entry 5 as latest_entries %}
 				{% if latest_entries %}
 						, pubblicato da {{ entry.pub_date|timesince }}</li>
 					{% endfor %}
 				{% endif %}
-				
 			</ul> 
 		</li>
 		
-		<li id="recent-comments-2" class="widget-container widget_recent_comments">
-			<h3 class="widget-title">Commenti recenti</h3>
-			<ul id="recentcomments">
-				<li class="recentcomments">Ultimo commento</li>
+		<li class="widget-container">
+			<h3 class="widget-title">Categorie</h3>
+			<ul> 
+				{% get_latest_content coltrane.category 5 as latest_entries %}
+				{% if latest_entries %}
+					{% for entry in latest_entries %}
+					<li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li>
+					{% endfor %}
+				{% endif %}
 			</ul>
 		</li>
 		
-		<li id="archives-2" class="widget-container widget_archive">
-			<h3 class="widget-title">Archivi</h3>
+		<li class="widget-container">
+			<h3 class="widget-title">Comments</h3>
 			<ul> 
-				<li>agosto 2010</li> 
-			</ul> 
-		</li>
-		
-		<li id="categories-2" class="widget-container widget_categories">
-			<h3 class="widget-title">Categorie</h3>
-			<ul>
-				<li class="cat-item cat-item-1">Categoria 1</li> 
 			</ul>
 		</li>
 		
-		<li id="meta-2" class="widget-container widget_meta">
+		<li class="widget-container">
+			<h3 class="widget-title">Links</h3>
+			<ul> 
+				{% get_latest_content coltrane.link 5 as latest_entries %}
+				{% if latest_entries %}
+					{% for entry in latest_entries %}
+					<li><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></li>
+					{% endfor %}
+				{% endif %}
+			</ul>
+		</li>
+		
+		<li class="widget-container">
 			<h3 class="widget-title">Meta</h3>
 			<ul> 
 				<li><a href="{% url admin:index %}">Amministra sito</a></li>

simplesite/template/coltrane/tag_list.html

 {% extends "coltrane/base.html" %}
+{% block title %}
+Tags List
+{% endblock %}
 
 {% block page_content %}
+<h1>All tags with description</h1>
 {% if  object_list %}
 	{% for entry in object_list %}
 	<div id="post-{{ object.id }}" class="post-{{ object.id }} post type-post hentry category">

simplesite/template/comments/400-debug.html

+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <title>Comment post not allowed (400)</title>
+  <meta name="robots" content="NONE,NOARCHIVE" />
+  <style type="text/css">
+    html * { padding:0; margin:0; }
+    body * { padding:10px 20px; }
+    body * * { padding:0; }
+    body { font:small sans-serif; background:#eee; }
+    body>div { border-bottom:1px solid #ddd; }
+    h1 { font-weight:normal; margin-bottom:.4em; }
+    h1 span { font-size:60%; color:#666; font-weight:normal; }
+    table { border:none; border-collapse: collapse; width:100%; }
+    td, th { vertical-align:top; padding:2px 3px; }
+    th { width:12em; text-align:right; color:#666; padding-right:.5em; }
+    #info { background:#f6f6f6; }
+    #info ol { margin: 0.5em 4em; }
+    #info ol li { font-family: monospace; }
+    #summary { background: #ffc; }
+    #explanation { background:#eee; border-bottom: 0px none; }
+  </style>
+</head>
+<body>
+  <div id="summary">
+    <h1>Comment post not allowed <span>(400)</span></h1>
+    <table class="meta">
+      <tr>
+        <th>Why:</th>
+        <td>{{ why }}</td>
+      </tr>
+    </table>
+  </div>
+  <div id="info">
+    <p>
+    The comment you tried to post to this view wasn't saved because something
+    tampered with the security information in the comment form. The message
+    above should explain the problem, or you can check the <a
+    href="http://docs.djangoproject.com/en/dev/ref/contrib/comments/">comment
+    documentation</a> for more help.
+    </p>
+  </div>
+
+  <div id="explanation">
+    <p>
+      You're seeing this error because you have <code>DEBUG = True</code> in
+      your Django settings file. Change that to <code>False</code>, and Django
+      will display a standard 400 error page.
+    </p>
+  </div>
+</body>
+</html>

simplesite/template/comments/approve.html

+{% extends "comments/base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Approve a comment" %}{% endblock %}
+
+{% block content %}
+  <h1>{% trans "Really make this comment public?" %}</h1>
+  <blockquote>{{ comment|linebreaks }}</blockquote>
+  <form action="." method="post">{% csrf_token %}
+    {% if next %}<input type="hidden" name="next" value="{{ next }}" id="next" />{% endif %}
+    <p class="submit">
+      <input type="submit" name="submit" value="{% trans "Approve" %}" /> or <a href="{{ comment.get_absolute_url }}">cancel</a>
+    </p>
+  </form>
+{% endblock %}

simplesite/template/comments/approved.html

+{% extends "comments/base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Thanks for approving" %}.{% endblock %}
+
+{% block content %}
+  <h1>{% trans "Thanks for taking the time to improve the quality of discussion on our site" %}.</h1>
+{% endblock %}

simplesite/template/comments/base.html

+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="en">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>{% block title %}{% endblock %}</title>
+</head>
+<body>
+  {% block content %}{% endblock %}
+</body>
+</html>

simplesite/template/comments/delete.html

+{% extends "comments/base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Remove a comment" %}{% endblock %}
+
+{% block content %}
+<h1>{% trans "Really remove this comment?" %}</h1>
+  <blockquote>{{ comment|linebreaks }}</blockquote>
+  <form action="." method="post">{% csrf_token %}
+    {% if next %}<input type="hidden" name="next" value="{{ next }}" id="next" />{% endif %}
+    <p class="submit">
+    <input type="submit" name="submit" value="{% trans "Remove" %}" /> or <a href="{{ comment.get_absolute_url }}">cancel</a>
+    </p>
+  </form>
+{% endblock %}

simplesite/template/comments/deleted.html

+{% extends "comments/base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Thanks for removing" %}.{% endblock %}
+
+{% block content %}
+  <h1>{% trans "Thanks for taking the time to improve the quality of discussion on our site" %}.</h1>
+{% endblock %}

simplesite/template/comments/flag.html

+{% extends "comments/base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Flag this comment" %}{% endblock %}
+
+{% block content %}
+<h1>{% trans "Really flag this comment?" %}</h1>
+  <blockquote>{{ comment|linebreaks }}</blockquote>
+  <form action="." method="post">{% csrf_token %}
+    {% if next %}<input type="hidden" name="next" value="{{ next }}" id="next" />{% endif %}
+    <p class="submit">
+    <input type="submit" name="submit" value="{% trans "Flag" %}" /> or <a href="{{ comment.get_absolute_url }}">cancel</a>
+    </p>
+  </form>
+{% endblock %}

simplesite/template/comments/flagged.html

+{% extends "comments/base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Thanks for flagging" %}.{% endblock %}
+
+{% block content %}
+  <h1>{% trans "Thanks for taking the time to improve the quality of discussion on our site" %}.</h1>
+{% endblock %}

simplesite/template/comments/form.html

+{% load comments i18n %}
+<form action="{% comment_form_target %}" method="post">{% csrf_token %}
+  {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
+  {% for field in form %}
+    {% if field.is_hidden %}
+      {{ field }}
+    {% else %}
+      {% if field.errors %}{{ field.errors }}{% endif %}
+      <p
+        {% if field.errors %} class="error"{% endif %}
+        {% ifequal field.name "honeypot" %} style="display:none;"{% endifequal %}>
+        {{ field.label_tag }} {{ field }}
+      </p>
+    {% endif %}
+  {% endfor %}
+  <p class="submit">
+    <input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" />
+    <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" />
+  </p>
+</form>

simplesite/template/comments/list.html

+<dl id="comments">
+  {% for comment in comment_list %}
+    <dt id="c{{ comment.id }}">
+        {{ comment.submit_date }} - {{ comment.name }}
+    </dt>
+    <dd>
+        <p>{{ comment.comment }}</p>
+    </dd>
+  {% endfor %}
+</dl>

simplesite/template/comments/posted.html

+{% extends "comments/base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Thanks for commenting" %}.{% endblock %}
+
+{% block content %}
+  <h1>{% trans "Thank you for your comment" %}.</h1>
+{% endblock %}

simplesite/template/comments/preview.html

+{% extends "comments/base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Preview your comment" %}{% endblock %}
+
+{% block content %}
+  {% load comments %}
+  <form action="{% comment_form_target %}" method="post">{% csrf_token %}
+    {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
+    {% if form.errors %}
+    <h1>{% blocktrans count form.errors|length as counter %}Please correct the error below{% plural %}Please correct the errors below{% endblocktrans %}</h1>
+    {% else %}
+    <h1>{% trans "Preview your comment" %}</h1>
+      {% load markup %}
+		<blockquote>{{ comment|markdown:"safe" }}</blockquote>
+      <p>
+      {% trans "and" %} <input type="submit" name="submit" class="submit-post" value="{% trans "Post your comment" %}" id="submit" /> {% trans "or make changes" %}:
+      </p>
+    {% endif %}
+    {% for field in form %}
+      {% if field.is_hidden %}
+        {{ field }}
+      {% else %}
+        {% if field.errors %}{{ field.errors }}{% endif %}
+        <p
+          {% if field.errors %} class="error"{% endif %}
+          {% ifequal field.name "honeypot" %} style="display:none;"{% endifequal %}>
+          {{ field.label_tag }} {{ field }}
+        </p>
+      {% endif %}
+    {% endfor %}
+    <p class="submit">
+    <input type="submit" name="submit" class="submit-post" value="{% trans "Post" %}" />
+    <input type="submit" name="preview" class="submit-preview" value="{% trans "Preview" %}" />
+    </p>
+  </form>
+{% endblock %}

simplesite/template/feeds/entries_description.html

+{{ obj.title }}
+{% if obj.excerpt_html %} 
+	{{ obj.excerpt_html|safe }}
+{% else %}
+	{{ obj.body_html|truncatewords_html:"50"|safe }}
+{% endif %}
Add a comment to this file

simplesite/template/feeds/entries_title.html

Empty file added.

Add a comment to this file

simplesite/template/media/rss.jpeg

Added
New image

simplesite/template/media/style.css

 	display: none;
 }
 .widget-container {
-	margin: 0 0 18px 0;
+	margin: 5px 0 18px 5px;
 }
 .widget-title {
 	color: #222;

simplesite/urls.py

 from django.conf.urls.defaults import *
 from django.conf import settings
+from coltrane.feeds import LatestEntriesFeed
+
+feeds = { 'entries': LatestEntriesFeed }
 
 # Uncomment the next two lines to enable the admin:
 from django.contrib import admin
     (r'^blog/links/', include('coltrane.urls.links')),
     (r'^blog/tags/', include('coltrane.urls.tags')),
     (r'^blog/categories/', include('coltrane.urls.categories')),
-    
+    (r'^comments/', include('django.contrib.comments.urls')),
+    (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', { 'feed_dict': feeds }, 'coltrane_feed'),
     #(r'^search/$', 'simplesite.search.views.search'),
     #(r'', include('django.contrib.flatpages.urls')),
 )

Binary file modified.

Binary file modified.

Binary file modified.

Binary file modified.

Binary file modified.

Binary file modified.

Binary file modified.

Add a comment to this file

tagging/templatetags/__init__.pyc

Binary file modified.

Binary file modified.

Binary file modified.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.