aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-03-10 11:37:30 +0100
committerGravatar Tom Willemsen2012-03-10 11:37:30 +0100
commitca93d7a2d20f2044bfe3a15ecd43160ba84d7ad2 (patch)
tree840161b2cd387112003c29734b63135adb9fd0b9
parent9648ce73fda47739be5465d8142c38bda588c6f6 (diff)
downloadryuslash.org-ca93d7a2d20f2044bfe3a15ecd43160ba84d7ad2.tar.gz
ryuslash.org-ca93d7a2d20f2044bfe3a15ecd43160ba84d7ad2.zip
Add name and profile link to Feed model
And show a link to the profile through that url.
-rw-r--r--aggregator/fixtures/initial_data.json8
-rw-r--r--aggregator/migrations/0001_initial.py4
-rw-r--r--aggregator/models.py5
-rw-r--r--templates/aggregator/posts.html6
4 files changed, 23 insertions, 0 deletions
diff --git a/aggregator/fixtures/initial_data.json b/aggregator/fixtures/initial_data.json
index 76c6471..58fb2d4 100644
--- a/aggregator/fixtures/initial_data.json
+++ b/aggregator/fixtures/initial_data.json
@@ -3,8 +3,10 @@
"model": "aggregator.Feed",
"pk": 1,
"fields": {
+ "name": "Advogato",
"base_url": "http://www.advogato.org/",
"feed_url": "person/ryuslash/rss.xml",
+ "profile_url": "person/ryuslash",
"uses_title": false,
"favicon_ext": "ico"
}
@@ -13,8 +15,10 @@
"model": "aggregator.Feed",
"pk": 2,
"fields": {
+ "name": "Diasp*",
"base_url": "http://diasp.org/",
"feed_url": "public/ryuslash.atom",
+ "profile_url": "public/ryuslash",
"uses_title": false,
"favicon_ext": "png",
"br2nl": true
@@ -24,8 +28,10 @@
"model": "aggregator.Feed",
"pk": 3,
"fields": {
+ "name": "Identi.ca",
"base_url": "http://identi.ca/",
"feed_url": "api/statuses/user_timeline/107950.rss",
+ "profile_url": "ryuslash",
"uses_title": false,
"favicon_ext": "ico"
}
@@ -34,8 +40,10 @@
"model": "aggregator.Feed",
"pk": 4,
"fields": {
+ "name": "Github",
"base_url": "https://github.com/",
"feed_url": "ryuslash.atom",
+ "profile_url": "ryuslash",
"uses_title": true,
"favicon_ext": "png"
}
diff --git a/aggregator/migrations/0001_initial.py b/aggregator/migrations/0001_initial.py
index 73ca455..f3e2093 100644
--- a/aggregator/migrations/0001_initial.py
+++ b/aggregator/migrations/0001_initial.py
@@ -11,8 +11,10 @@ class Migration(SchemaMigration):
# Adding model 'Feed'
db.create_table('aggregator_feed', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=200)),
('base_url', self.gf('django.db.models.fields.URLField')(max_length=255)),
('feed_url', self.gf('django.db.models.fields.CharField')(max_length=255)),
+ ('profile_url', self.gf('django.db.models.fields.CharField')(max_length=255)),
('favicon_ext', self.gf('django.db.models.fields.CharField')(max_length=4)),
('title', self.gf('django.db.models.fields.CharField')(max_length=500, blank=True)),
('updated', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
@@ -52,6 +54,8 @@ class Migration(SchemaMigration):
'favicon_ext': ('django.db.models.fields.CharField', [], {'max_length': '4'}),
'feed_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'profile_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}),
'updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'uses_title': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
diff --git a/aggregator/models.py b/aggregator/models.py
index 302f774..3825d69 100644
--- a/aggregator/models.py
+++ b/aggregator/models.py
@@ -1,14 +1,19 @@
from django.db import models
class Feed(models.Model):
+ name = models.CharField(max_length=200)
base_url = models.URLField(max_length=255)
feed_url = models.CharField(max_length=255)
+ profile_url = models.CharField(max_length=255)
favicon_ext = models.CharField(max_length=4)
title = models.CharField(max_length=500, blank=True)
updated = models.DateTimeField(null=True, blank=True)
uses_title = models.BooleanField(default=False)
br2nl = models.BooleanField(default=False)
+ def get_profile_url(self):
+ return self.base_url + self.profile_url
+
def get_feed_url(self):
return self.base_url + self.feed_url
diff --git a/templates/aggregator/posts.html b/templates/aggregator/posts.html
index 32f1ed7..94b9626 100644
--- a/templates/aggregator/posts.html
+++ b/templates/aggregator/posts.html
@@ -23,6 +23,12 @@
{{ post.body }}
{% endif %}
{% endautoescape %}
+ <div>
+ Through:
+ <a href="{{ post.feed.get_profile_url }}">
+ {{ post.feed.name|lower }}
+ </a>
+ </div>
</p>
{% endfor %}