summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2011-10-17 01:34:04 +0200
committerGravatar Tom Willemsen2011-10-17 01:34:04 +0200
commit4b29603d79cc1f79c66786684f27ec9abfbaa825 (patch)
tree655c321b7ee3b0cc919ab3b7bf937b50fc13c69c
downloaddotfiles-4b29603d79cc1f79c66786684f27ec9abfbaa825.tar.gz
dotfiles-4b29603d79cc1f79c66786684f27ec9abfbaa825.zip
Initial commit
-rw-r--r--.gitignore5
-rw-r--r--__init__.py0
-rw-r--r--blog/__init__.py0
-rw-r--r--blog/admin.py4
-rw-r--r--blog/models.py33
-rw-r--r--blog/tests.py23
-rw-r--r--blog/urls.py9
-rw-r--r--blog/views.py55
-rw-r--r--links/__init__.py0
-rw-r--r--links/admin.py4
-rw-r--r--links/models.py35
-rw-r--r--links/tests.py16
-rw-r--r--links/urls.py5
-rw-r--r--links/views.py12
-rw-r--r--local_settings.py.example15
-rw-r--r--main/__init__.py0
-rw-r--r--main/admin.py4
-rw-r--r--main/models.py24
-rw-r--r--main/signals.py0
-rw-r--r--main/tests.py23
-rw-r--r--main/urls.py4
-rw-r--r--main/views.py13
-rw-r--r--manage.py11
-rw-r--r--projects/__init__.py0
-rw-r--r--projects/admin.py6
-rw-r--r--projects/models.py59
-rw-r--r--projects/urls.py13
-rw-r--r--projects/views.py24
-rw-r--r--settings.py91
-rw-r--r--templates/admin/login.html50
-rw-r--r--templates/base.html44
-rw-r--r--templates/blog/base.html5
-rw-r--r--templates/blog/posts.html42
-rw-r--r--templates/blog/tags.html19
-rw-r--r--templates/home.html88
-rw-r--r--templates/links/links.html20
-rw-r--r--templates/projects/base.html3
-rw-r--r--templates/projects/project_detail.html52
-rw-r--r--templates/projects/project_list.html20
-rw-r--r--urls.py19
40 files changed, 850 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..db82c7d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.pyc
+local_settings.py
+static
+.toudou
+test.db
diff --git a/__init__.py b/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/__init__.py
diff --git a/blog/__init__.py b/blog/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/blog/__init__.py
diff --git a/blog/admin.py b/blog/admin.py
new file mode 100644
index 0000000..ca32d1f
--- /dev/null
+++ b/blog/admin.py
@@ -0,0 +1,4 @@
+from blog.models import Post
+from django.contrib import admin
+
+admin.site.register(Post)
diff --git a/blog/models.py b/blog/models.py
new file mode 100644
index 0000000..126ba57
--- /dev/null
+++ b/blog/models.py
@@ -0,0 +1,33 @@
+from django.db import models
+from main.models import Tag, Activity
+from django.db.models.signals import post_save, post_delete
+
+class Post(models.Model):
+ subject = models.CharField(max_length=500)
+ body = models.TextField()
+ tags = models.ManyToManyField(Tag, null=True, blank=True)
+ postdate = models.DateTimeField(auto_now=True)
+
+ def __unicode__(self):
+ return self.subject
+
+def post_saved_callback(sender, **kwargs):
+ if kwargs['created']:
+ acttype = 'add'
+ else:
+ acttype = 'edit'
+
+ a = Activity(actcategory='blog',
+ actdescription=kwargs["instance"].subject,
+ acttype = acttype,
+ objpk = kwargs["instance"].pk)
+ a.save()
+
+def post_deleted_callback(sender, **kwargs):
+ a = Activity(actcategory='blog',
+ actdescription=kwargs["instance"].subject,
+ acttype = 'delete')
+ a.save()
+
+post_save.connect(post_saved_callback, sender=Post)
+post_delete.connect(post_deleted_callback, sender=Post)
diff --git a/blog/tests.py b/blog/tests.py
new file mode 100644
index 0000000..2247054
--- /dev/null
+++ b/blog/tests.py
@@ -0,0 +1,23 @@
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
diff --git a/blog/urls.py b/blog/urls.py
new file mode 100644
index 0000000..c4137ed
--- /dev/null
+++ b/blog/urls.py
@@ -0,0 +1,9 @@
+from django.conf.urls.defaults import *
+
+urlpatterns = patterns('blog.views',
+ (r'^$', 'index'),
+ (r'^(?P<page>\d+)/$', 'index'),
+ (r'^post/(?P<post_id>\d+)/$', 'post'),
+ (r'^tags/$', 'tags'),
+ (r'^tag/(?P<tag_name>[\w_]+)/$', 'tag'),
+)
diff --git a/blog/views.py b/blog/views.py
new file mode 100644
index 0000000..06a4aba
--- /dev/null
+++ b/blog/views.py
@@ -0,0 +1,55 @@
+# Create your views here.
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from django.template import Context, loader
+from django.views.generic.simple import direct_to_template
+from blog.models import Post, Tag
+
+def index(request, page=0):
+ item_count = 7
+
+ page = int(page)
+ start_num = (page * item_count)
+ end_num = start_num + item_count
+
+ post_list = Post.objects.all().order_by("-postdate")[start_num:end_num]
+
+ has_previous = page > 0
+ has_next = end_num < Post.objects.all().count()
+
+ c = {
+ 'postlist': post_list,
+ 'has_next': has_next,
+ 'has_previous': has_previous,
+ 'next_page': page + 1,
+ 'previous_page': page - 1
+ }
+
+ return direct_to_template(request, "blog/posts.html", c)
+
+def post(request, post_id):
+ post = Post.objects.filter(pk=post_id)
+ t = loader.get_template("blog/posts.html")
+ c = Context({
+ 'postlist': post,
+ })
+
+ return HttpResponse(t.render(c))
+
+def tags(request):
+ tag_list = Tag.objects.all()
+ t = loader.get_template("blog/tags.html")
+ c = Context({
+ 'taglist': tag_list,
+ })
+
+ return HttpResponse(t.render(c))
+
+def tag(request, tag_name):
+ post_list = Post.objects.filter(tags__name=tag_name)
+ t = loader.get_template("blog/posts.html")
+ c = Context({
+ 'postlist': post_list,
+ })
+
+ return HttpResponse(t.render(c))
diff --git a/links/__init__.py b/links/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/links/__init__.py
diff --git a/links/admin.py b/links/admin.py
new file mode 100644
index 0000000..29b8674
--- /dev/null
+++ b/links/admin.py
@@ -0,0 +1,4 @@
+from links.models import Bookmark
+from django.contrib import admin
+
+admin.site.register(Bookmark)
diff --git a/links/models.py b/links/models.py
new file mode 100644
index 0000000..50319a2
--- /dev/null
+++ b/links/models.py
@@ -0,0 +1,35 @@
+from django.db import models
+from main.models import Tag, Activity
+from django.db.models.signals import post_save, post_delete
+
+class Bookmark(models.Model):
+ url = models.URLField(primary_key=True, max_length=255)
+ date = models.DateTimeField(auto_now_add=True)
+ name = models.CharField(max_length=255)
+ description = models.TextField()
+# tags = models.ManyToManyField(Tag, null=True, blank=True)
+ priority = models.IntegerField(null=True, blank=True)
+
+ def __unicode__(self):
+ return self.name
+
+def bookmark_saved_callback(sender, **kwargs):
+ if kwargs['created']:
+ acttype = 'add'
+ else:
+ acttype = 'edit'
+
+ a = Activity(actcategory='link',
+ actdescription=kwargs["instance"].name,
+ acttype = acttype,
+ objpk = kwargs["instance"].pk)
+ a.save()
+
+def bookmark_deleted_callback(sender, **kwargs):
+ a = Activity(actcategory='link',
+ actdescription=kwargs["instance"].name,
+ acttype = 'delete')
+ a.save()
+
+post_save.connect(bookmark_saved_callback, sender=Bookmark)
+post_delete.connect(bookmark_deleted_callback, sender=Bookmark)
diff --git a/links/tests.py b/links/tests.py
new file mode 100644
index 0000000..501deb7
--- /dev/null
+++ b/links/tests.py
@@ -0,0 +1,16 @@
+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.assertEqual(1 + 1, 2)
diff --git a/links/urls.py b/links/urls.py
new file mode 100644
index 0000000..25d8cc8
--- /dev/null
+++ b/links/urls.py
@@ -0,0 +1,5 @@
+from django.conf.urls.defaults import patterns
+
+urlpatterns = patterns('links.views',
+ (r'^$', 'index'),
+)
diff --git a/links/views.py b/links/views.py
new file mode 100644
index 0000000..fe0d89d
--- /dev/null
+++ b/links/views.py
@@ -0,0 +1,12 @@
+from links.models import Bookmark
+from django.http import HttpResponse
+from django.template import Context, loader
+
+def index(request):
+ bookmark_list = Bookmark.objects.all().order_by("-date")[:100]
+ t = loader.get_template("links/links.html")
+ c = Context({
+ 'bookmarklist': bookmark_list,
+ })
+
+ return HttpResponse(t.render(c))
diff --git a/local_settings.py.example b/local_settings.py.example
new file mode 100644
index 0000000..6a166a7
--- /dev/null
+++ b/local_settings.py.example
@@ -0,0 +1,15 @@
+DEBUG = False
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+ 'NAME': '', # Or path to database file if using sqlite3.
+ 'USER': '', # Not used with sqlite3.
+ 'PASSWORD': '', # Not used with sqlite3.
+ 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
+ 'PORT': '', # Set to empty string for default. Not used with sqlite3.
+ }
+}
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = '00000000000000000000000000000000000000000000000000'
diff --git a/main/__init__.py b/main/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/main/__init__.py
diff --git a/main/admin.py b/main/admin.py
new file mode 100644
index 0000000..093f769
--- /dev/null
+++ b/main/admin.py
@@ -0,0 +1,4 @@
+from main.models import Tag
+from django.contrib import admin
+
+admin.site.register(Tag)
diff --git a/main/models.py b/main/models.py
new file mode 100644
index 0000000..8ecddec
--- /dev/null
+++ b/main/models.py
@@ -0,0 +1,24 @@
+from django.db import models
+
+class Tag(models.Model):
+ name = models.CharField(primary_key=True, max_length=200)
+
+ def __unicode__(self):
+ return self.name
+
+class Activity(models.Model):
+ ACTCATEGORY_CHOICES = (
+ ('blog', 'Blog post'),
+ ('project', 'Project page'),
+ ('link', 'Link'),
+ )
+ ACTTYPE_CHOICES = (
+ ('add', 'Add'),
+ ('edit', 'Edit'),
+ ('delete', 'Delete'),
+ )
+ date = models.DateTimeField(auto_now=True)
+ actcategory = models.CharField(max_length=100, choices=ACTCATEGORY_CHOICES)
+ actdescription = models.CharField(max_length=500)
+ acttype = models.CharField(max_length=6)
+ objpk = models.CharField(max_length=300, null=True)
diff --git a/main/signals.py b/main/signals.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/main/signals.py
diff --git a/main/tests.py b/main/tests.py
new file mode 100644
index 0000000..2247054
--- /dev/null
+++ b/main/tests.py
@@ -0,0 +1,23 @@
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+
diff --git a/main/urls.py b/main/urls.py
new file mode 100644
index 0000000..9f861b5
--- /dev/null
+++ b/main/urls.py
@@ -0,0 +1,4 @@
+from django.conf.urls.defaults import *
+
+urlpatterns = patterns('main.views',
+ (r'^$', 'index'))
diff --git a/main/views.py b/main/views.py
new file mode 100644
index 0000000..91e20dd
--- /dev/null
+++ b/main/views.py
@@ -0,0 +1,13 @@
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from django.template import Context, loader
+from main.models import Activity
+
+def index(request):
+ activity_list = Activity.objects.all().order_by("-date")[:5]
+ t = loader.get_template("home.html")
+ c = Context({
+ "activitylist": activity_list,
+ })
+
+ return HttpResponse(t.render(c))
diff --git a/manage.py b/manage.py
new file mode 100644
index 0000000..6a43c99
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python2
+from django.core.management import execute_manager
+try:
+ import settings # Assumed to be in the same directory.
+except ImportError:
+ import sys
+ sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
+ sys.exit(1)
+
+if __name__ == "__main__":
+ execute_manager(settings)
diff --git a/projects/__init__.py b/projects/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/projects/__init__.py
diff --git a/projects/admin.py b/projects/admin.py
new file mode 100644
index 0000000..b5ec7d4
--- /dev/null
+++ b/projects/admin.py
@@ -0,0 +1,6 @@
+from projects.models import Project, Language, Screenshot
+from django.contrib import admin
+
+admin.site.register(Project)
+admin.site.register(Language)
+admin.site.register(Screenshot)
diff --git a/projects/models.py b/projects/models.py
new file mode 100644
index 0000000..4b2b49a
--- /dev/null
+++ b/projects/models.py
@@ -0,0 +1,59 @@
+from django.db import models
+from main.models import Tag, Activity
+from django.db.models.signals import post_save, post_delete
+
+class Language(models.Model):
+ name = models.CharField(max_length=100)
+
+ def __unicode__(self):
+ return self.name
+
+class Screenshot(models.Model):
+ url = models.URLField(max_length=255)
+ description = models.CharField(max_length=300)
+
+ def __unicode__(self):
+ return self.description
+
+class Project(models.Model):
+ STATUS_CHOICES = (
+ ('active', "Active"),
+ ('onhold', "On Hold"),
+ ('dropped', "Dropped"),
+ )
+
+ slug = models.SlugField(max_length=255, primary_key=True)
+ name = models.CharField(max_length=300)
+ status = models.CharField(max_length=8, choices=STATUS_CHOICES)
+ tagline = models.CharField(max_length=140, null=True, blank=True)
+ languages = models.ManyToManyField(Language, null=True, blank=True)
+ source_url = models.URLField(max_length=255, null=True, blank=True)
+ bugtracker_url = models.URLField(max_length=255, null=True, blank=True)
+ wiki_url = models.URLField(max_length=255, null=True, blank=True)
+ description = models.TextField()
+ screenshots = models.ForeignKey(Screenshot, null=True, blank=True)
+# tags = models.ManyToManyField(Tag, null=True, blank=True)
+
+ def __unicode__(self):
+ return self.name
+
+def project_saved_callback(sender, **kwargs):
+ if kwargs['created']:
+ acttype = 'add'
+ else:
+ acttype = 'edit'
+
+ a = Activity(actcategory='project',
+ actdescription=kwargs["instance"].name,
+ acttype = acttype,
+ objpk = kwargs["instance"].pk)
+ a.save()
+
+def project_deleted_callback(sender, **kwargs):
+ a = Activity(actcategory='project',
+ actdescription=kwargs["instance"].name,
+ acttype = 'delete')
+ a.save()
+
+post_save.connect(project_saved_callback, sender=Project)
+post_delete.connect(project_deleted_callback, sender=Project)
diff --git a/projects/urls.py b/projects/urls.py
new file mode 100644
index 0000000..053ab5b
--- /dev/null
+++ b/projects/urls.py
@@ -0,0 +1,13 @@
+from django.conf.urls.defaults import *
+from projects.models import Project, Language
+
+project_info_dict = {
+ 'queryset': Project.objects.all(),
+}
+
+urlpatterns = patterns('',
+ (r'^$',
+ 'django.views.generic.list_detail.object_list',
+ project_info_dict),
+ (r'^(?P<object_id>[\w-]+)/$', 'projects.views.project'),
+)
diff --git a/projects/views.py b/projects/views.py
new file mode 100644
index 0000000..ad46ebd
--- /dev/null
+++ b/projects/views.py
@@ -0,0 +1,24 @@
+from django.http import HttpResponse
+from django.template import Context, loader
+from projects.models import Project
+
+def project(request, object_id):
+ project = Project.objects.get(pk=object_id)
+ stats_dict = {
+ "Status": project.get_status_display(),
+ "Languages": ", ".join([language.name for language in project.languages.all()]),
+ }
+ links_dict = {
+ "Source": project.source_url,
+ "Bugtracker": project.bugtracker_url,
+ "Wiki": project.wiki_url,
+ }
+
+ t = loader.get_template("projects/project_detail.html")
+ c = Context({
+ "object": project,
+ "stats": stats_dict,
+ "links": links_dict,
+ })
+
+ return HttpResponse(t.render(c))
diff --git a/settings.py b/settings.py
new file mode 100644
index 0000000..2ef7e8f
--- /dev/null
+++ b/settings.py
@@ -0,0 +1,91 @@
+# Django settings for website project.
+import os, sys
+from local_settings import *
+
+DEPLOY_PATH = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, DEPLOY_PATH)
+
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = (
+ ('Tom Willemsen', 'ryuslash@gmail.com'),
+)
+
+MANAGERS = ADMINS
+
+# Local time zone for this installation. Choices can be found here:
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
+# although not all choices may be available on all operating systems.
+# On Unix systems, a value of None will cause Django to use the same
+# timezone as the operating system.
+# If running in a Windows environment this must be set to the same as your
+# system time zone.
+TIME_ZONE = 'Europe/Brussels'
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+LANGUAGE_CODE = 'en-us'
+
+SITE_ID = 1
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+
+# If you set this to False, Django will not format dates, numbers and
+# calendars according to the current locale
+USE_L10N = True
+
+# Absolute filesystem path to the directory that will hold user-uploaded files.
+# Example: "/home/media/media.lawrence.com/"
+MEDIA_ROOT = ''
+
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash if there is a path component (optional in other cases).
+# Examples: "http://media.lawrence.com", "http://example.com/media/"
+MEDIA_URL = ''
+
+# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
+# trailing slash.
+# Examples: "http://foo.com/media/", "/media/".
+ADMIN_MEDIA_PREFIX = '/media/'
+
+# List of callables that know how to import templates from various sources.
+TEMPLATE_LOADERS = (
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
+# 'django.template.loaders.eggs.Loader',
+)
+
+MIDDLEWARE_CLASSES = (
+ 'django.middleware.common.CommonMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+)
+
+ROOT_URLCONF = 'urls'
+
+TEMPLATE_DIRS = (
+ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
+ # Always use forward slashes, even on Windows.
+ # Don't forget to use absolute paths, not relative paths.
+ '%s/templates' % DEPLOY_PATH,
+)
+
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+ 'django.contrib.messages',
+ # Uncomment the next line to enable the admin:
+ 'django.contrib.admin',
+ # Uncomment the next line to enable admin documentation:
+ # 'django.contrib.admindocs',
+ 'main',
+ 'blog',
+ 'projects',
+ 'links',
+)
diff --git a/templates/admin/login.html b/templates/admin/login.html
new file mode 100644
index 0000000..eba271f
--- /dev/null
+++ b/templates/admin/login.html
@@ -0,0 +1,50 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block extrastyle %}{% load adminmedia %}{{ block.super }}<link rel="stylesheet" type="text/css" href="/static/css/login.css" />{% endblock %}
+
+{% block bodyclass %}login{% endblock %}
+
+{% block nav-global %}{% endblock %}
+
+{% block content_title %}{% endblock %}
+
+{% block breadcrumbs %}{% endblock %}
+
+{% block content %}
+{% if form.errors and not form.non_field_errors and not form.this_is_the_login_form.errors %}
+<p class="errornote">
+{% blocktrans count form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
+</p>
+{% endif %}
+
+{% if form.non_field_errors or form.this_is_the_login_form.errors %}
+{% for error in form.non_field_errors|add:form.this_is_the_login_form.errors %}
+<p class="errornote">
+ {{ error }}
+</p>
+{% endfor %}
+{% endif %}
+
+<div id="content-main">
+<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
+ <div class="form-row">
+ {% if not form.this_is_the_login_form.errors %}{{ form.username.errors }}{% endif %}
+ <label for="id_username" class="required">{% trans 'Username:' %}</label> {{ form.username }}
+ </div>
+ <div class="form-row">
+ {% if not form.this_is_the_login_form.errors %}{{ form.password.errors }}{% endif %}
+ <label for="id_password" class="required">{% trans 'Password:' %}</label> {{ form.password }}
+ <input type="hidden" name="this_is_the_login_form" value="1" />
+ <input type="hidden" name="next" value="{{ next }}" />
+ </div>
+ <div class="submit-row">
+ <label>&nbsp;</label><input type="submit" value="{% trans 'Log in' %}" />
+ </div>
+</form>
+
+<script type="text/javascript">
+document.getElementById('id_username').focus()
+</script>
+</div>
+{% endblock %}
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 0000000..e910a76
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1,44 @@
+<!-- -*- Mode: django-html-mumamo -*- -->
+
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>ryuslash | {% block subtitle %}linux and coding{% endblock %}</title>
+ <link href="/static/css/main.css" type="text/css" rel="stylesheet" />
+ {% block extrastyle %}{% endblock %}
+ </head>
+ <body>
+ <div id="container">
+ <div id="header">
+ <img id="logo" src="/static/img/logo.png" width="100" height="100" />
+ <h1 id="title">
+ <span id="ryu">ryu</span><span id="slash">slash</span>
+ </h1>
+ </div>
+ <div id="body">
+ <div class="clearleft"></div>
+ <div id="menu">
+ <div class="container">
+ <div class="header">
+ root
+ </div>
+ <a href="/">home</a><br />
+ <a href="/blog/">blog</a><br />
+ <a href="/projects/">projects</a><br />
+ <a href="/links/">links</a>
+ </div>
+
+ {% block submenu %}{% endblock %}
+ </div>
+ <div id="content">
+ {% block content %}
+ {% endblock %}
+ <div class="clear"></div>
+ </div>
+ </div>
+ <div id="footer">
+ Copyright &copy; 2011 Tom Willemsen
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/templates/blog/base.html b/templates/blog/base.html
new file mode 100644
index 0000000..2eadc88
--- /dev/null
+++ b/templates/blog/base.html
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+
+{% block subtitle %}
+ blog
+{% endblock %}
diff --git a/templates/blog/posts.html b/templates/blog/posts.html
new file mode 100644
index 0000000..d9bc72d
--- /dev/null
+++ b/templates/blog/posts.html
@@ -0,0 +1,42 @@
+<!-- -*- Mode: django-html-mumamo -*- -->
+
+{% extends "blog/base.html" %}
+
+{% block content %}
+ {% if postlist %}
+ {% for post in postlist %}
+ <div class="container">
+ <div class="header">
+ <a href="/blog/post/{{ post.pk }}/">
+ <span class="title">{{ post.subject }}</span>
+ </a>
+ </div>
+ {% autoescape off %}
+ {{ post.body|linebreaksbr }}
+ {% endautoescape %}
+ <div class="footer">
+ Date posted: {{ post.postdate|date:"r" }}
+ Tags:
+ {% for tag in post.tags.all %}
+ {% if forloop.counter > 1 %}, {% endif %}
+ <a href="/blog/tag/{{ tag.name }}">{{ tag.name }}</a>
+ {% empty %}
+ None
+ {% endfor %}
+ </div>
+ </div>
+ {% endfor %}
+
+ <div class="navigation">
+ {% if has_next %}
+ <a class="next" href="/blog/{{ next_page }}/">next</a>
+ {% endif %}
+
+ {% if has_previous %}
+ <a class="previous" href="/blog/{{ previous_page }}/">previous</a>
+ {% endif %}
+ </div>
+ {% else %}
+ Yeah I know, I'm boring.
+ {% endif %}
+{% endblock %}
diff --git a/templates/blog/tags.html b/templates/blog/tags.html
new file mode 100644
index 0000000..a180634
--- /dev/null
+++ b/templates/blog/tags.html
@@ -0,0 +1,19 @@
+<!-- -*- Mode: django-html-mumamo -*- -->
+
+{% extends "blog/base.html" %}
+
+{% block subtitle %}
+ blog/tags
+{% endblock %}
+
+{% block content %}
+ <ul>
+ {% for tag in taglist %}
+ <li>
+ <a href="/blog/tag/{{ tag.name }}">{{ tag.name }}</a>
+ </li>
+ {% empty %}
+ Sorry, no tags here.
+ {% endfor %}
+ </ul>
+{% endblock %}
diff --git a/templates/home.html b/templates/home.html
new file mode 100644
index 0000000..a34a0d8
--- /dev/null
+++ b/templates/home.html
@@ -0,0 +1,88 @@
+{% extends "base.html" %}
+
+{% block content %}
+ This will, hopefully, eventually, become my website.
+ <strong>Rejoice!</strong>
+ <p>
+ Some places you can already find me:
+ <ul>
+ <li>
+ <a href="http://gitorious.org/~ryuslash">Gitorious</a>
+ - This is where I host most of my projects.
+ </li>
+ <li>
+ <a href="https://github.com/ryuslash">Github</a>
+ - Sometimes I host projects here as well, but I prefer
+ Gitorious.
+ </li>
+ <li>
+ <a href="http://stackoverflow.com/users/459915/slash">Stack Overflow</a>
+ - Don't really do much there, but I did just get my
+ first reputation points.
+ <br/>
+ <a href="http://stackoverflow.com/users/459915/slash">
+ <img src="http://stackoverflow.com/users/flair/459915.png?theme=dark"
+ width="208" height="58"
+ alt="profile for slash at Stack Overflow, Q&A
+ for professional and enthusiast
+ programmers"
+ title="profile for slash at Stack Overflow, Q&A
+ for professional and enthusiast programmers" />
+ </a>
+ </li>
+ </ul>
+ </p>
+
+ {% for activity in activitylist %}
+ <div class="activity_{% cycle 'even' 'uneven' %}
+ {% if forloop.last %}activity_last{% endif %}">
+ {{ activity.date|date:'d M H:i:' }}
+ {% if activity.actcategory == "blog" %}
+ {% if activity.acttype == "add" %}
+ I ranted about
+ {% endif %}
+ {% if activity.acttype == "edit" %}
+ I changed my opinion about
+ {% endif %}
+ {% if activity.acttype == "delete" %}
+ I lost my opinion about
+ {% endif %}
+ {% if activity.objpk %}
+ <a href="/blog/post/{{ activity.objpk }}/">
+ {% endif %}
+ {% endif %}
+ {% if activity.actcategory == "project" %}
+ {% if activity.acttype == "add" %}
+ I started a project named
+ {% endif %}
+ {% if activity.acttype == "edit" %}
+ I updated the info on project
+ {% endif %}
+ {% if activity.acttype == "delete" %}
+ I quit project
+ {% endif %}
+ {% if activity.objpk %}
+ <a href="/projects/{{ activity.objpk }}/">
+ {% endif %}
+ {% endif %}
+ {% if activity.actcategory == "link" %}
+ {% if activity.acttype == "add" %}
+ I found
+ {% endif %}
+ {% if activity.acttype == "edit" %}
+ I corrected
+ {% endif %}
+ {% if activity.acttype == "delete" %}
+ I unlinked
+ {% endif %}
+ {% if activity.objpk %}
+ <a href="/links/">
+ {% endif %}
+ {% endif %}
+ {{ activity.actdescription }}
+ {% if activity.objpk %}
+ </a>
+ {% endif %}
+ </div>
+ {% endfor %}
+{% endblock %}
diff --git a/templates/links/links.html b/templates/links/links.html
new file mode 100644
index 0000000..b911d80
--- /dev/null
+++ b/templates/links/links.html
@@ -0,0 +1,20 @@
+{% extends "base.html" %}
+
+{% block subtitle %}
+ links
+{% endblock %}
+
+{% block content %}
+ <div class="container">
+ <div class="header">
+ <span class="title">links</span>
+ </div>
+ {% if bookmarklist %}
+ {% for link in bookmarklist %}
+ <a href="{{ link.url }}">{{ link.name }}</a><br/>
+ {% endfor %}
+ {% else %}
+ No links, no where...
+ {% endif %}
+ </div>
+{% endblock %}
diff --git a/templates/projects/base.html b/templates/projects/base.html
new file mode 100644
index 0000000..d3654cc
--- /dev/null
+++ b/templates/projects/base.html
@@ -0,0 +1,3 @@
+<!-- -*- Mode: django-html-mumamo -*- -->
+
+{% extends "base.html" %}
diff --git a/templates/projects/project_detail.html b/templates/projects/project_detail.html
new file mode 100644
index 0000000..1c19f4f
--- /dev/null
+++ b/templates/projects/project_detail.html
@@ -0,0 +1,52 @@
+<!-- -*- Mode: django-html-mumamo -*- -->
+
+{% extends "projects/base.html" %}
+
+{% block subtitle %}
+ projects/{{ object.name }}
+{% endblock %}
+
+{% block content %}
+ <div class="container">
+ <div class="header">
+ <span class="title">{{ object.name }}</span>
+ <span class="tagline">{{ object.tagline }}</span>
+ </div>
+
+
+ <p>
+ {% autoescape off %}
+ {{ object.description|linebreaksbr }}
+ {% endautoescape %}
+ </p>
+ </div>
+
+ <div class="container">
+ <div class="header">
+ <span class="title">Stats</title>
+ </div>
+ {% for key, value in stats.items %}
+ {% if value %}
+ {{ key }}: {{ value }}<br/>
+ {% endif %}
+ {% endfor %}
+ </div>
+
+ <div class="container">
+ <div class="header">
+ <span class="title">Links</title>
+ </div>
+ {% for key, value in links.items %}
+ {% if value %}
+ <a href="{{ value }}">{{ key }}</a><br/>
+ {% endif %}
+ {% endfor %}
+ </div>
+
+ {% if object.screenshots %}
+ <p>
+ Screenshots here
+ </p>
+ {% endif %}
+
+{% endblock %}
diff --git a/templates/projects/project_list.html b/templates/projects/project_list.html
new file mode 100644
index 0000000..1ab750c
--- /dev/null
+++ b/templates/projects/project_list.html
@@ -0,0 +1,20 @@
+<!-- -*- Mode: django-html-mumamo -*- -->
+
+{% extends "projects/base.html" %}
+
+{% block subtitle %}
+ projects
+{% endblock %}
+
+{% block content %}
+ {% if object_list %}
+ <dl>
+ {% for project in object_list %}
+ <dt><a href="/projects/{{ project.slug }}/">{{ project.name }}</a></dt>
+ <dd>{{ project.tagline }}</dd>
+ {% endfor %}
+ </dl>
+ {% else %}
+ Well, you know me, I'm lazy. Got nothing going on.
+ {% endif %}
+{% endblock %}
diff --git a/urls.py b/urls.py
new file mode 100644
index 0000000..1c46129
--- /dev/null
+++ b/urls.py
@@ -0,0 +1,19 @@
+from django.conf.urls.defaults import *
+from settings import DEPLOY_PATH, DEBUG
+
+# Uncomment the next two lines to enable the admin:
+from django.contrib import admin
+admin.autodiscover()
+
+urlpatterns = patterns('',
+ (r'^blog/', include("blog.urls")),
+ (r'^projects/', include("projects.urls")),
+ (r'^links/', include("links.urls")),
+ (r'^admin/', include(admin.site.urls)),
+ (r'^', include("main.urls")),
+)
+
+if DEBUG:
+ urlpatterns += patterns('',
+ (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '%s/static' % DEPLOY_PATH})
+)