edit BlogPost.get_absolute_url
This commit is contained in:
parent
c44fb6c47a
commit
11e4bc5a10
1 changed files with 1 additions and 7 deletions
|
@ -98,13 +98,7 @@ class BlogPost(models.Model):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
try:
|
|
||||||
BlogPost.objects.get(id=self.id)
|
|
||||||
return reverse("blog_post", args=(self.id , self.slug))
|
return reverse("blog_post", args=(self.id , self.slug))
|
||||||
except BlogPost.DoesNotExist:
|
|
||||||
return reverse("organization_pending_blogs",
|
|
||||||
args=(self.organizations.first().pk, self.organizations.first().slug))
|
|
||||||
|
|
||||||
def can_see(self, user):
|
def can_see(self, user):
|
||||||
if self.visible and self.publish_on <= timezone.now():
|
if self.visible and self.publish_on <= timezone.now():
|
||||||
if not self.is_organization_private:
|
if not self.is_organization_private:
|
||||||
|
|
Loading…
Reference in a new issue