Permalink
Browse files

Added @pelle filters

  • Loading branch information...
pelle committed Jun 8, 2008
1 parent 2677584 commit b12befa214f22a2cbffe55d9c860a9993332956c
View
@@ -59,7 +59,6 @@
# Import the part of Django that we use here.
import django.core.handlers.wsgi
-
def main():
# Create a Django application for WSGI.
application = django.core.handlers.wsgi.WSGIHandler()
View
@@ -10,7 +10,7 @@ indexes:
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.
-# Used 93 times in query history.
+# Used 129 times in query history.
- kind: Post
properties:
- name: created
@@ -22,9 +22,14 @@ indexes:
- name: created
direction: desc
-# Used 5 times in query history.
+# Used 10 times in query history.
- kind: Profile
properties:
- name: postCount
direction: desc
+# Used once in query history.
+- kind: Profile
+ properties:
+ - name: post_count
+ direction: desc
View
No changes.
No changes.
@@ -0,0 +1,11 @@
+import re
+from django import template
+#from django.template.defaultfilters import stringfilter
+register = template.Library()
+
+@register.filter
+#@stringfilter
+def atify(value):
+ m=re.compile('(@(\w+))')
+ return m.sub(r'<a href="/profiles/\2" class="profile" rel="friend">\1</a>',value)
+atify.is_safe = True
View
@@ -92,6 +92,7 @@
'django.contrib.contenttypes',
'django.contrib.sessions',
'appengine_django',
+ 'my_filters',
)
SESSION_ENGINE = 'gae_sessions'
@@ -213,6 +213,9 @@ ul.tabs { display: block; }
#posts .post a {
color: #DD0;
}
+#posts .post a.profile {
+ color: #FF0;
+}
#posts .post .author {
color:#8FB;
@@ -1,4 +1,5 @@
{% extends base_template %}
+{% load talk_filters %}
{% block body %}
<div id="posts">
@@ -14,7 +15,7 @@
{%endif%}
{% for post in posts %}
<div class="post">
- {{post.body|urlize}}
+ {{post.body|urlize|atify}}
<span class="author">
{%if post.author%}
<a href="{%url controllers.profiles.show post.author.nick%}">
View
@@ -23,6 +23,7 @@
from django.utils import simplejson
from django.http import HttpResponse
from django.template import loader, Context
+
from models import Profile
def respond(request, user, template, params=None):

0 comments on commit b12befa

Please sign in to comment.