Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from hoviousj/master

Extending Functionality
  • Loading branch information...
commit 63b895c505036156924fa97a8df12b1723a4e730 2 parents 15d9327 + 4619ce1
@danclaudiupop authored
View
3  .gitignore
@@ -1,4 +1,5 @@
*.log
*.pot
*.pyc
-local_settings.py
+blog.db
+.idea/*
View
2  README.md
@@ -1,3 +1,3 @@
Testerslab is a collaboration platform for blogging where we discuss topics related to software testing and more.
-http://testerslab.herokuapp.com/
+http://testerslab.herokuapp.com/
View
8 blog/admin.py
@@ -9,6 +9,13 @@
class CategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
+def make_published(modeladmin, request, queryset):
+ queryset.update(published = True)
+make_published.short_description = "Publish"
+
+def make_unpublished(modeladmin, request, queryset):
+ queryset.update(published = False)
+make_unpublished.short_description = "Unpublish"
class PostAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('title',)}
@@ -16,6 +23,7 @@ class PostAdmin(admin.ModelAdmin):
list_filter = ['created', 'categories']
search_fields = ['title']
date_hierarchy = 'created'
+ actions = [make_published, make_unpublished]
class QuickLinkAdmin(admin.ModelAdmin):
View
70 blog/templates/category.html
@@ -3,42 +3,44 @@
{% block content %}
-<div class="container-fluid">
- <div class="row-fluid">
- <div class="span10">
- <br>
- <h1>
- <small>
- <i class="icon-folder-open-alt"></i> Posts in category: <strong>{{ cat }}</strong>
- </small>
- </h1>
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <div class="span10">
+ <br>
+ <h1>
+ <small>
+ <i class="icon-folder-open-alt"></i> Posts in category: <strong>{{ cat }}</strong>
+ </small>
+ </h1>
+ </div>
+ </div>
+ <hr>
</div>
- </div>
- <hr>
-</div>
-<div class="container-fluid">
- {% for post in posts %}
- <div class="row-fluid">
- <div class="span2">
- <p class="lead">Author:</p>
- <img src="{% gravatar_url post.author.email 100 %}" alt="{{ post.author.email }}" class="img-polaroid">
+ <div class="container-fluid">
+ {% for post in posts %}
+ {% if post.published == True %}
+ <div class="row-fluid">
+ <div class="span2">
+ <p class="lead">Author:</p>
+ <img src="{% gravatar_url post.author.email 100 %}" alt="{{ post.author.email }}" class="img-polaroid">
+ </div>
+ <div class="span6">
+ <p class="lead">Description: </p>
+ <h4><strong><a href="{% url post post.slug %}">{{ post.title }}</a></strong></h4>
+ <p>{{ post.content|safe|striptags|truncatewords:75 }}</p>
+ <p class="muted"><i class="icon-calendar"></i><small> Post by <strong><a href="{% url about %}">{{ post.author|capfirst }}</a></strong> created on: {{ post.created|date:"M d, Y" }}</small><a class="btn btn-link btn-mini pull-right" href="{% url post post.slug %}">Read more</a></p>
+ </div>
+ <div class="span4">
+ <p class="lead">Tags: </p>
+ {% for tag in post.tags.all %}
+ <a href="{% url tag tag %}"><span class="label label-info">{{ tag }}</span></a>
+ {% endfor %}
+ </div>
+ </div>
+ <hr>
+ {% endif %}
+ {% endfor %}
</div>
- <div class="span6">
- <p class="lead">Description: </p>
- <h4><strong><a href="{% url post post.slug %}">{{ post.title }}</a></strong></h4>
- <p>{{ post.content|safe|striptags|truncatewords:75 }}</p>
- <p class="muted"><i class="icon-calendar"></i><small> Post by <strong><a href="{% url about %}">{{ post.author|capfirst }}</a></strong> created on: {{ post.created|date:"M d, Y" }}</small><a class="btn btn-link btn-mini pull-right" href="{% url post post.slug %}">Read more</a></p>
- </div>
- <div class="span4">
- <p class="lead">Tags: </p>
- {% for tag in post.tags.all %}
- <a href="{% url tag tag %}"><span class="label label-info">{{ tag }}</span></a>
- {% endfor %}
- </div>
- </div>
- <hr>
- {% endfor %}
-</div>
{% endblock %}
View
78 blog/templates/post.html
@@ -2,49 +2,49 @@
{% block content %}
-<div class="row-fluid">
- <div class="span9">
- <div class="well">
- <h2>{{ post.title }}</h2>
- <p class="muted">on {{ post.created|date:"M d" }}, {{ post.created|date:"Y" }} by <i class="icon-user"></i> <a href="{% url about %}">{{ post.author|capfirst }}</a></p>
- <hr>
- <p>{{ post.content|safe }}</p>
- <hr>
- <p class="muted">
- <i class="icon-tags"></i>
- Tags:
- {% for tag in post.tags.all %}
- <a href="{% url tag tag %}"><span class="label label-info">{{ tag }}</span></a>
- {% endfor %}
- |
- <i class="icon-beaker"></i>
- Category:
- {% for cat in post.categories.all %}
- <a href="{% url category cat.slug %}">{{ cat }}</a>
- {% if not forloop.last %}, {% endif %}
- {% endfor %}
- <span class="pull-right">
+ <div class="row-fluid">
+ <div class="span9">
+ <div class="well">
+ <h2>{{ post.title }}</h2>
+ <p class="muted">on {{ post.created|date:"M d" }}, {{ post.created|date:"Y" }} by <i class="icon-user"></i> <a href="{% url about %}">{{ post.author|capfirst }}</a></p>
+ <hr>
+ <p>{{ post.content|safe }}</p>
+ <hr>
+ <p class="muted">
+ <i class="icon-tags"></i>
+ Tags:
+ {% for tag in post.tags.all %}
+ <a href="{% url tag tag %}"><span class="label label-info">{{ tag }}</span></a>
+ {% endfor %}
+ |
+ <i class="icon-beaker"></i>
+ Category:
+ {% for cat in post.categories.all %}
+ <a href="{% url category cat.slug %}">{{ cat }}</a>
+ {% if not forloop.last %}, {% endif %}
+ {% endfor %}
+ <span class="pull-right">
<i class="icon-chevron-up"></i>
<a href="#top" title="Back To Top">Back To Top</a>
</span>
- </p>
- <hr>
- <div id="disqus_thread"></div>
- <script type="text/javascript">
- /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
- var disqus_shortname = 'testerslab'; // required: replace example with your forum shortname
+ </p>
+ <hr>
+ <div id="disqus_thread"></div>
+ <script type="text/javascript">
+ /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
+ var disqus_shortname = 'testerslab'; // required: replace example with your forum shortname
- /* * * DON'T EDIT BELOW THIS LINE * * */
- (function() {
- var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
- dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
- })();
- </script>
- <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
- <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+ /* * * DON'T EDIT BELOW THIS LINE * * */
+ (function() {
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+ })();
+ </script>
+ <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+ <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+ </div>
+ </div>
</div>
- </div>
-</div>
{% endblock %}
View
9 project/settings.py
@@ -1,6 +1,7 @@
# Django settings for testerslab project.
import os.path
+SITE_ROOT = os.path.dirname(__file__.decode('utf-8'))
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
DEBUG = False
@@ -165,5 +166,9 @@
},
}
-import dj_database_url
-DATABASES['default'] = dj_database_url.config()
+# Import settings_dev file
+try:
+ from settings_dev import *
+ print "Using settings_dev."
+except ImportError, exp:
+ print "Error importing settings_dev, using standard settings"
Please sign in to comment.
Something went wrong with that request. Please try again.