-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add endpoint to fetch filters in JSON format
While this is an API endpoint consumed by the bot, keep it in the `resources` app instead of the `api` app, as all the logic and data for resources is contained within the `resources` app and we don't want to start messing around with that. The response format from the endpoint is as follows: { "Difficulty": { "filters": [ "Beginner", "Intermediate" ], "icon": "fas fa-brain", "hidden": false, "filter_slugs": [ "beginner", "intermediate" ], "slug": "difficulty" }, "Type": { "filters": [ "Book", "Community", "Course", "Interactive", "Podcast", "Project Ideas", "Tool", "Tutorial", "Video" ], "icon": "fas fa-photo-video", "hidden": false, "filter_slugs": [ "book", "community", "course", "interactive", "podcast", "project-ideas", "tool", "tutorial", "video" ], "slug": "type" }, "Payment tiers": { "filters": [ "Free", "Paid", "Subscription" ], "icon": "fas fa-dollar-sign", "hidden": true, "filter_slugs": [ "free", "paid", "subscription" ], "slug": "payment-tiers" }, "Topics": { "filters": [ "Algorithms and Data Structures", "Data Science", "Databases", "Discord Bots", "Game Development", "General", "Microcontrollers", "Security", "Software Design", "Testing", "Tooling", "User Interface", "Web Development", "Other" ], "icon": "fas fa-lightbulb", "hidden": true, "filter_slugs": [ "algorithms-and-data-structures", "data-science", "databases", "discord-bots", "game-development", "general", "microcontrollers", "security", "software-design", "testing", "tooling", "user-interface", "web-development", "other" ], "slug": "topics" } } Closes #710.
- Loading branch information
1 parent
54455ff
commit fcc97ea
Showing
4 changed files
with
132 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
from django_distill import distill_path | ||
|
||
from pydis_site.apps.resources.views import ResourceView | ||
from pydis_site.apps.resources.views import ResourceView, ResourceFilterView | ||
|
||
app_name = "resources" | ||
urlpatterns = [ | ||
# Using `distill_path` instead of `path` allows this to be available | ||
# in static preview builds. | ||
distill_path("", ResourceView.as_view(), name="index"), | ||
distill_path("filters", ResourceFilterView.as_view(), name="filters"), | ||
distill_path("<resource_type>/", ResourceView.as_view(), name="index"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters