Merge lp:~gmb/frabjous/multiple-site-support-bug-401638 into lp:frabjous

Proposed by Graham Binns
Status: Merged
Merge reported by: Graham Binns
Merged at revision: not available
Proposed branch: lp:~gmb/frabjous/multiple-site-support-bug-401638
Merge into: lp:frabjous
Diff against target: 96 lines (+23/-13)
3 files modified
demo-project/settings.py (+3/-0)
frabjous/blog/admin.py (+1/-0)
frabjous/blog/models.py (+19/-13)
To merge this branch: bzr merge lp:~gmb/frabjous/multiple-site-support-bug-401638
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+18338@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'demo-project/settings.py'
--- demo-project/settings.py 2009-07-19 13:07:39 +0000
+++ demo-project/settings.py 2010-01-31 17:47:11 +0000
@@ -107,3 +107,6 @@
107 'frabjous.search',107 'frabjous.search',
108 'frabjous.tokens',108 'frabjous.tokens',
109)109)
110
111PINGBACK_TITLE = ''
112PINGBACK_SOURCE_URL =''
110113
=== modified file 'frabjous/blog/admin.py'
--- frabjous/blog/admin.py 2009-07-19 13:07:39 +0000
+++ frabjous/blog/admin.py 2010-01-31 17:47:11 +0000
@@ -44,6 +44,7 @@
44 'subject',44 'subject',
45 'body',45 'body',
46 'categories',46 'categories',
47 'sites',
47 'published',48 'published',
48 'comments_enabled',49 'comments_enabled',
49 'author',50 'author',
5051
=== modified file 'frabjous/blog/models.py'
--- frabjous/blog/models.py 2009-07-19 13:07:39 +0000
+++ frabjous/blog/models.py 2010-01-31 17:47:11 +0000
@@ -87,8 +87,13 @@
87 # We can get our list of posts using the q now...87 # We can get our list of posts using the q now...
88 return self.filter(q).distinct()88 return self.filter(q).distinct()
8989
90 def get_displayable_posts(self):90 def get_displayable_posts(self, sites=None):
91 results = self.filter(published=True)91 """Return the displayable posts."""
92 if sites is None:
93 sites = Site.objects.get_current()
94
95 results = self.filter(
96 published=True, sites=sites)
92 return results97 return results
9398
94 def get_most_recent(self, number=5):99 def get_most_recent(self, number=5):
@@ -108,7 +113,7 @@
108 body = models.TextField()113 body = models.TextField()
109 categories = models.ManyToManyField(Category, blank=True)114 categories = models.ManyToManyField(Category, blank=True)
110 comments_enabled = models.BooleanField(default=True)115 comments_enabled = models.BooleanField(default=True)
111 excerpt = models.TextField(null=True, blank=True)116 excerpt = models.TextField(null=True, blank=True)
112 date_modified = models.DateTimeField(117 date_modified = models.DateTimeField(
113 auto_now=True, null=True, blank=True)118 auto_now=True, null=True, blank=True)
114 date_posted = models.DateTimeField(default=datetime.now)119 date_posted = models.DateTimeField(default=datetime.now)
@@ -121,9 +126,10 @@
121 published = models.BooleanField(default=False)126 published = models.BooleanField(default=False)
122 rpc_servers_pinged = models.ManyToManyField(RPCPingServer, blank=True)127 rpc_servers_pinged = models.ManyToManyField(RPCPingServer, blank=True)
123 slug = models.SlugField(128 slug = models.SlugField(
124 unique_for_date='date_posted',129 unique_for_date='date_posted', max_length=100)
125 max_length=100)
126 subject = models.CharField(max_length=255, null=True, blank=True)130 subject = models.CharField(max_length=255, null=True, blank=True)
131 sites = models.ManyToManyField(
132 Site, related_name='posts', default=str(settings.SITE_ID))
127133
128 @property134 @property
129 def comments(self):135 def comments(self):
@@ -205,8 +211,8 @@
205211
206 def get_permalink(self):212 def get_permalink(self):
207 """Return the permalink for the Post, including the Site domain."""213 """Return the permalink for the Post, including the Site domain."""
208 return 'http://%s%s' % (Site.objects.get_current().domain,214 return 'http://%s%s' % (
209 self.get_absolute_url())215 Site.objects.get_current().domain, self.get_absolute_url())
210216
211 def __unicode__(self):217 def __unicode__(self):
212 return self.subject218 return self.subject
@@ -217,14 +223,14 @@
217223
218 struct = {224 struct = {
219 'title': self.subject,225 'title': self.subject,
220 'link': "http://%s%s" % (Site.objects.get_current().domain,226 'link': "http://%s%s" % (
221 self.get_absolute_url()),227 Site.objects.get_current().domain, self.get_absolute_url()),
222 'description': self.body,228 'description': self.body,
223 'author': self.author.email,229 'author': self.author.email,
224 'comments': "http://%s%s" % (Site.objects.get_current().domain,230 'comments': "http://%s%s" % (
225 self.get_absolute_url()),231 Site.objects.get_current().domain, self.get_absolute_url()),
226 'guid': "http://%s%s" % (Site.objects.get_current().domain,232 'guid': "http://%s%s" % (
227 self.get_absolute_url()),233 Site.objects.get_current().domain, self.get_absolute_url()),
228 'pubDate': self.date_posted.strftime("%Y-%m-%d %H:%M:%S"),234 'pubDate': self.date_posted.strftime("%Y-%m-%d %H:%M:%S"),
229 'category': categories,235 'category': categories,
230 'postid': self.id,236 'postid': self.id,

Subscribers

People subscribed via source and target branches

to all changes: