Skip to content

Commit

Permalink
remove get_url_parts
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahframe committed Jun 20, 2024
1 parent 05ea60e commit c5a02bd
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions cdhweb/blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,25 +186,6 @@ def author_list(self):
"""Comma-separated list of author names."""
return ", ".join(str(author.person) for author in self.authors.all())

def get_url_parts(self, *args, **kwargs):
"""Custom blog post URLs of the form /updates/2014/03/01/my-post."""
url_parts = super().get_url_parts(*args, **kwargs)
# NOTE evidently these can sometimes be None; unclear why – perhaps it
# gets called in a context where the request is unavailable. Seems to
# happen immediately on page creation; the creation still succeeds.
if url_parts and self.first_published_at:
site_id, root_url, _ = url_parts
page_path = reverse(
"blog:detail",
kwargs={
"year": self.first_published_at.year,
# force two-digit month and day
"month": "%02d" % self.first_published_at.month,
"day": "%02d" % self.first_published_at.day,
"slug": self.slug,
},
)
return site_id, root_url, page_path

def get_sitemap_urls(self, request):
"""Override sitemap listings to add priority for featured posts."""
Expand Down

0 comments on commit c5a02bd

Please sign in to comment.