Skip to content

Simplify header text on community pages (#1563) #1614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

WajahatKanju
Copy link
Contributor

Simplify Header Text on Community Pages

Issue Reference

This pull request addresses/fixes #1563.

Description

The current header on the community pages reads:

Building the Django Community for 18 years, 11 months. Come join us!

This text is a bit too detailed, and a comment in the code suggests that it was intended to be shorter.

Changes Made

  • Simplified the header text on community pages by updating the age display to show only the number of years Django has been active. This was achieved by modifying the timesince function call in aggregator/context_processors.py.

FROM:

stats = {"age": timesince(DJANGO_DOB)}

TO

stats = {"age": timesince(DJANGO_DOB, depth=1)}

Added Test

  • Added a unit test to verify that the header text is simplified to show only the number of years and does not include months. The test checks that the output contains "years" and does not contain "months."

Test Method:

def test_header_text_simplification_shows_only_years(self):
    django_dob = datetime.datetime(2005, 7, 21)
    age = timesince(django_dob, depth=1)
    self.assertIn("years", age)
    self.assertNotIn("months", age)

@WajahatKanju
Copy link
Contributor Author

image
To
image

Copy link

@saparya05 saparya05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi WajahatKanju, I reviewed this PR and checked the changes. Everything works as expected, and the code is clean and follows Django's guidelines. Great job! 👍

@@ -143,6 +144,12 @@ def test_feedtype_items_has_only_approved(self):
transform=attrgetter("title"),
)

def test_header_text_simplification_shows_only_years(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Could you move this test into a class just for testing the context processor?
  2. Could you test the context processor function instead of timesince?

@adamzap
Copy link
Member

adamzap commented May 12, 2025

@WajahatKanju I'm going to close this since there has been no response in a week. Please reopen it if you want to finish the pull request.

@adamzap adamzap closed this May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify header text in community pages
3 participants