Skip to content
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

Description on tag pages #443

Merged
merged 7 commits into from
Jun 18, 2024
Merged

Description on tag pages #443

merged 7 commits into from
Jun 18, 2024

Conversation

simonw
Copy link
Owner

@simonw simonw commented Jun 18, 2024

This pull request introduces the ability to add descriptions to tags within the blog application, enhancing the tag functionality by allowing for more detailed information about each tag to be stored and displayed.

  • Adds a description TextField to the Tag model in blog/models.py, allowing descriptions to be stored for each tag.
  • Updates the TagAdmin class in blog/admin.py to include the description field, enabling it to be edited through the Django admin interface.
  • Modifies the view handling /tags/x/ in blog/views.py to include the tag's description in the context passed to the template, making the description available for display.
  • Updates the template templates/archive_tag.html to display the tag's description at the top of the page if it exists, providing users with more context about the tag.
  • Adds a migration file blog/migrations/0020_tag_description.py to apply the changes to the database schema, ensuring the new description field is properly integrated.

Screenshot of the Copilot Workspace session


For more details, open the Copilot Workspace session.

@simonw simonw merged commit 6354c20 into main Jun 18, 2024
1 check was pending
@simonw simonw deleted the tag-description branch June 18, 2024 15:47
simonw added a commit that referenced this pull request Jun 18, 2024
@simonw
Copy link
Owner Author

simonw commented Jun 18, 2024

This was an experimental live demo of Copilot Workspace. I prompted:

Add a feature that lets me add a description to my tag pages, stored in the database table for tags and visible on the /tags/x/ page at the top

I thought this would be an interesting demo because it would need to demonstrate understanding of a variety of different files within the project.

With hindsight it wasn't a great demo - the solution is pretty simple and I could have implemented it myself much faster than using Workspace. It did figure out a working solution (after I reminded it to create a migration) which worked as intended when I tested it locally - I then did a bunch of my own changes to make it better fit my taste.

@simonw
Copy link
Owner Author

simonw commented Jun 18, 2024

https://simonwillison.net/tags/datasette/ illustrates the shipped feature:

CleanShot 2024-06-18 at 09 12 47@2x

Here's a dashboard showing other tags I've added a description to: https://simonwillison.net/dashboard/tags-with-descriptions/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant