Closed bartczak-pa closed 2 months ago
This pull request refactors the RecipeDetailView to use slugs instead of IDs for displaying recipe details. It enhances URL readability and SEO by introducing a slug field to the Recipe model and adjusting URL patterns and templates accordingly. The changes include updating the Recipe and Category models, modifying views, templates, and URLs, and adding new tests to verify the slug-based functionality.
Change | Details | Files |
---|---|---|
Introduce slug field to Recipe model and update Category model |
|
recipes/models.py recipes/migrations/0002_recipe_slug.py recipes/migrations/0003_alter_recipe_slug.py recipes/migrations/0004_alter_category_slug.py |
Refactor RecipeDetailView to use slugs |
|
recipes/views.py |
Update URL patterns to use slugs |
|
recipes/urls.py |
Update templates to use new URL structure |
|
recipes/templates/recipes/category_recipes_list.html recipes/templates/recipes/recipe_list.html |
Add new tests for RecipeDetailView |
|
recipes/tests/test_views.py |
@sourcery-ai review
@sourcery-ai review
Summary
Refactor the RecipeDetailView to use slugs instead of IDs for displaying recipe details, enhancing URL readability and SEO. Update the Recipe model to include a slug field and adjust URL patterns and templates accordingly. Add tests to verify the new slug-based functionality.
New Features:
Enhancements:
Tests: