Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions pydis_site/apps/resources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# The "resources" app

This Django application powering the resources list [on our
website](https://www.pythondiscord.com/resources/).

## Directory structure

The main point of interest here lies in the `resources` directory: every
`.yaml` file in here represents a resource that is listed on our website. If
you are looking for the place to suggest new resources, said directory is the
place to create a new YAML file. In regards to the required keys and our
values, it's best to check the other files we have for a reference.

The app has a single view in `views.py` that takes care of reading the `.yaml`
file. This is a standard Django view, mounted in `urls.py` as usual.

Similar to the [home app](../home), the `templatetags` directory contains custom
[template tags and
filters](https://docs.djangoproject.com/en/dev/howto/custom-template-tags/) used
here.

The `tests` directory validates that our redirects and helper functions work as
expected. If you made changes to the app and are looking for guidance on adding
new tests, the [Django tutorial introducing automated
testing](https://docs.djangoproject.com/en/dev/intro/tutorial05/) is a good
place to start.

This application does not use the database and as such does not have models nor
migrations.
8 changes: 5 additions & 3 deletions pydis_site/apps/resources/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from django_distill import distill_path

from pydis_site.apps.resources import views
from pydis_site.apps.resources.views import ResourceView

app_name = "resources"
urlpatterns = [
distill_path("", views.resources.ResourceView.as_view(), name="index"),
distill_path("<resource_type>/", views.resources.ResourceView.as_view(), name="index"),
# Using `distill_path` instead of `path` allows this to be available
# in static preview builds.
distill_path("", ResourceView.as_view(), name="index"),
distill_path("<resource_type>/", ResourceView.as_view(), name="index"),
]
3 changes: 0 additions & 3 deletions pydis_site/apps/resources/views/__init__.py

This file was deleted.