diff options
author | 2023-04-14 14:42:16 +0200 | |
---|---|---|
committer | 2023-04-14 12:42:16 +0000 | |
commit | 0524176aa3392aa9978a420c6089012e91ebbbc3 (patch) | |
tree | 49c1d5c08d2c68468dc5e4b3bcbf424d6c268ccc /pydis_site/apps/resources | |
parent | Merge pull request #938 from python-discord/dependabot/pip/httpx-0.24.0 (diff) |
Add README to the resources app (#934)
Diffstat (limited to 'pydis_site/apps/resources')
-rw-r--r-- | pydis_site/apps/resources/README.md | 29 | ||||
-rw-r--r-- | pydis_site/apps/resources/urls.py | 8 | ||||
-rw-r--r-- | pydis_site/apps/resources/views.py (renamed from pydis_site/apps/resources/views/resources.py) | 0 | ||||
-rw-r--r-- | pydis_site/apps/resources/views/__init__.py | 3 |
4 files changed, 34 insertions, 6 deletions
diff --git a/pydis_site/apps/resources/README.md b/pydis_site/apps/resources/README.md new file mode 100644 index 00000000..6f41319a --- /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 ed24dc99..cb33a9d7 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("<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"), ] diff --git a/pydis_site/apps/resources/views/resources.py b/pydis_site/apps/resources/views.py index 2375f722..2375f722 100644 --- a/pydis_site/apps/resources/views/resources.py +++ b/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 986f3e10..00000000 --- a/pydis_site/apps/resources/views/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .resources import ResourceView - -__all__ = ["ResourceView"] |