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

Proposed by Graham Binns
Status: Merged
Merge reported by: Graham Binns
Merged at revision: not available
Proposed branch: lp://staging/~gmb/frabjous/multiple-site-support-bug-401638
Merge into: lp://staging/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://staging/~gmb/frabjous/multiple-site-support-bug-401638
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+18338@code.staging.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
1=== modified file 'demo-project/settings.py'
2--- demo-project/settings.py 2009-07-19 13:07:39 +0000
3+++ demo-project/settings.py 2010-01-31 17:47:11 +0000
4@@ -107,3 +107,6 @@
5 'frabjous.search',
6 'frabjous.tokens',
7 )
8+
9+PINGBACK_TITLE = ''
10+PINGBACK_SOURCE_URL =''
11
12=== modified file 'frabjous/blog/admin.py'
13--- frabjous/blog/admin.py 2009-07-19 13:07:39 +0000
14+++ frabjous/blog/admin.py 2010-01-31 17:47:11 +0000
15@@ -44,6 +44,7 @@
16 'subject',
17 'body',
18 'categories',
19+ 'sites',
20 'published',
21 'comments_enabled',
22 'author',
23
24=== modified file 'frabjous/blog/models.py'
25--- frabjous/blog/models.py 2009-07-19 13:07:39 +0000
26+++ frabjous/blog/models.py 2010-01-31 17:47:11 +0000
27@@ -87,8 +87,13 @@
28 # We can get our list of posts using the q now...
29 return self.filter(q).distinct()
30
31- def get_displayable_posts(self):
32- results = self.filter(published=True)
33+ def get_displayable_posts(self, sites=None):
34+ """Return the displayable posts."""
35+ if sites is None:
36+ sites = Site.objects.get_current()
37+
38+ results = self.filter(
39+ published=True, sites=sites)
40 return results
41
42 def get_most_recent(self, number=5):
43@@ -108,7 +113,7 @@
44 body = models.TextField()
45 categories = models.ManyToManyField(Category, blank=True)
46 comments_enabled = models.BooleanField(default=True)
47- excerpt = models.TextField(null=True, blank=True)
48+ excerpt = models.TextField(null=True, blank=True)
49 date_modified = models.DateTimeField(
50 auto_now=True, null=True, blank=True)
51 date_posted = models.DateTimeField(default=datetime.now)
52@@ -121,9 +126,10 @@
53 published = models.BooleanField(default=False)
54 rpc_servers_pinged = models.ManyToManyField(RPCPingServer, blank=True)
55 slug = models.SlugField(
56- unique_for_date='date_posted',
57- max_length=100)
58+ unique_for_date='date_posted', max_length=100)
59 subject = models.CharField(max_length=255, null=True, blank=True)
60+ sites = models.ManyToManyField(
61+ Site, related_name='posts', default=str(settings.SITE_ID))
62
63 @property
64 def comments(self):
65@@ -205,8 +211,8 @@
66
67 def get_permalink(self):
68 """Return the permalink for the Post, including the Site domain."""
69- return 'http://%s%s' % (Site.objects.get_current().domain,
70- self.get_absolute_url())
71+ return 'http://%s%s' % (
72+ Site.objects.get_current().domain, self.get_absolute_url())
73
74 def __unicode__(self):
75 return self.subject
76@@ -217,14 +223,14 @@
77
78 struct = {
79 'title': self.subject,
80- 'link': "http://%s%s" % (Site.objects.get_current().domain,
81- self.get_absolute_url()),
82+ 'link': "http://%s%s" % (
83+ Site.objects.get_current().domain, self.get_absolute_url()),
84 'description': self.body,
85 'author': self.author.email,
86- 'comments': "http://%s%s" % (Site.objects.get_current().domain,
87- self.get_absolute_url()),
88- 'guid': "http://%s%s" % (Site.objects.get_current().domain,
89- self.get_absolute_url()),
90+ 'comments': "http://%s%s" % (
91+ Site.objects.get_current().domain, self.get_absolute_url()),
92+ 'guid': "http://%s%s" % (
93+ Site.objects.get_current().domain, self.get_absolute_url()),
94 'pubDate': self.date_posted.strftime("%Y-%m-%d %H:%M:%S"),
95 'category': categories,
96 'postid': self.id,

Subscribers

People subscribed via source and target branches

to all changes: