From 07524797d81df670fa45514296153d0b6ea0c93b Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sun, 9 Apr 2023 00:10:19 +0200 Subject: [PATCH] Add README to the resources app --- pydis_site/apps/resources/README.md | 29 +++++++++++++++++++ pydis_site/apps/resources/urls.py | 8 +++-- .../{views/resources.py => views.py} | 0 pydis_site/apps/resources/views/__init__.py | 3 -- 4 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 pydis_site/apps/resources/README.md rename pydis_site/apps/resources/{views/resources.py => views.py} (100%) delete mode 100644 pydis_site/apps/resources/views/__init__.py diff --git a/pydis_site/apps/resources/README.md b/pydis_site/apps/resources/README.md new file mode 100644 index 000000000..6f41319a9 --- /dev/null +++ b/pydis_site/apps/resources/README.md @@ -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. diff --git a/pydis_site/apps/resources/urls.py b/pydis_site/apps/resources/urls.py index ed24dc994..cb33a9d70 100644 --- a/pydis_site/apps/resources/urls.py +++ b/pydis_site/apps/resources/urls.py @@ -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("/", 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("/", ResourceView.as_view(), name="index"), ] diff --git a/pydis_site/apps/resources/views/resources.py b/pydis_site/apps/resources/views.py similarity index 100% rename from pydis_site/apps/resources/views/resources.py rename to pydis_site/apps/resources/views.py diff --git a/pydis_site/apps/resources/views/__init__.py b/pydis_site/apps/resources/views/__init__.py deleted file mode 100644 index 986f3e102..000000000 --- a/pydis_site/apps/resources/views/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .resources import ResourceView - -__all__ = ["ResourceView"]