From e957cdfd2766f34140f9abc48280d1aba53267fc Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 17 May 2021 20:21:06 +0100 Subject: Update project dep guide to only reference poetry --- .../contributing/installing-project-dependencies.md | 20 +++++++------------- .../images/content/contributing/pycharm_pipenv.png | Bin 18513 -> 0 bytes .../content/contributing/pycharm_pipenv_success.png | Bin 27705 -> 0 bytes .../images/content/contributing/pycharm_poetry.png | Bin 0 -> 21396 bytes .../content/contributing/pycharm_poetry_success.png | Bin 0 -> 27819 bytes 5 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 pydis_site/static/images/content/contributing/pycharm_pipenv.png delete mode 100644 pydis_site/static/images/content/contributing/pycharm_pipenv_success.png create mode 100644 pydis_site/static/images/content/contributing/pycharm_poetry.png create mode 100644 pydis_site/static/images/content/contributing/pycharm_poetry_success.png (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md index ba5b3d1b..653b71aa 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md @@ -17,13 +17,13 @@ You should have already cloned your fork as described in [**Cloning a Repository ## Installing dependencies with PyCharm 1. Load up your project in PyCharm. 2. Go to the Project Settings by clicking `File`, then `Settings...`. Alternatively, use the shortcut key: `Ctrl+Alt+S` (`command+comma` on Mac OS). -3. Install the [poetry plugin](https://plugins.jetbrains.com/plugin/14307-poetry). (**Note:** This is not required for the site) -4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`. -![PyCharm Interpreter Settings](/static/images/content/contributing/pycharm_interpreter.png) -5. If installing dependencies for the site, click `Pipenv Environment`, otherwise, click `Poetry Environment`, then click `OK`. -![PyCharm Pipenv Environment](/static/images/content/contributing/pycharm_pipenv.png) -6. PyCharm will automatically install the packages required into a virtual environment. -![PyCharm Project Interpreter](/static/images/content/contributing/pycharm_pipenv_success.png) +3. Install the [poetry plugin](https://plugins.jetbrains.com/plugin/14307-poetry). +4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`.
+![PyCharm Interpreter Settings](/static/images/content/contributing/pycharm_interpreter.png)
+5. Click `Poetry Environment`, then click `OK`.
+![PyCharm Pipenv Environment](/static/images/content/contributing/pycharm_poetry.png)
+6. PyCharm will automatically install the packages required into a virtual environment.
+![PyCharm Project Interpreter](/static/images/content/contributing/pycharm_poetry_success.png) --- @@ -32,13 +32,7 @@ You should have already cloned your fork as described in [**Cloning a Repository 2. Install project and development dependencies. Remember to also set up pre-commit hooks to ensure your pushed commits will never fail linting. --- -- Site: -```shell -$ pipenv sync --dev -$ pipenv run precommit -``` -- Other projects: ```shell $ poetry install $ poetry run task precommit diff --git a/pydis_site/static/images/content/contributing/pycharm_pipenv.png b/pydis_site/static/images/content/contributing/pycharm_pipenv.png deleted file mode 100644 index 5d6620ee..00000000 Binary files a/pydis_site/static/images/content/contributing/pycharm_pipenv.png and /dev/null differ diff --git a/pydis_site/static/images/content/contributing/pycharm_pipenv_success.png b/pydis_site/static/images/content/contributing/pycharm_pipenv_success.png deleted file mode 100644 index 65ac2040..00000000 Binary files a/pydis_site/static/images/content/contributing/pycharm_pipenv_success.png and /dev/null differ diff --git a/pydis_site/static/images/content/contributing/pycharm_poetry.png b/pydis_site/static/images/content/contributing/pycharm_poetry.png new file mode 100644 index 00000000..cb5402b0 Binary files /dev/null and b/pydis_site/static/images/content/contributing/pycharm_poetry.png differ diff --git a/pydis_site/static/images/content/contributing/pycharm_poetry_success.png b/pydis_site/static/images/content/contributing/pycharm_poetry_success.png new file mode 100644 index 00000000..31d44a69 Binary files /dev/null and b/pydis_site/static/images/content/contributing/pycharm_poetry_success.png differ -- cgit v1.2.3 From d9e7c2d9bfd9c7756724c862b7823c45f55911fd Mon Sep 17 00:00:00 2001 From: Janine vN Date: Tue, 18 May 2021 18:30:50 -0400 Subject: Update FAQ to clarify file types allowed Added in wording to clarify why we don't support the discord .txt, .py, and similar file types even though it has preview available for them. --- pydis_site/apps/content/resources/frequently-asked-questions.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/frequently-asked-questions.md b/pydis_site/apps/content/resources/frequently-asked-questions.md index 8b9945aa..212ea5f8 100644 --- a/pydis_site/apps/content/resources/frequently-asked-questions.md +++ b/pydis_site/apps/content/resources/frequently-asked-questions.md @@ -87,6 +87,8 @@ The only file types that we allow on this server are those that Discord supports This is because it's easier and safer for people on the server since they do not need to download a file to view it. It's also to ease the burden on our moderators, otherwise they would have to download and check the files posted to the server. +Even though Discord does support previewing of files like `.txt` and `.py`, that support is only available on Desktop, not mobile. Additionally, we prefer people to use hastebin as it encourages them to only copy over the relevant code snippets instead of their whole code; this makes helping much easier for all involved. + If you want to share code please use our hosted hastebin, [paste.pythondiscord.com](http://paste.pythondiscord.com). -- cgit v1.2.3 From 7df4b0579156022d3f1269de638a0d64a0f812a8 Mon Sep 17 00:00:00 2001 From: bast Date: Fri, 21 May 2021 06:11:59 -0700 Subject: Add permanent, types, and expires_at filters to bot/infractions endpoint --- pydis_site/apps/api/viewsets/bot/infraction.py | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/viewsets/bot/infraction.py b/pydis_site/apps/api/viewsets/bot/infraction.py index bd512ddd..b0c7d332 100644 --- a/pydis_site/apps/api/viewsets/bot/infraction.py +++ b/pydis_site/apps/api/viewsets/bot/infraction.py @@ -1,3 +1,6 @@ +from datetime import datetime + +from django.db.models import QuerySet from django.http.request import HttpRequest from django_filters.rest_framework import DjangoFilterBackend from rest_framework.decorators import action @@ -43,8 +46,12 @@ class InfractionViewSet( - **offset** `int`: the initial index from which to return the results (default 0) - **search** `str`: regular expression applied to the infraction's reason - **type** `str`: the type of the infraction + - **types** `str`: comma separated sequence of types to filter for - **user__id** `int`: snowflake of the user to which the infraction was applied - **ordering** `str`: comma-separated sequence of fields to order the returned results + - **permanent** `bool`: whether or not to retrieve permanent infractions (default True) + - **expires_after** `isodatetime`: the earliest expires_at time to return infractions for + - **expires_before** `isodatetime`: the latest expires_at time to return infractions for Invalid query parameters are ignored. @@ -156,6 +163,41 @@ class InfractionViewSet( return Response(serializer.data) + def get_queryset(self) -> QuerySet: + """ + Called to fetch the initial queryset, used to implement some of the more complex filters. + + This provides the `permanent` and the `expires_gte` and `expires_lte` options. + """ + filter_permanent = self.request.query_params.get('permanent') + additional_filters = {} + if filter_permanent is not None: + additional_filters['expires_at__isnull'] = filter_permanent.lower() == 'true' + + filter_expires_after = self.request.query_params.get('expires_after') + if filter_expires_after: + try: + additional_filters['expires_at__gte'] = datetime.fromisoformat( + filter_expires_after + ) + except ValueError: + raise ValidationError({'expires_after': ['failed to convert to datetime']}) + + filter_expires_before = self.request.query_params.get('expires_before') + if filter_expires_before: + try: + additional_filters['expires_at__lte'] = datetime.fromisoformat( + filter_expires_before + ) + except ValueError: + raise ValidationError({'expires_before': ['failed to convert to datetime']}) + + filter_types = self.request.query_params.get('types') + if filter_types: + additional_filters['type__in'] = [i.strip() for i in filter_types.split(",")] + + return self.queryset.filter(**additional_filters) + @action(url_path='expanded', detail=False) def list_expanded(self, *args, **kwargs) -> Response: """ -- cgit v1.2.3 From ea5a20ae5abb532edc2a852ff0a3bd94fde01a74 Mon Sep 17 00:00:00 2001 From: bast Date: Fri, 21 May 2021 06:48:18 -0700 Subject: Add tests for new filters on bot/infractions endpoint --- pydis_site/apps/api/tests/test_infractions.py | 76 ++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 6 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/tests/test_infractions.py b/pydis_site/apps/api/tests/test_infractions.py index 82b497aa..16c4d294 100644 --- a/pydis_site/apps/api/tests/test_infractions.py +++ b/pydis_site/apps/api/tests/test_infractions.py @@ -1,3 +1,4 @@ +import datetime from datetime import datetime as dt, timedelta, timezone from unittest.mock import patch from urllib.parse import quote @@ -16,7 +17,7 @@ class UnauthenticatedTests(APISubdomainTestCase): self.client.force_authenticate(user=None) def test_detail_lookup_returns_401(self): - url = reverse('bot:infraction-detail', args=(5,), host='api') + url = reverse('bot:infraction-detail', args=(6,), host='api') response = self.client.get(url) self.assertEqual(response.status_code, 401) @@ -34,7 +35,7 @@ class UnauthenticatedTests(APISubdomainTestCase): self.assertEqual(response.status_code, 401) def test_partial_update_returns_401(self): - url = reverse('bot:infraction-detail', args=(5,), host='api') + url = reverse('bot:infraction-detail', args=(6,), host='api') response = self.client.patch(url, data={'reason': 'Have a nice day.'}) self.assertEqual(response.status_code, 401) @@ -44,7 +45,7 @@ class InfractionTests(APISubdomainTestCase): @classmethod def setUpTestData(cls): cls.user = User.objects.create( - id=5, + id=6, name='james', discriminator=1, ) @@ -64,6 +65,22 @@ class InfractionTests(APISubdomainTestCase): reason='James is an ass, and we won\'t be working with him again.', active=False ) + cls.mute_permanent = Infraction.objects.create( + user_id=cls.user.id, + actor_id=cls.user.id, + type='mute', + reason='He has a filthy mouth and I am his soap.', + active=True, + expires_at=None + ) + cls.superstar_expires_soon = Infraction.objects.create( + user_id=cls.user.id, + actor_id=cls.user.id, + type='superstar', + reason='This one doesn\'t matter anymore.', + active=True, + expires_at=datetime.datetime.utcnow() + datetime.timedelta(hours=5) + ) def test_list_all(self): """Tests the list-view, which should be ordered by inserted_at (newest first).""" @@ -73,9 +90,11 @@ class InfractionTests(APISubdomainTestCase): self.assertEqual(response.status_code, 200) infractions = response.json() - self.assertEqual(len(infractions), 2) - self.assertEqual(infractions[0]['id'], self.ban_inactive.id) - self.assertEqual(infractions[1]['id'], self.ban_hidden.id) + self.assertEqual(len(infractions), 4) + self.assertEqual(infractions[0]['id'], self.superstar_expires_soon.id) + self.assertEqual(infractions[1]['id'], self.mute_permanent.id) + self.assertEqual(infractions[2]['id'], self.ban_inactive.id) + self.assertEqual(infractions[3]['id'], self.ban_hidden.id) def test_filter_search(self): url = reverse('bot:infraction-list', host='api') @@ -98,6 +117,51 @@ class InfractionTests(APISubdomainTestCase): self.assertEqual(len(infractions), 1) self.assertEqual(infractions[0]['id'], self.ban_hidden.id) + def test_filter_permanent_false(self): + url = reverse('bot:infraction-list', host='api') + response = self.client.get(f'{url}?type=mute&permanent=false') + + self.assertEqual(response.status_code, 200) + infractions = response.json() + + self.assertEqual(len(infractions), 0) + + def test_filter_permanent_true(self): + url = reverse('bot:infraction-list', host='api') + response = self.client.get(f'{url}?type=mute&permanent=true') + + self.assertEqual(response.status_code, 200) + infractions = response.json() + + self.assertEqual(infractions[0]['id'], self.mute_permanent.id) + + def test_filter_after(self): + url = reverse('bot:infraction-list', host='api') + target_time = datetime.datetime.utcnow() + datetime.timedelta(hours=5) + response = self.client.get(f'{url}?type=superstar&expires_after={target_time.isoformat()}') + + self.assertEqual(response.status_code, 200) + infractions = response.json() + self.assertEqual(len(infractions), 0) + + def test_filter_before(self): + url = reverse('bot:infraction-list', host='api') + target_time = datetime.datetime.utcnow() + datetime.timedelta(hours=5) + response = self.client.get(f'{url}?type=superstar&expires_before={target_time.isoformat()}') + + self.assertEqual(response.status_code, 200) + infractions = response.json() + self.assertEqual(len(infractions), 1) + self.assertEqual(infractions[0]['id'], self.superstar_expires_soon.id) + + def test_filter_manytypes(self): + url = reverse('bot:infraction-list', host='api') + response = self.client.get(f'{url}?types=mute,ban') + + self.assertEqual(response.status_code, 200) + infractions = response.json() + self.assertEqual(len(infractions), 3) + def test_returns_empty_for_no_match(self): url = reverse('bot:infraction-list', host='api') response = self.client.get(f'{url}?type=ban&search=poop') -- cgit v1.2.3 From f53e275e42161b2cf3df49dd6171831edae1db1e Mon Sep 17 00:00:00 2001 From: bast Date: Sat, 22 May 2021 12:57:18 -0700 Subject: Add a test for ordering infractions returned from the api As this is used in the new bot infraction rescheduler --- pydis_site/apps/api/tests/test_infractions.py | 30 ++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/tests/test_infractions.py b/pydis_site/apps/api/tests/test_infractions.py index 16c4d294..fe51307d 100644 --- a/pydis_site/apps/api/tests/test_infractions.py +++ b/pydis_site/apps/api/tests/test_infractions.py @@ -81,6 +81,14 @@ class InfractionTests(APISubdomainTestCase): active=True, expires_at=datetime.datetime.utcnow() + datetime.timedelta(hours=5) ) + cls.voiceban_expires_later = Infraction.objects.create( + user_id=cls.user.id, + actor_id=cls.user.id, + type='voice_ban', + reason='Jet engine mic', + active=True, + expires_at=datetime.datetime.utcnow() + datetime.timedelta(days=5) + ) def test_list_all(self): """Tests the list-view, which should be ordered by inserted_at (newest first).""" @@ -90,11 +98,12 @@ class InfractionTests(APISubdomainTestCase): self.assertEqual(response.status_code, 200) infractions = response.json() - self.assertEqual(len(infractions), 4) - self.assertEqual(infractions[0]['id'], self.superstar_expires_soon.id) - self.assertEqual(infractions[1]['id'], self.mute_permanent.id) - self.assertEqual(infractions[2]['id'], self.ban_inactive.id) - self.assertEqual(infractions[3]['id'], self.ban_hidden.id) + self.assertEqual(len(infractions), 5) + self.assertEqual(infractions[0]['id'], self.voiceban_expires_later.id) + self.assertEqual(infractions[1]['id'], self.superstar_expires_soon.id) + self.assertEqual(infractions[2]['id'], self.mute_permanent.id) + self.assertEqual(infractions[3]['id'], self.ban_inactive.id) + self.assertEqual(infractions[4]['id'], self.ban_hidden.id) def test_filter_search(self): url = reverse('bot:infraction-list', host='api') @@ -162,6 +171,17 @@ class InfractionTests(APISubdomainTestCase): infractions = response.json() self.assertEqual(len(infractions), 3) + def test_sort_expiresby(self): + url = reverse('bot:infraction-list', host='api') + response = self.client.get(f'{url}?ordering=expires_at&permanent=false') + self.assertEqual(response.status_code, 200) + infractions = response.json() + + self.assertEqual(len(infractions), 3) + self.assertEqual(infractions[0]['id'], self.superstar_expires_soon.id) + self.assertEqual(infractions[1]['id'], self.voiceban_expires_later.id) + self.assertEqual(infractions[2]['id'], self.ban_hidden.id) + def test_returns_empty_for_no_match(self): url = reverse('bot:infraction-list', host='api') response = self.client.get(f'{url}?type=ban&search=poop') -- cgit v1.2.3 From e3696a3b95204b452c18db910352df5617a7e77b Mon Sep 17 00:00:00 2001 From: bast Date: Sat, 22 May 2021 13:35:13 -0700 Subject: Add tests for failure states of `expires_before` and `expires_after` filters --- pydis_site/apps/api/tests/test_infractions.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/tests/test_infractions.py b/pydis_site/apps/api/tests/test_infractions.py index fe51307d..0f9a53c2 100644 --- a/pydis_site/apps/api/tests/test_infractions.py +++ b/pydis_site/apps/api/tests/test_infractions.py @@ -163,6 +163,20 @@ class InfractionTests(APISubdomainTestCase): self.assertEqual(len(infractions), 1) self.assertEqual(infractions[0]['id'], self.superstar_expires_soon.id) + def test_filter_after_invalid(self): + url = reverse('bot:infraction-list', host='api') + response = self.client.get(f'{url}?expires_after=gibberish') + + self.assertEqual(response.status_code, 400) + self.assertEqual(list(response.json())[0], "expires_after") + + def test_filter_before_invalid(self): + url = reverse('bot:infraction-list', host='api') + response = self.client.get(f'{url}?expires_before=000000000') + + self.assertEqual(response.status_code, 400) + self.assertEqual(list(response.json())[0], "expires_before") + def test_filter_manytypes(self): url = reverse('bot:infraction-list', host='api') response = self.client.get(f'{url}?types=mute,ban') -- cgit v1.2.3 From ad1a90b48f88a323c28c742034b70436d1e70a81 Mon Sep 17 00:00:00 2001 From: ToxicKidz Date: Sat, 22 May 2021 18:23:14 -0400 Subject: chore: Update guides to use poetry instead of pipenv --- docs/setup.md | 4 ++-- .../contributing-guidelines/supplemental-information.md | 2 +- .../contributing/installing-project-dependencies.md | 2 +- .../content/resources/guides/pydis-guides/contributing/site.md | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'pydis_site') diff --git a/docs/setup.md b/docs/setup.md index d992067e..d88021cc 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -82,8 +82,8 @@ Make sure you add the following to your hosts file: ``` When trying to access the site, you'll be using the domains above instead of the usual `localhost:8000`. -Finally, you will need to set the environment variable `DEBUG=1`. When using `pipenv`, you can -set put this into an `.env` file to have it exported automatically. It's also recommended to +Finally, you will need to set the environment variable `DEBUG=1`. If you have `python-dotenv` installed, you can put this into a + `.env` file to have it exported automatically. It's also recommended to export `LOG_LEVEL=INFO` when using `DEBUG=1` if you don't want super verbose logs. To run the server, run `python manage.py runserver`. If it gives you an error saying diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md index 24dc9aa9..70d47563 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md @@ -40,7 +40,7 @@ If the linter complains, the commit is aborted so that you can fix the linting e That way, you never commit the problematic code in the first place! Please refer to the project-specific documentation to see how to setup and run those tools. -In most cases, you can install pre-commit using `pipenv run precommit` or `poetry run task precommit`, and lint using `pipenv run lint` or `poetry run task lint`. +In most cases, you can install pre-commit using `poetry run task precommit`, and lint using `poetry run task lint`. ## Type Hinting diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md index 653b71aa..bd7efe67 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md @@ -21,7 +21,7 @@ You should have already cloned your fork as described in [**Cloning a Repository 4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`.
![PyCharm Interpreter Settings](/static/images/content/contributing/pycharm_interpreter.png)
5. Click `Poetry Environment`, then click `OK`.
-![PyCharm Pipenv Environment](/static/images/content/contributing/pycharm_poetry.png)
+![PyCharm Poetry Environment](/static/images/content/contributing/pycharm_poetry.png)
6. PyCharm will automatically install the packages required into a virtual environment.
![PyCharm Project Interpreter](/static/images/content/contributing/pycharm_poetry_success.png) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index 75d27d99..899fd236 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -7,9 +7,9 @@ toc: 1 # Requirements -- [Python 3.8](https://www.python.org/downloads/) -- [Pipenv](https://github.com/pypa/pipenv#installation) - - `pip install pipenv` +- [Python 3.9](https://www.python.org/downloads/) +- [Poetry](https://python-poetry.org/docs/#installation) + - `pip install poetry` - [Git](https://git-scm.com/downloads) - [Windows](https://git-scm.com/download/win) - [MacOS](https://git-scm.com/download/mac) or `brew install git` @@ -122,10 +122,10 @@ If you're not using Docker, then use [pg_ctl](https://www.postgresql.org/docs/cu ### Webserver -Starting the webserver is done simply through pipenv: +Starting the webserver is done simply through poetry: ```shell -pipenv run start +poetry run task start ``` --- -- cgit v1.2.3 From a3c96d2e92af9004450b746ec27137a2e7aa256e Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 23 May 2021 16:17:10 +0100 Subject: Authenticate with the github api to avoid rate limits --- pydis_site/apps/home/views/home.py | 4 +++- pydis_site/constants.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/home/views/home.py b/pydis_site/apps/home/views/home.py index e77772fb..b3767d37 100644 --- a/pydis_site/apps/home/views/home.py +++ b/pydis_site/apps/home/views/home.py @@ -9,6 +9,7 @@ from django.utils import timezone from django.views import View from pydis_site.apps.home.models import RepositoryMetadata +from pydis_site.constants import GITHUB_TOKEN log = logging.getLogger(__name__) @@ -18,6 +19,7 @@ class HomeView(View): github_api = "https://api.github.com/users/python-discord/repos?per_page=100" repository_cache_ttl = 3600 + headers = {"Authorization": f"token {GITHUB_TOKEN}"} # Which of our GitHub repos should be displayed on the front page, and in which order? repos = [ @@ -42,7 +44,7 @@ class HomeView(View): repo_dict = {} # Fetch the data from the GitHub API - api_data: List[dict] = requests.get(self.github_api).json() + api_data: List[dict] = requests.get(self.github_api, headers=self.headers).json() # Process the API data into our dict for repo in api_data: diff --git a/pydis_site/constants.py b/pydis_site/constants.py index c7ab5db0..e6a63d12 100644 --- a/pydis_site/constants.py +++ b/pydis_site/constants.py @@ -1,3 +1,4 @@ import os GIT_SHA = os.environ.get("GIT_SHA", "development") +GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN") -- cgit v1.2.3 From b9f2589c7b2b5f171c47f1a614229ff999341b29 Mon Sep 17 00:00:00 2001 From: bast Date: Sun, 30 May 2021 14:46:27 -0700 Subject: Raise ValidationError for new bot/infractions filter if the types are invalid If the before time is after the after time, or if both `type` and `types` are specified --- pydis_site/apps/api/tests/test_infractions.py | 22 ++++++++++++++++++++++ pydis_site/apps/api/viewsets/bot/infraction.py | 13 +++++++++++++ 2 files changed, 35 insertions(+) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/tests/test_infractions.py b/pydis_site/apps/api/tests/test_infractions.py index 0f9a53c2..f2641492 100644 --- a/pydis_site/apps/api/tests/test_infractions.py +++ b/pydis_site/apps/api/tests/test_infractions.py @@ -177,6 +177,20 @@ class InfractionTests(APISubdomainTestCase): self.assertEqual(response.status_code, 400) self.assertEqual(list(response.json())[0], "expires_before") + def test_after_before_before_invalid(self): + url = reverse('bot:infraction-list', host='api') + target_time = datetime.datetime.utcnow() + datetime.timedelta(hours=5) + target_time_late = datetime.datetime.utcnow() + datetime.timedelta(hours=9) + response = self.client.get( + f'{url}?expires_before={target_time_late.isoformat()}' + f'&expires_after={target_time.isoformat()}' + ) + + self.assertEqual(response.status_code, 400) + errors = list(response.json()) + self.assertIn("expires_before", errors) + self.assertIn("expires_after", errors) + def test_filter_manytypes(self): url = reverse('bot:infraction-list', host='api') response = self.client.get(f'{url}?types=mute,ban') @@ -185,6 +199,14 @@ class InfractionTests(APISubdomainTestCase): infractions = response.json() self.assertEqual(len(infractions), 3) + def test_types_type_invalid(self): + url = reverse('bot:infraction-list', host='api') + response = self.client.get(f'{url}?types=mute,ban&type=superstar') + + self.assertEqual(response.status_code, 400) + errors = list(response.json()) + self.assertEqual("types", errors[0]) + def test_sort_expiresby(self): url = reverse('bot:infraction-list', host='api') response = self.client.get(f'{url}?ordering=expires_at&permanent=false') diff --git a/pydis_site/apps/api/viewsets/bot/infraction.py b/pydis_site/apps/api/viewsets/bot/infraction.py index b0c7d332..00dd05b8 100644 --- a/pydis_site/apps/api/viewsets/bot/infraction.py +++ b/pydis_site/apps/api/viewsets/bot/infraction.py @@ -54,6 +54,8 @@ class InfractionViewSet( - **expires_before** `isodatetime`: the latest expires_at time to return infractions for Invalid query parameters are ignored. + Only one of `type` and `types` may be provided. If both `expires_before` and `expires_after` + are provided, `expires_after` must come after `expires_before`. #### Response format Response is paginated but the result is returned without any pagination metadata. @@ -192,8 +194,19 @@ class InfractionViewSet( except ValueError: raise ValidationError({'expires_before': ['failed to convert to datetime']}) + if 'expires_at__lte' in additional_filters and 'expires_at__gte' in additional_filters: + if additional_filters['expires_at__gte'] < additional_filters['expires_at__lte']: + raise ValidationError({ + 'expires_before': ['cannot be after expires_after'], + 'expires_after': ['cannot be before expires_before'], + }) + filter_types = self.request.query_params.get('types') if filter_types: + if self.request.query_params.get('type'): + raise ValidationError({ + 'types': ['you must provide only one of "type" or "types"'], + }) additional_filters['type__in'] = [i.strip() for i in filter_types.split(",")] return self.queryset.filter(**additional_filters) -- cgit v1.2.3 From 45dfba505e04eec968a3be701e868753b8e4a849 Mon Sep 17 00:00:00 2001 From: bast Date: Sun, 30 May 2021 16:00:24 -0700 Subject: Fix bot/infractions after and before filter check being inverted The check was backwards, enforcing that no results must ever be returned Relevant tests have been added that actually fetch an infraction with the right times so that I'm sure it's not still broken --- pydis_site/apps/api/tests/test_infractions.py | 19 ++++++++++++++++--- pydis_site/apps/api/viewsets/bot/infraction.py | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/tests/test_infractions.py b/pydis_site/apps/api/tests/test_infractions.py index f2641492..d717ab48 100644 --- a/pydis_site/apps/api/tests/test_infractions.py +++ b/pydis_site/apps/api/tests/test_infractions.py @@ -177,15 +177,28 @@ class InfractionTests(APISubdomainTestCase): self.assertEqual(response.status_code, 400) self.assertEqual(list(response.json())[0], "expires_before") - def test_after_before_before_invalid(self): + def test_after_before_before(self): url = reverse('bot:infraction-list', host='api') - target_time = datetime.datetime.utcnow() + datetime.timedelta(hours=5) - target_time_late = datetime.datetime.utcnow() + datetime.timedelta(hours=9) + target_time = datetime.datetime.utcnow() + datetime.timedelta(hours=4) + target_time_late = datetime.datetime.utcnow() + datetime.timedelta(hours=6) response = self.client.get( f'{url}?expires_before={target_time_late.isoformat()}' f'&expires_after={target_time.isoformat()}' ) + self.assertEqual(response.status_code, 200) + self.assertEqual(len(response.json()), 1) + self.assertEqual(response.json()[0]["id"], self.superstar_expires_soon.id) + + def test_after_after_before_invalid(self): + url = reverse('bot:infraction-list', host='api') + target_time = datetime.datetime.utcnow() + datetime.timedelta(hours=5) + target_time_late = datetime.datetime.utcnow() + datetime.timedelta(hours=9) + response = self.client.get( + f'{url}?expires_before={target_time.isoformat()}' + f'&expires_after={target_time_late.isoformat()}' + ) + self.assertEqual(response.status_code, 400) errors = list(response.json()) self.assertIn("expires_before", errors) diff --git a/pydis_site/apps/api/viewsets/bot/infraction.py b/pydis_site/apps/api/viewsets/bot/infraction.py index 00dd05b8..0baab6fd 100644 --- a/pydis_site/apps/api/viewsets/bot/infraction.py +++ b/pydis_site/apps/api/viewsets/bot/infraction.py @@ -195,7 +195,7 @@ class InfractionViewSet( raise ValidationError({'expires_before': ['failed to convert to datetime']}) if 'expires_at__lte' in additional_filters and 'expires_at__gte' in additional_filters: - if additional_filters['expires_at__gte'] < additional_filters['expires_at__lte']: + if additional_filters['expires_at__gte'] > additional_filters['expires_at__lte']: raise ValidationError({ 'expires_before': ['cannot be after expires_after'], 'expires_after': ['cannot be before expires_before'], -- cgit v1.2.3 From 7a5a0321d8638d22d58112d8976d18fb07d7ce4e Mon Sep 17 00:00:00 2001 From: bast Date: Sun, 30 May 2021 16:14:12 -0700 Subject: Ensure bot/infractions does not accept both expires and permanent filters Expires and permanent=false are permitted and tested for. Expires_before also filters the database for permanent=false explicitly --- pydis_site/apps/api/tests/test_infractions.py | 29 ++++++++++++++++++++++++++ pydis_site/apps/api/viewsets/bot/infraction.py | 18 ++++++++++++++++ 2 files changed, 47 insertions(+) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/tests/test_infractions.py b/pydis_site/apps/api/tests/test_infractions.py index d717ab48..967698ff 100644 --- a/pydis_site/apps/api/tests/test_infractions.py +++ b/pydis_site/apps/api/tests/test_infractions.py @@ -204,6 +204,35 @@ class InfractionTests(APISubdomainTestCase): self.assertIn("expires_before", errors) self.assertIn("expires_after", errors) + def test_permanent_after_invalid(self): + url = reverse('bot:infraction-list', host='api') + target_time = datetime.datetime.utcnow() + datetime.timedelta(hours=5) + response = self.client.get(f'{url}?permanent=true&expires_after={target_time.isoformat()}') + + self.assertEqual(response.status_code, 400) + errors = list(response.json()) + self.assertEqual("permanent", errors[0]) + + def test_permanent_before_invalid(self): + url = reverse('bot:infraction-list', host='api') + target_time = datetime.datetime.utcnow() + datetime.timedelta(hours=5) + response = self.client.get(f'{url}?permanent=true&expires_before={target_time.isoformat()}') + + self.assertEqual(response.status_code, 400) + errors = list(response.json()) + self.assertEqual("permanent", errors[0]) + + def test_nonpermanent_before(self): + url = reverse('bot:infraction-list', host='api') + target_time = datetime.datetime.utcnow() + datetime.timedelta(hours=6) + response = self.client.get( + f'{url}?permanent=false&expires_before={target_time.isoformat()}' + ) + + self.assertEqual(response.status_code, 200) + self.assertEqual(len(response.json()), 1) + self.assertEqual(response.json()[0]["id"], self.superstar_expires_soon.id) + def test_filter_manytypes(self): url = reverse('bot:infraction-list', host='api') response = self.client.get(f'{url}?types=mute,ban') diff --git a/pydis_site/apps/api/viewsets/bot/infraction.py b/pydis_site/apps/api/viewsets/bot/infraction.py index 0baab6fd..f8b0cb9d 100644 --- a/pydis_site/apps/api/viewsets/bot/infraction.py +++ b/pydis_site/apps/api/viewsets/bot/infraction.py @@ -56,6 +56,7 @@ class InfractionViewSet( Invalid query parameters are ignored. Only one of `type` and `types` may be provided. If both `expires_before` and `expires_after` are provided, `expires_after` must come after `expires_before`. + If `permanent` is provided and true, `expires_before` and `expires_after` must not be provided. #### Response format Response is paginated but the result is returned without any pagination metadata. @@ -201,6 +202,23 @@ class InfractionViewSet( 'expires_after': ['cannot be before expires_before'], }) + if ( + ('expires_at__lte' in additional_filters or 'expires_at__gte' in additional_filters) + and 'expires_at__isnull' in additional_filters + and additional_filters['expires_at__isnull'] + ): + raise ValidationError({ + 'permanent': [ + 'cannot filter for permanent infractions at the' + ' same time as expires_at or expires_before', + ] + }) + + if filter_expires_before: + # Filter out permanent infractions specifically if we want ones that will expire + # before a given date + additional_filters['expires_at__isnull'] = False + filter_types = self.request.query_params.get('types') if filter_types: if self.request.query_params.get('type'): -- cgit v1.2.3 From 4158e52375c0c47fd29cfc18be3b19e8e6939541 Mon Sep 17 00:00:00 2001 From: Soham Banerjee Date: Mon, 31 May 2021 16:13:50 +0530 Subject: command line instructions moved up --- .../contributing/cloning-repository.md | 21 ++++++++------- .../installing-project-dependencies.md | 30 ++++++++++++---------- 2 files changed, 28 insertions(+), 23 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md index fad54374..1acb5400 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md @@ -13,19 +13,22 @@ The following will use the [Sir-Lancebot](https://github.com/python-discord/sir- --- -## Cloning with PyCharm -1. Load up PyCharm and click `Get from VCS`.
-![Create Project in PyCharm](/static/images/content/contributing/pycharm_create_project.png) -2. Enter the URL of your forked repository. -3. Change the directory if you desire and click `Clone`.
-![Clone Git Project in Pycharm](/static/images/content/contributing/pycharm_checkout.png) - ---- - ## Cloning with the command line + 1. Clone your forked repository using `git clone` followed by your fork's Git URL. Then, change your working directory to the repository. + ```shell $ git clone https://github.com//sir-lancebot ... $ cd sir-lancebot ``` + +--- + +## Cloning with PyCharm + +1. Load up PyCharm and click `Get from VCS`.
+ ![Create Project in PyCharm](/static/images/content/contributing/pycharm_create_project.png) +2. Enter the URL of your forked repository. +3. Change the directory if you desire and click `Clone`.
+ ![Clone Git Project in Pycharm](/static/images/content/contributing/pycharm_checkout.png) diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md index bd7efe67..ea991d15 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md @@ -14,26 +14,28 @@ You should have already cloned your fork as described in [**Cloning a Repository --- -## Installing dependencies with PyCharm -1. Load up your project in PyCharm. -2. Go to the Project Settings by clicking `File`, then `Settings...`. Alternatively, use the shortcut key: `Ctrl+Alt+S` (`command+comma` on Mac OS). -3. Install the [poetry plugin](https://plugins.jetbrains.com/plugin/14307-poetry). -4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`.
-![PyCharm Interpreter Settings](/static/images/content/contributing/pycharm_interpreter.png)
-5. Click `Poetry Environment`, then click `OK`.
-![PyCharm Poetry Environment](/static/images/content/contributing/pycharm_poetry.png)
-6. PyCharm will automatically install the packages required into a virtual environment.
-![PyCharm Project Interpreter](/static/images/content/contributing/pycharm_poetry_success.png) - ---- - ## Installing dependencies with the command line + 1. Make sure you are in the root project directory. This directory will always have a file titled `README.md`. 2. Install project and development dependencies. Remember to also set up pre-commit hooks to ensure your pushed commits will never fail linting. ---- +--- ```shell $ poetry install $ poetry run task precommit ``` + +--- + +## Installing dependencies with PyCharm + +1. Load up your project in PyCharm. +2. Go to the Project Settings by clicking `File`, then `Settings...`. Alternatively, use the shortcut key: `Ctrl+Alt+S` (`command+comma` on Mac OS). +3. Install the [poetry plugin](https://plugins.jetbrains.com/plugin/14307-poetry). +4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`.
+ ![PyCharm Interpreter Settings](/static/images/content/contributing/pycharm_interpreter.png)
+5. Click `Poetry Environment`, then click `OK`.
+ ![PyCharm Poetry Environment](/static/images/content/contributing/pycharm_poetry.png)
+6. PyCharm will automatically install the packages required into a virtual environment.
+ ![PyCharm Project Interpreter](/static/images/content/contributing/pycharm_poetry_success.png) -- cgit v1.2.3 From d70d90c1f34f7dd2dbfdd63c2edac1ac05a5a5af Mon Sep 17 00:00:00 2001 From: Soham Banerjee Date: Mon, 31 May 2021 16:57:50 +0530 Subject: table of contents updated --- .../resources/guides/pydis-guides/contributing/cloning-repository.md | 2 +- .../guides/pydis-guides/contributing/installing-project-dependencies.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md index 1acb5400..23d525b8 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md @@ -6,8 +6,8 @@ icon: fab fa-github > **Note:** The process varies depending on your choice of code editor / IDE, so refer to one of the following guides: -- [Cloning with PyCharm](#cloning-with-pycharm) - [Cloning with the command line](#cloning-with-the-command-line) +- [Cloning with PyCharm](#cloning-with-pycharm) The following will use the [Sir-Lancebot](https://github.com/python-discord/sir-lancebot/) repository as an example, but the steps are the same for all other repositories. You should have already retrieved your fork's Git URL as described in [**Creating a Fork**](../forking-repository). diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md index ea991d15..26d6de30 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md @@ -6,8 +6,8 @@ icon: fab fa-python > **Note:** The process varies depending on your choice of code editor / IDE, so refer to one of the following guides: -- [Installing dependencies with PyCharm](#installing-dependencies-with-pycharm) - [Installing dependencies with the command line](#installing-dependencies-with-the-command-line) +- [Installing dependencies with PyCharm](#installing-dependencies-with-pycharm) The following will use the [Sir-Lancebot](https://github.com/python-discord/sir-lancebot/) repository as an example, but the steps are the same for all other repositories. You should have already cloned your fork as described in [**Cloning a Repository**](../cloning-repository). -- cgit v1.2.3 From 8633eaace48a3dd6fae6af93de86e7f577475f29 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Fri, 4 Jun 2021 23:06:32 +0200 Subject: Update `IntegrityError` pattern for PostgreSQL 13. A more specific error is raised on higher PostgreSQL versions, for example, as with the PostgreSQL version running on my local machine. This commit fixes the error message pattern matching behaviour by adding an optional match to the detailed error message. --- pydis_site/apps/api/tests/test_infractions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/tests/test_infractions.py b/pydis_site/apps/api/tests/test_infractions.py index 967698ff..9aae16c0 100644 --- a/pydis_site/apps/api/tests/test_infractions.py +++ b/pydis_site/apps/api/tests/test_infractions.py @@ -664,7 +664,10 @@ class CreationTests(APISubdomainTestCase): ) def test_integrity_error_if_missing_active_field(self): - pattern = 'null value in column "active" violates not-null constraint' + pattern = ( + 'null value in column "active" (of relation "api_infraction" )?' + 'violates not-null constraint' + ) with self.assertRaisesRegex(IntegrityError, pattern): Infraction.objects.create( user=self.user, -- cgit v1.2.3 From ef3afdf0db0067e2748540ab1fb02409bbaf144d Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sat, 5 Jun 2021 00:20:14 +0200 Subject: Include metricity db creation for local setup guide. This is later mentioned in the connection string, but in the local setup, the SQL statement to create the database was missing. --- .../apps/content/resources/guides/pydis-guides/contributing/site.md | 1 + 1 file changed, 1 insertion(+) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index 899fd236..ada47931 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -62,6 +62,7 @@ Run the following queries to create the user and database: ```sql CREATE USER pysite WITH SUPERUSER PASSWORD 'pysite'; CREATE DATABASE pysite WITH OWNER pysite; +CREATE DATABASE metricity WITH OWNER pysite; ``` Finally, enter `/q` to exit psql. -- cgit v1.2.3 From 99954e8ebe41cbe9987b0d65d6291a61bf19e1fb Mon Sep 17 00:00:00 2001 From: kosayoda Date: Sun, 6 Jun 2021 00:00:15 +0800 Subject: Fix incorrect markdown link. --- .../apps/content/resources/guides/pydis-guides/help-channel-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/help-channel-guide.md b/pydis_site/apps/content/resources/guides/pydis-guides/help-channel-guide.md index 2a6e7781..8b7c5584 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/help-channel-guide.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/help-channel-guide.md @@ -32,7 +32,7 @@ If you're not sure where to post, feel free to ask us which channel is relevant Our general help channels move at a fast pace, and attract a far more diverse spectrum of helpers. This is a great choice for a generic Python question, and a good choice if you need an answer as soon as possible. -It's particularly important to [ask good questions](..guides/asking-good-questions) when asking in these channels, or you risk not getting an answer and having your help channel be claimed by someone else. +It's particularly important to [ask good questions](../asking-good-questions) when asking in these channels, or you risk not getting an answer and having your help channel be claimed by someone else. ## How To Claim a Channel -- cgit v1.2.3 From 512bd175cffbc3463679f3e165bea6d0a486f6fa Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sun, 6 Jun 2021 05:32:56 +0200 Subject: Fix `content` app tests not running on macOS (#519) macOS uses `/var/...` as its temp directory, causing issues with the hardcoded usage of `/tmp` as the temporary directory. Therefore, relying on tmp is not portable. Populating the true temporary directory is redundant and may cause more problems because of nested directories. Move the fake content under a subdirectory to avoid this issue. Co-authored-by: MarkKoz --- pydis_site/apps/content/tests/helpers.py | 50 ++++++++++++++++++----------- pydis_site/apps/content/tests/test_utils.py | 31 ++++++++++-------- pydis_site/apps/content/tests/test_views.py | 11 ++----- 3 files changed, 51 insertions(+), 41 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/tests/helpers.py b/pydis_site/apps/content/tests/helpers.py index 29140375..d897c024 100644 --- a/pydis_site/apps/content/tests/helpers.py +++ b/pydis_site/apps/content/tests/helpers.py @@ -1,4 +1,13 @@ -from pyfakefs.fake_filesystem_unittest import TestCase +from pathlib import Path + +from pyfakefs import fake_filesystem_unittest + + +# Set the module constant within Patcher to use the fake filesystem +# https://jmcgeheeiv.github.io/pyfakefs/master/usage.html#modules-to-reload +with fake_filesystem_unittest.Patcher() as _: + BASE_PATH = Path("res") + # Valid markdown content with YAML metadata MARKDOWN_WITH_METADATA = """ @@ -41,11 +50,11 @@ PARSED_METADATA = { PARSED_CATEGORY_INFO = {"title": "Category Name", "description": "Description"} -class MockPagesTestCase(TestCase): +class MockPagesTestCase(fake_filesystem_unittest.TestCase): """ TestCase with a fake filesystem for testing. - Structure: + Structure (relative to BASE_PATH): ├── _info.yml ├── root.md ├── root_without_metadata.md @@ -68,24 +77,27 @@ class MockPagesTestCase(TestCase): """Create the fake filesystem.""" self.setUpPyfakefs() - self.fs.create_file("_info.yml", contents=CATEGORY_INFO) - self.fs.create_file("root.md", contents=MARKDOWN_WITH_METADATA) - self.fs.create_file("root_without_metadata.md", contents=MARKDOWN_WITHOUT_METADATA) - self.fs.create_file("not_a_page.md/_info.yml", contents=CATEGORY_INFO) - self.fs.create_file("category/_info.yml", contents=CATEGORY_INFO) - self.fs.create_file("category/with_metadata.md", contents=MARKDOWN_WITH_METADATA) - self.fs.create_file("category/subcategory/_info.yml", contents=CATEGORY_INFO) + self.fs.create_file(f"{BASE_PATH}/_info.yml", contents=CATEGORY_INFO) + self.fs.create_file(f"{BASE_PATH}/root.md", contents=MARKDOWN_WITH_METADATA) + self.fs.create_file( + f"{BASE_PATH}/root_without_metadata.md", contents=MARKDOWN_WITHOUT_METADATA + ) + self.fs.create_file(f"{BASE_PATH}/not_a_page.md/_info.yml", contents=CATEGORY_INFO) + self.fs.create_file(f"{BASE_PATH}/category/_info.yml", contents=CATEGORY_INFO) + self.fs.create_file( + f"{BASE_PATH}/category/with_metadata.md", contents=MARKDOWN_WITH_METADATA + ) + self.fs.create_file(f"{BASE_PATH}/category/subcategory/_info.yml", contents=CATEGORY_INFO) self.fs.create_file( - "category/subcategory/with_metadata.md", contents=MARKDOWN_WITH_METADATA + f"{BASE_PATH}/category/subcategory/with_metadata.md", contents=MARKDOWN_WITH_METADATA ) self.fs.create_file( - "category/subcategory/without_metadata.md", contents=MARKDOWN_WITHOUT_METADATA + f"{BASE_PATH}/category/subcategory/without_metadata.md", + contents=MARKDOWN_WITHOUT_METADATA ) - # There is always a `tmp` directory in the filesystem, so make it a category - # for testing purposes. - # See: https://jmcgeheeiv.github.io/pyfakefs/release/usage.html#os-temporary-directories - self.fs.create_file("tmp/_info.yml", contents=CATEGORY_INFO) - self.fs.create_file("tmp.md", contents=MARKDOWN_WITH_METADATA) - self.fs.create_file("tmp/category/_info.yml", contents=CATEGORY_INFO) - self.fs.create_dir("tmp/category/subcategory_without_info") + temp = f"{BASE_PATH}/tmp" # noqa: S108 + self.fs.create_file(f"{temp}/_info.yml", contents=CATEGORY_INFO) + self.fs.create_file(f"{temp}.md", contents=MARKDOWN_WITH_METADATA) + self.fs.create_file(f"{temp}/category/_info.yml", contents=CATEGORY_INFO) + self.fs.create_dir(f"{temp}/category/subcategory_without_info") diff --git a/pydis_site/apps/content/tests/test_utils.py b/pydis_site/apps/content/tests/test_utils.py index 6612e44c..be5ea897 100644 --- a/pydis_site/apps/content/tests/test_utils.py +++ b/pydis_site/apps/content/tests/test_utils.py @@ -4,7 +4,7 @@ from django.http import Http404 from pydis_site.apps.content import utils from pydis_site.apps.content.tests.helpers import ( - MockPagesTestCase, PARSED_CATEGORY_INFO, PARSED_HTML, PARSED_METADATA + BASE_PATH, MockPagesTestCase, PARSED_CATEGORY_INFO, PARSED_HTML, PARSED_METADATA ) @@ -12,41 +12,46 @@ class GetCategoryTests(MockPagesTestCase): """Tests for the get_category function.""" def test_get_valid_category(self): - result = utils.get_category(Path("category")) + result = utils.get_category(Path(BASE_PATH, "category")) self.assertEqual(result, {"title": "Category Name", "description": "Description"}) def test_get_nonexistent_category(self): with self.assertRaises(Http404): - utils.get_category(Path("invalid")) + utils.get_category(Path(BASE_PATH, "invalid")) def test_get_category_with_path_to_file(self): # Valid categories are directories, not files with self.assertRaises(Http404): - utils.get_category(Path("root.md")) + utils.get_category(Path(BASE_PATH, "root.md")) def test_get_category_without_info_yml(self): # Categories should provide an _info.yml file with self.assertRaises(FileNotFoundError): - utils.get_category(Path("tmp/category/subcategory_without_info")) + utils.get_category(Path(BASE_PATH, "tmp/category/subcategory_without_info")) class GetCategoriesTests(MockPagesTestCase): """Tests for the get_categories function.""" def test_get_root_categories(self): - result = utils.get_categories(Path(".")) + result = utils.get_categories(BASE_PATH) info = PARSED_CATEGORY_INFO - self.assertEqual(result, {"category": info, "tmp": info, "not_a_page.md": info}) + categories = { + "category": info, + "tmp": info, + "not_a_page.md": info, + } + self.assertEqual(result, categories) def test_get_categories_with_subcategories(self): - result = utils.get_categories(Path("category")) + result = utils.get_categories(Path(BASE_PATH, "category")) self.assertEqual(result, {"subcategory": PARSED_CATEGORY_INFO}) def test_get_categories_without_subcategories(self): - result = utils.get_categories(Path("category/subcategory")) + result = utils.get_categories(Path(BASE_PATH, "category/subcategory")) self.assertEqual(result, {}) @@ -56,14 +61,14 @@ class GetCategoryPagesTests(MockPagesTestCase): def test_get_pages_in_root_category_successfully(self): """The method should successfully retrieve page metadata.""" - root_category_pages = utils.get_category_pages(Path(".")) + root_category_pages = utils.get_category_pages(BASE_PATH) self.assertEqual( root_category_pages, {"root": PARSED_METADATA, "root_without_metadata": {}} ) def test_get_pages_in_subcategories_successfully(self): """The method should successfully retrieve page metadata.""" - category_pages = utils.get_category_pages(Path("category")) + category_pages = utils.get_category_pages(Path(BASE_PATH, "category")) # Page metadata is properly retrieved self.assertEqual(category_pages, {"with_metadata": PARSED_METADATA}) @@ -84,10 +89,10 @@ class GetPageTests(MockPagesTestCase): for msg, page_path, expected_html, expected_metadata in cases: with self.subTest(msg=msg): - html, metadata = utils.get_page(Path(page_path)) + html, metadata = utils.get_page(Path(BASE_PATH, page_path)) self.assertEqual(html, expected_html) self.assertEqual(metadata, expected_metadata) def test_get_nonexistent_page_returns_404(self): with self.assertRaises(Http404): - utils.get_page(Path("invalid")) + utils.get_page(Path(BASE_PATH, "invalid")) diff --git a/pydis_site/apps/content/tests/test_views.py b/pydis_site/apps/content/tests/test_views.py index 74d38f78..b6e752d6 100644 --- a/pydis_site/apps/content/tests/test_views.py +++ b/pydis_site/apps/content/tests/test_views.py @@ -3,27 +3,20 @@ from unittest import TestCase from django.http import Http404 from django.test import RequestFactory, SimpleTestCase, override_settings -from pyfakefs import fake_filesystem_unittest from pydis_site.apps.content.tests.helpers import ( - MockPagesTestCase, PARSED_CATEGORY_INFO, PARSED_HTML, PARSED_METADATA + BASE_PATH, MockPagesTestCase, PARSED_CATEGORY_INFO, PARSED_HTML, PARSED_METADATA ) from pydis_site.apps.content.views import PageOrCategoryView -# Set the module constant within Patcher to use the fake filesystem -# https://jmcgeheeiv.github.io/pyfakefs/master/usage.html#modules-to-reload -with fake_filesystem_unittest.Patcher() as _: - BASE_PATH = Path(".") - - def patch_dispatch_attributes(view: PageOrCategoryView, location: str) -> None: """ Set the attributes set in the `dispatch` method manually. This is necessary because it is never automatically called during tests. """ - view.location = Path(location) + view.location = Path(BASE_PATH, location) # URL location on the filesystem view.full_location = view.location -- cgit v1.2.3 From fc652a7f4640714800caeb561a7ceb900e48f2a2 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sun, 6 Jun 2021 19:55:55 +0200 Subject: Move configuration section to site contributing guide. --- .../guides/pydis-guides/contributing/site.md | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index ada47931..8c21b5b0 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -143,3 +143,35 @@ Unless you are editing the Dockerfile or docker-compose.yml, you shouldn't need Django provides an interface for administration with which you can view and edit the models among other things. It can be found at [http://admin.pythondiscord.local:8000](http://admin.pythondiscord.local:8000). The default credentials are `admin` for the username and `admin` for the password. + +--- + +# Configuration in detail + +The website is configured through the following environment variables: + +## Essential +- **`DATABASE_URL`**: A string specifying the PostgreSQL database to connect to, + in the form `postgresql://user:password@host/database`, such as + `postgresql://joethedestroyer:ihavemnesia33@localhost/pysite_dev` + +- **`METRICITY_DB_URL`**: A string specifying the PostgreSQL metric database to + connect to, in the same form as `$DATABASE_URL`. + +- **`DEBUG`**: Controls Django's internal debugging setup. Enable this when + you're developing locally. Optional, defaults to `False`. + +- **`LOG_LEVEL`**: Any valid Python `logging` module log level - one of `DEBUG`, + `INFO`, `WARN`, `ERROR` or `CRITICAL`. When using debug mode, this defaults to + `INFO`. When testing, defaults to `ERROR`. Otherwise, defaults to `WARN`. + +## Deployment +- **`ALLOWED_HOSTS`**: A comma-separated lists of alternative hosts to allow to + host the website on, when `DEBUG` is not set. Optional, defaults to the + `pythondiscord.com` family of domains. + +- **`SECRET_KEY`**: The secret key used in various parts of Django. Keep this + secret as the name suggests! This is managed for you in debug setups. + +- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` collects + static files. Optional, defaults to `/var/www/pythondiscord.com`. -- cgit v1.2.3 From ef59812d3399dfec16a43565f2b02dfe5c1b81f6 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Mon, 7 Jun 2021 21:21:21 +0200 Subject: Address review comments. - Link detail section in environment variables section. - Update old static path from pre-Docker environment times and mention the Docker setup. diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index 8c21b5b0..24227f24 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -79,6 +79,9 @@ SECRET_KEY=suitable-for-development-only STATIC_ROOT=staticfiles ``` +The [Configuration in Detail](#configuration-in-detail) section contains +detailed information about these settings. + #### Notes regarding `DATABASE_URL` - If the database is hosted locally i.e. on the same machine as the webserver, then use `localhost` for the host. Windows and macOS users may need to use the [Docker host IP](../hosts-file/#windows) instead. @@ -173,5 +176,6 @@ The website is configured through the following environment variables: - **`SECRET_KEY`**: The secret key used in various parts of Django. Keep this secret as the name suggests! This is managed for you in debug setups. -- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` collects - static files. Optional, defaults to `/var/www/pythondiscord.com`. +- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` + collects static files. Optional, defaults to `/app/staticfiles` for the + standard Docker deployment. --- .../content/resources/guides/pydis-guides/contributing/site.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index 8c21b5b0..24227f24 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -79,6 +79,9 @@ SECRET_KEY=suitable-for-development-only STATIC_ROOT=staticfiles ``` +The [Configuration in Detail](#configuration-in-detail) section contains +detailed information about these settings. + #### Notes regarding `DATABASE_URL` - If the database is hosted locally i.e. on the same machine as the webserver, then use `localhost` for the host. Windows and macOS users may need to use the [Docker host IP](../hosts-file/#windows) instead. @@ -173,5 +176,6 @@ The website is configured through the following environment variables: - **`SECRET_KEY`**: The secret key used in various parts of Django. Keep this secret as the name suggests! This is managed for you in debug setups. -- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` collects - static files. Optional, defaults to `/var/www/pythondiscord.com`. +- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` + collects static files. Optional, defaults to `/app/staticfiles` for the + standard Docker deployment. -- cgit v1.2.3 From 1fd6c9bdb0164c9953a4d55277d829009332aa4a Mon Sep 17 00:00:00 2001 From: Kronifer <44979306+Kronifer@users.noreply.github.com> Date: Thu, 10 Jun 2021 08:36:56 -0500 Subject: Added Cloudflare to Sponsors list (#527) --- pydis_site/static/images/sponsors/cloudflare.png | Bin 0 -> 13822 bytes pydis_site/templates/home/index.html | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 pydis_site/static/images/sponsors/cloudflare.png (limited to 'pydis_site') diff --git a/pydis_site/static/images/sponsors/cloudflare.png b/pydis_site/static/images/sponsors/cloudflare.png new file mode 100644 index 00000000..e2cd3b44 Binary files /dev/null and b/pydis_site/static/images/sponsors/cloudflare.png differ diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html index 18f6b77b..08f98607 100644 --- a/pydis_site/templates/home/index.html +++ b/pydis_site/templates/home/index.html @@ -200,6 +200,8 @@ StreamYard + + Cloudflare -- cgit v1.2.3 From b8132bd77c32ec07134605a0f047a614ec8ce379 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Mon, 14 Jun 2021 22:36:18 -0400 Subject: Code Jam 8 - Initial PR for Announcement (#528) --- .../static/images/events/cj8_asciimatics.png | Bin 0 -> 26219 bytes pydis_site/static/images/events/cj8_blessed.gif | Bin 0 -> 41307 bytes pydis_site/static/images/events/cj8_curses.png | Bin 0 -> 6483 bytes pydis_site/static/images/events/cj8_rich.gif | Bin 0 -> 906975 bytes pydis_site/static/images/events/cj8_urwid.png | Bin 0 -> 318 bytes .../static/images/events/summer_code_jam_2021.png | Bin 0 -> 738161 bytes pydis_site/templates/events/index.html | 3 + .../templates/events/pages/code-jams/8/_index.html | 41 +++++++++ .../events/pages/code-jams/8/frameworks.html | 92 +++++++++++++++++++++ .../templates/events/pages/code-jams/8/rules.html | 70 ++++++++++++++++ .../templates/events/sidebar/code-jams/8.html | 17 ++++ .../sidebar/code-jams/previous-code-jams.html | 1 + .../sidebar/code-jams/upcoming-code-jam.html | 6 +- .../templates/events/sidebar/upcoming-event.html | 4 +- 14 files changed, 229 insertions(+), 5 deletions(-) create mode 100644 pydis_site/static/images/events/cj8_asciimatics.png create mode 100644 pydis_site/static/images/events/cj8_blessed.gif create mode 100644 pydis_site/static/images/events/cj8_curses.png create mode 100644 pydis_site/static/images/events/cj8_rich.gif create mode 100644 pydis_site/static/images/events/cj8_urwid.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021.png create mode 100644 pydis_site/templates/events/pages/code-jams/8/_index.html create mode 100644 pydis_site/templates/events/pages/code-jams/8/frameworks.html create mode 100644 pydis_site/templates/events/pages/code-jams/8/rules.html create mode 100644 pydis_site/templates/events/sidebar/code-jams/8.html (limited to 'pydis_site') diff --git a/pydis_site/static/images/events/cj8_asciimatics.png b/pydis_site/static/images/events/cj8_asciimatics.png new file mode 100644 index 00000000..ac52338e Binary files /dev/null and b/pydis_site/static/images/events/cj8_asciimatics.png differ diff --git a/pydis_site/static/images/events/cj8_blessed.gif b/pydis_site/static/images/events/cj8_blessed.gif new file mode 100644 index 00000000..8bdbf5b1 Binary files /dev/null and b/pydis_site/static/images/events/cj8_blessed.gif differ diff --git a/pydis_site/static/images/events/cj8_curses.png b/pydis_site/static/images/events/cj8_curses.png new file mode 100644 index 00000000..c1a177ff Binary files /dev/null and b/pydis_site/static/images/events/cj8_curses.png differ diff --git a/pydis_site/static/images/events/cj8_rich.gif b/pydis_site/static/images/events/cj8_rich.gif new file mode 100644 index 00000000..3a0ffbf3 Binary files /dev/null and b/pydis_site/static/images/events/cj8_rich.gif differ diff --git a/pydis_site/static/images/events/cj8_urwid.png b/pydis_site/static/images/events/cj8_urwid.png new file mode 100644 index 00000000..98a264b7 Binary files /dev/null and b/pydis_site/static/images/events/cj8_urwid.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021.png b/pydis_site/static/images/events/summer_code_jam_2021.png new file mode 100644 index 00000000..778c7c90 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021.png differ diff --git a/pydis_site/templates/events/index.html b/pydis_site/templates/events/index.html index 024e7fdc..64bf2c25 100644 --- a/pydis_site/templates/events/index.html +++ b/pydis_site/templates/events/index.html @@ -9,6 +9,9 @@ {% block event_content %}

Code Jams

+
+ The 2021 Summer Code Jam qualifier will open June 21st. Check out the details here. +

Each year, we organize a Winter Code Jam and a Summer Code Jam. During these events, members of our community will work together in teams to create something amazing using a technology we picked for them. One such technology that was picked for the Winter Code Jam 2020 was Kivy, a cross-platform GUI framework.

To help fuel the creative process, we provide a specific theme, like Ancient Technology or This App Hates You. At the end of the Code Jam, the projects are judged by Python Discord server staff members and guest judges from the larger Python community. The judges will consider creativity, code quality, teamwork, and adherence to the theme.

If you want to read more about Code Jams, visit our Code Jam info page or watch this video showcasing the best projects created during the Winter Code Jam 2020: Ancient Technology:

diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html new file mode 100644 index 00000000..08eaae07 --- /dev/null +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -0,0 +1,41 @@ +{% extends "events/base_sidebar.html" %} + +{% block title %}Summer Code Jam 2021{% endblock %} + +{% block breadcrumb %} +
  • Events
  • +
  • Code Jams
  • +
  • Summer Code Jam 2021
  • +{% endblock %} + +{% block event_content %} +

    Twice a year we host a code jam for members of our server to participate in. The code jam is an event where we place you + in a team with 5 other random server members. You then have 7 days to code some sort of application or program in Python. + Your program must use the specified technology/framework and incorporate the theme chosen by the server. +

    +

    + After the 7 days is complete, your team has 2 days to finish documentation and create a video presentation showcasing + and walking through the program that your team has created. More details and specifics of this will be released within the next 2 weeks. +

    + +

    Important Dates

    +
      +
    • Monday, June 15 - Form to submit theme suggestions opens
    • +
    • Monday, June 21 - The Qualifier is released
    • +
    • Friday, June 25 - Voting for the theme opens
    • +
    • Sunday, June 27 - Github Bootcamp
    • +
    • Wednesday, June 30 - The Qualifier closes
    • +
    • Friday, July 9 - Code Jam Begins
    • +
    • Friday, July 16 - Coding portion of the jam ends
    • +
    • Sunday, July 18 - Code Jam submissions are closed
    • +
    +

    How to Join

    +

    The Qualifier isn't released yet, but to receive the most up-to-date information and to get notified + when the Qualifier is released you can join the server: discord.gg/python.

    +{% endblock %} + +{% block sidebar %} + + {% include "events/sidebar/code-jams/8.html" %} + +{% endblock %} diff --git a/pydis_site/templates/events/pages/code-jams/8/frameworks.html b/pydis_site/templates/events/pages/code-jams/8/frameworks.html new file mode 100644 index 00000000..64ff7a0c --- /dev/null +++ b/pydis_site/templates/events/pages/code-jams/8/frameworks.html @@ -0,0 +1,92 @@ +{% extends "events/base_sidebar.html" %} + +{% load static %} + +{% block title %}Summer Code Jam 2021{% endblock %} + +{% block breadcrumb %} +
  • Events
  • +
  • Code Jams
  • +
  • Summer Code Jam 2021
  • +
  • Allowed Frameworks
  • +{% endblock %} + +{% block event_content %} +

    Below is the list of approved frameworks that you can use for the code jam. Please take note of what frameworks are available for which platform. + Please work with your team to choose a library that everyone can develop on, whether it's cross platform or something you can use WSL or a Virtual Machine for. +

    +

    Urwid

    +
    +
    +
      +
    • Supports: Linux, Mac, other unix-like OS
    • +
    • Somewhat in-depth tutorial
    • +
    • Uses widgets in a fairly straight forward design
    • +
    • Docs include tutorials of both functional and class-based examples
    • +
    +
    +
    + urwid +
    +
    +

    Curses

    +
    +
    +
      +
    • Supports: Linux and other unix-like OS
    • +
    • Part of the standard library
    • +
    • Extensive how-to guide
    • +
    • Very basic, more effort to get working/looking good
    • +
    +
    +
    + curses +
    +
    +

    Blessed

    +
    +
    +
      +
    • Supports: Linux, Mac, and Windows
    • +
    • Sits on top of curses to add more pythonic bindings
    • +
    • Doesn't provide any widgets or layouts
    • +
    +
    +
    + blessed +
    +
    +

    Rich

    +
    +
    +
      +
    • Supports: Linux, Mac, and Windows
    • +
    • Documentation is good and overall is very OOP focused
    • +
    • Robust with many features and example snippets
    • +
    +
    +
    + rich +
    +
    +

    Asciimatics

    +
    +
    +
      +
    • Supports: Linux, Mac, and Windows
    • +
    • Documentation is well structured and straightforward to navigate
    • +
    +
    +
    + asciimatics +
    +
    + + +{% endblock %} + +{% block sidebar %} + + {% include "events/sidebar/code-jams/8.html" %} + +{% endblock %} diff --git a/pydis_site/templates/events/pages/code-jams/8/rules.html b/pydis_site/templates/events/pages/code-jams/8/rules.html new file mode 100644 index 00000000..632ca877 --- /dev/null +++ b/pydis_site/templates/events/pages/code-jams/8/rules.html @@ -0,0 +1,70 @@ +{% extends "events/base_sidebar.html" %} + +{% block title %}Summer Code Jam 2021{% endblock %} + +{% block breadcrumb %} +
  • Events
  • +
  • Code Jams
  • +
  • Summer Code Jam 2021
  • +
  • Rules
  • +{% endblock %} + +{% block event_content %} +
      +
    1. Your solution must use one of the approved frameworks. It is not permitted to circumvent this rule by e.g. using the approved framework as a wrapper for another framework.

    2. +
    3. Your solution should be platform agnostic. For example, if you use filepaths in your submission, use pathlib to create platform agnostic Path objects instead of hardcoding the paths.

    4. +
    5. +

      + You must document precisely how to install and run your project. + This should be as easy as possible, which means you should consider using dependency managers like pipenv or poetry. + We would also encourage you to use docker and docker-compose to containerize your project, but this isn't a requirement. +

      +
    6. +
    7. + You must get contributions from every member of your team, if you have an issue with someone on your team please contact a member of the administration team. + These contributions do not necessarily have to be code, for example it's absolutely fine for someone to contribute management, documentation, graphics or audio. + + Team members that do not contribute will be removed from the Code Jam, and will not receive their share of any prizes the team may win. + They may also be barred from entering future events. + +
    8. +
    9. You must use GitHub as source control.

    10. +
    11. +

      + All code and assets must be compatible with the MIT license. + This is because we will be merging your submission into our summer-code-jam-2021 repo at the end of the jam, + and this repo is licensed with the MIT license. + Projects that include assets that are incompatible with this license may be disqualified. +

      +
    12. +
    13. All code must be written and committed within the time constrictions of the jam. Late commits may be reverted, so make sure you leave enough time to bug test your program.

    14. +
    15. +

      + Use English as the main language for your project, including names, comments, documentation, and commit messages. + The text displayed in your web application should also be in English, + although you are allowed to provide the user with options for internationalisation and translation. +

      +
    16. +
    17. +

      + Your team, once the coding portion of the code jam is complete, must create a video presentation that showcases and explains your final product. + This must be in a video format and must be uploaded somewhere for the judges to view (i.e. unlisted Youtube video, Vimeo, etc.) + The video can be as simple as a screen recording with annotated text. + Teams who do not submit a final video presentation may be disqualified. +

      +
    18. +
    + + +
    + Please note that our regular + community rules and code of conduct + also apply during the event and that we reserve the right to make changes to these rules at any time. +
    +{% endblock %} + +{% block sidebar %} + + {% include "events/sidebar/code-jams/8.html" %} + +{% endblock %} diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html new file mode 100644 index 00000000..fb14d83e --- /dev/null +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -0,0 +1,17 @@ +{% load static %} +
    +

    Important Links

    + Rules + Approved Frameworks + +
    +
    + Summer Code Jam 2021 + + + Django + + + JetBrains + +
    diff --git a/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html b/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html index 154f6ac4..9f9ecd1a 100644 --- a/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html +++ b/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html @@ -1,6 +1,7 @@
    diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 08eaae07..799beca1 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -20,18 +20,26 @@

    Important Dates

      -
    • Monday, June 15 - Form to submit theme suggestions opens
    • +
    • Tuesday, June 15 - Form to submit theme suggestions opens
    • Monday, June 21 - The Qualifier is released
    • Friday, June 25 - Voting for the theme opens
    • -
    • Sunday, June 27 - Github Bootcamp
    • +
    • Sunday, June 27 - GitHub Bootcamp
    • Wednesday, June 30 - The Qualifier closes
    • -
    • Friday, July 9 - Code Jam Begins
    • +
    • Friday, July 9 - Code Jam begins
    • Friday, July 16 - Coding portion of the jam ends
    • Sunday, July 18 - Code Jam submissions are closed
    + +

    Technology

    +

    + The chosen technology/tech stack for this year is Text User Interfaces (TUIs). + Each team must create a program with one of the approved frameworks that creates a user interface that is text based. + For more information of TUIs and what's involved with such an interface, check out this wikipedia article. +

    +

    How to Join

    The Qualifier isn't released yet, but to receive the most up-to-date information and to get notified - when the Qualifier is released you can join the server: discord.gg/python.

    + when the Qualifier is released you can join us on Discord at discord.gg/python.

    {% endblock %} {% block sidebar %} diff --git a/pydis_site/templates/events/pages/code-jams/8/frameworks.html b/pydis_site/templates/events/pages/code-jams/8/frameworks.html index 64ff7a0c..cc1aa671 100644 --- a/pydis_site/templates/events/pages/code-jams/8/frameworks.html +++ b/pydis_site/templates/events/pages/code-jams/8/frameworks.html @@ -8,7 +8,7 @@
  • Events
  • Code Jams
  • Summer Code Jam 2021
  • -
  • Allowed Frameworks
  • +
  • Approved Frameworks
  • {% endblock %} {% block event_content %} @@ -19,6 +19,7 @@
      +
    • Documentation Link
    • Supports: Linux, Mac, other unix-like OS
    • Somewhat in-depth tutorial
    • Uses widgets in a fairly straight forward design
    • @@ -33,6 +34,7 @@
        +
      • Documentation Link
      • Supports: Linux and other unix-like OS
      • Part of the standard library
      • Extensive how-to guide
      • @@ -47,6 +49,7 @@
          +
        • Documentation Link
        • Supports: Linux, Mac, and Windows
        • Sits on top of curses to add more pythonic bindings
        • Doesn't provide any widgets or layouts
        • @@ -60,6 +63,7 @@
          @@ -86,6 +92,19 @@ asciimatics
          +

          Python Prompt Toolkit

          +
          +
          + +
          +
          + python prompt toolkit +
          +
          {% endblock %} -- cgit v1.2.3 From a8a0322c871ef04920167ded706cfdc8a425d958 Mon Sep 17 00:00:00 2001 From: bast Date: Fri, 18 Jun 2021 13:46:06 -0700 Subject: Adjust Message model to support new nitro messages with over 4000 chars --- .../apps/api/migrations/0070_auto_20210618_2010.py | 18 ++++++++++ pydis_site/apps/api/models/bot/message.py | 2 +- pydis_site/apps/api/tests/test_models.py | 40 +++++++++++++++++++++- 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 pydis_site/apps/api/migrations/0070_auto_20210618_2010.py (limited to 'pydis_site') diff --git a/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py b/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py new file mode 100644 index 00000000..b0c79b32 --- /dev/null +++ b/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.14 on 2021-06-18 20:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0069_documentationlink_validators'), + ] + + operations = [ + migrations.AlterField( + model_name='deletedmessage', + name='content', + field=models.CharField(blank=True, help_text='The content of this message, taken from Discord.', max_length=4000), + ), + ] diff --git a/pydis_site/apps/api/models/bot/message.py b/pydis_site/apps/api/models/bot/message.py index ff06de21..60e2a553 100644 --- a/pydis_site/apps/api/models/bot/message.py +++ b/pydis_site/apps/api/models/bot/message.py @@ -43,7 +43,7 @@ class Message(ModelReprMixin, models.Model): verbose_name="Channel ID" ) content = models.CharField( - max_length=2_000, + max_length=4_000, help_text="The content of this message, taken from Discord.", blank=True ) diff --git a/pydis_site/apps/api/tests/test_models.py b/pydis_site/apps/api/tests/test_models.py index 66052e01..1303639e 100644 --- a/pydis_site/apps/api/tests/test_models.py +++ b/pydis_site/apps/api/tests/test_models.py @@ -1,6 +1,7 @@ from datetime import datetime as dt -from django.test import SimpleTestCase +from django.core.exceptions import ValidationError +from django.test import SimpleTestCase, TestCase from django.utils import timezone from pydis_site.apps.api.models import ( @@ -34,6 +35,43 @@ class ReprMixinTests(SimpleTestCase): self.assertEqual(repr(self.klass), expected) +class NitroMessageLengthTest(TestCase): + def setUp(self): + self.user = User.objects.create(id=50, name='bill', discriminator=5) + self.context = MessageDeletionContext.objects.create( + id=50, + actor=self.user, + creation=dt.utcnow() + ) + + def test_create(self): + message = DeletedMessage( + id=46, + author=self.user, + channel_id=666, + content="w"*4000, + deletion_context=self.context, + embeds=[] + ) + + try: + message.clean_fields() + except Exception as e: + self.fail(f"Creation of message of length 3950 failed with: {e}") + + def test_create_failure(self): + message = DeletedMessage( + id=47, + author=self.user, + channel_id=666, + content="w"*4001, + deletion_context=self.context, + embeds=[] + ) + + self.assertRaisesRegex(ValidationError, "content':", message.clean_fields) + + class StringDunderMethodTests(SimpleTestCase): def setUp(self): self.nomination = Nomination( -- cgit v1.2.3 From c40ed8c159f5101d1bc677a66406cef7c99843aa Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 18 Jun 2021 22:16:53 +0100 Subject: Use BigInt for permissions field and remove max value validator BigInt is needed as Discord's permissions number now exceeds that which can be stored in a normal int. I have removed the max value validator, as this just adds maintanence burden for us each time Discord adds new permissions. --- .../apps/api/migrations/0070_auto_20210618_2114.py | 19 +++++++++++++++++++ pydis_site/apps/api/models/bot/role.py | 8 ++------ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 pydis_site/apps/api/migrations/0070_auto_20210618_2114.py (limited to 'pydis_site') diff --git a/pydis_site/apps/api/migrations/0070_auto_20210618_2114.py b/pydis_site/apps/api/migrations/0070_auto_20210618_2114.py new file mode 100644 index 00000000..1d25e421 --- /dev/null +++ b/pydis_site/apps/api/migrations/0070_auto_20210618_2114.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.14 on 2021-06-18 21:14 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0069_documentationlink_validators'), + ] + + operations = [ + migrations.AlterField( + model_name='role', + name='permissions', + field=models.BigIntegerField(help_text='The integer value of the permission bitset of this role from Discord.', validators=[django.core.validators.MinValueValidator(limit_value=0, message='Role permissions cannot be negative.')]), + ), + ] diff --git a/pydis_site/apps/api/models/bot/role.py b/pydis_site/apps/api/models/bot/role.py index cfadfec4..733a8e08 100644 --- a/pydis_site/apps/api/models/bot/role.py +++ b/pydis_site/apps/api/models/bot/role.py @@ -1,6 +1,6 @@ from __future__ import annotations -from django.core.validators import MaxValueValidator, MinValueValidator +from django.core.validators import MinValueValidator from django.db import models from pydis_site.apps.api.models.mixins import ModelReprMixin @@ -38,16 +38,12 @@ class Role(ModelReprMixin, models.Model): ), help_text="The integer value of the colour of this role from Discord." ) - permissions = models.IntegerField( + permissions = models.BigIntegerField( validators=( MinValueValidator( limit_value=0, message="Role permissions cannot be negative." ), - MaxValueValidator( - limit_value=2 << 32, - message="Role permission bitset exceeds value of having all permissions" - ) ), help_text="The integer value of the permission bitset of this role from Discord." ) -- cgit v1.2.3 From e4acdf24ecfd8c2ce52ea56b73813e4bde4d8bec Mon Sep 17 00:00:00 2001 From: Janine vN Date: Sun, 20 Jun 2021 11:38:19 -0400 Subject: Adding GitHub Bootcamp Information This commit adds some basic information about the github bootcamp. More information should and will be added later, but this adds some of the basics and adds it to the sidebar. --- .../events/pages/code-jams/8/github-bootcamp.html | 40 ++++++++++++++++++++++ .../templates/events/sidebar/code-jams/8.html | 1 + 2 files changed, 41 insertions(+) create mode 100644 pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html (limited to 'pydis_site') diff --git a/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html new file mode 100644 index 00000000..a60afa33 --- /dev/null +++ b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html @@ -0,0 +1,40 @@ +{% extends "events/base_sidebar.html" %} + +{% load static %} + +{% block title %}Summer Code Jam 2021{% endblock %} + +{% block breadcrumb %} +
        • Events
        • +
        • Code Jams
        • +
        • Summer Code Jam 2021
        • +
        • GitHub Bootcamp
        • +{% endblock %} + +{% block event_content %} +

          + This year we'll be running a GitHub Bootcamp on Saturday, June 26th. + This bootcamp is intended to be an interactive workshop session where we help participants + get setup with git and using it in a team environment. +

          +

          Session 1: Setting up Git

          +

          + This session will run for an hour and be focused on installing and setting up git for the first time. + We'll have helpers available to help you set up git and get it integreated with your editor of choice. + Whether it's PyCharm, VSCode, or vim, we can help you get rolling with version control. +

          +

          Session 2: Using git and github in a team environment

          +

          + This session will run for an hour. It will be focused on using git and HitHub in a team environment. + You'll be put in a group of people with a repo to work on. +

          + + + +{% endblock %} + +{% block sidebar %} + + {% include "events/sidebar/code-jams/8.html" %} + +{% endblock %} diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index fe65ae2e..3d5a5447 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -3,6 +3,7 @@

          Important Links

          Rules Approved Frameworks + GitHub Bootcamp
        -- cgit v1.2.3 From 8ed04b26d64bb1d3191a94e78db190c46a823473 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Sun, 20 Jun 2021 12:23:10 -0400 Subject: Add in information about the Qualifier This adds in a section about the qualifier and links to it and the sign-up form. --- .../templates/events/pages/code-jams/8/_index.html | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 799beca1..1f08fb66 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -21,9 +21,9 @@

        Important Dates

        • Tuesday, June 15 - Form to submit theme suggestions opens
        • -
        • Monday, June 21 - The Qualifier is released
        • +
        • Monday, June 21 - The Qualifier is released
        • Friday, June 25 - Voting for the theme opens
        • -
        • Sunday, June 27 - GitHub Bootcamp
        • +
        • Sunday, June 27 - GitHub Bootcamp
        • Wednesday, June 30 - The Qualifier closes
        • Friday, July 9 - Code Jam begins
        • Friday, July 16 - Coding portion of the jam ends
        • @@ -36,10 +36,27 @@ Each team must create a program with one of the approved frameworks that creates a user interface that is text based. For more information of TUIs and what's involved with such an interface, check out this wikipedia article.

          - +

          The Qualifier

          +

          + The qualifier is a coding challenge that you are required to complete before registering for the code jam. + This is meant as a basic assessment of your skills to ensure you have enough python knowledge to effectively contribute in a team environment. +

          +

          View the Qualifier

          + Please note the requirements for the qualifier. +
            +
          • The qualifier must be completed using Python 3.9
          • +
          • No external modules are allowed, only those available through the standard library.
          • +
          • The Qualifier must be submitted through the Code Jam sign-up form.
          • +
          +

          How to Join

          -

          The Qualifier isn't released yet, but to receive the most up-to-date information and to get notified - when the Qualifier is released you can join us on Discord at discord.gg/python.

          +

          + To enter into the code jam you must complete The Qualifier and submit the sign-up form. + Don't forget to join us on Discord at discord.gg/python! +

          +

          + {% endblock %} {% block sidebar %} -- cgit v1.2.3 From ef5f4b71397886f6a208f85d88e649c13c7774ad Mon Sep 17 00:00:00 2001 From: Janine vN Date: Sun, 20 Jun 2021 14:15:13 -0400 Subject: Add Tabnine as a sponsor Adds tabnine as a sponsor on the events sidebar. --- pydis_site/static/images/events/Tabnine.png | Bin 0 -> 10534 bytes pydis_site/templates/events/sidebar/code-jams/8.html | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 pydis_site/static/images/events/Tabnine.png (limited to 'pydis_site') diff --git a/pydis_site/static/images/events/Tabnine.png b/pydis_site/static/images/events/Tabnine.png new file mode 100644 index 00000000..eee42a5e Binary files /dev/null and b/pydis_site/static/images/events/Tabnine.png differ diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index 3d5a5447..c1afdf47 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -15,4 +15,7 @@ JetBrains + + Tabnine +
        -- cgit v1.2.3 From 35fb561256e19aafcd7800fb275d3497bcd59680 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Sun, 20 Jun 2021 14:25:45 -0400 Subject: Adds Prizes section to CJ8 page This adds a Prizes section to the Code Jam 8 page. Links, descriptions, and a quick summation of the prizes offered by each sponsor is included. The Python Discord prizes should also be included at a later date. --- .../templates/events/pages/code-jams/8/_index.html | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'pydis_site') diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 1f08fb66..6539e63a 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -1,5 +1,7 @@ {% extends "events/base_sidebar.html" %} +{% load static %} + {% block title %}Summer Code Jam 2021{% endblock %} {% block breadcrumb %} @@ -56,6 +58,69 @@ Don't forget to join us on Discord at discord.gg/python!

        +

        Prizes

        +

        + Our Code Jam Sponsors have provided prizes for the winners of the code jam. + Also, a big thank you to our Patreon patrons for supporting this server and allowing us + to provide our prizes as well. +

        + +
        +
        +
        +
        + Digital Ocean +
        +
        + +

        + Scalable compute platform with add-on storage, security, and monitoring capabilities. + We make it simple to launch in the cloud and scale up as you grow—whether you’re running one virtual machine or ten thousand. +

        +

        Prizes
        + $250 in DigitalOcean credits to a winning team.

        +
        +
        +
        +
        + +
        +
        +
        +
        + JetBrains +
        +
        + +

        + Whatever platform or language you work with, JetBrains has a development tool for you. + We help developers work faster by automating common, repetitive tasks to enable them to stay focused on code design and the big picture. + We provide tools to explore and familiarize with code bases faster. Our products make it easy for you to take care of quality during all stages of development and spend less time on maintenance tasks. +

        +

        Prizes
        + 1-year JetBrain licenses to a winning team.

        +
        +
        +
        +
        +
        +
        +
        +
        + Tabnine +
        +
        + +

        Tabnine is an AI-powered code completion tool used by millions of devs around the world every day + - Tabnine supports dozens of programming languages, in all of your favorite IDEs, saving you tons of time - so that you can type less and code more. + Tabnine comes as a plugin and has a free-forever basic plan, so you can get started with it right away! +

        +

        Prizes
        + 1-year Pro Licenses to Tabnine to a winning team.

        +
        +
        +
        +
        {% endblock %} -- cgit v1.2.3 From d2112a84259c18db2d2a93b3821a8668edc23ada Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Mon, 21 Jun 2021 00:48:27 +0100 Subject: Update navbar hamburger/dropdown anchors to spans There is no href on these items, so they should not be anchors. --- pydis_site/templates/base/navbar.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/base/navbar.html b/pydis_site/templates/base/navbar.html index ee458b03..d7cb49b2 100644 --- a/pydis_site/templates/base/navbar.html +++ b/pydis_site/templates/base/navbar.html @@ -57,12 +57,12 @@ {# More #}
        @@ -98,7 +98,7 @@ We provide tools to explore and familiarize with code bases faster. Our products make it easy for you to take care of quality during all stages of development and spend less time on maintenance tasks.

        Prizes
        - 1-year JetBrain licenses to a winning team.

        + 1-year JetBrain licenses to the members of a winning team.

    @@ -116,7 +116,7 @@ Tabnine comes as a plugin and has a free-forever basic plan, so you can get started with it right away!

    Prizes
    - 1-year Pro Licenses to Tabnine to a winning team.

    + 1-year Pro Licenses to Tabnine to the members of a winning team.

    -- cgit v1.2.3 From 89e52ce860b598cc7575af82b6b7134f246c3e26 Mon Sep 17 00:00:00 2001 From: Boris Muratov <8bee278@gmail.com> Date: Wed, 23 Jun 2021 14:24:40 +0300 Subject: Update git bootcamp date --- pydis_site/templates/events/pages/code-jams/8/_index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 9b75188c..9ebca7c7 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -25,7 +25,7 @@
  • Tuesday, June 15 - Form to submit theme suggestions opens
  • Monday, June 21 - The Qualifier is released
  • Friday, June 25 - Voting for the theme opens
  • -
  • Sunday, June 27 - GitHub Bootcamp
  • +
  • Saturday, June 26 - GitHub Bootcamp
  • Wednesday, June 30 - The Qualifier closes
  • Friday, July 9 - Code Jam begins
  • Friday, July 16 - Coding portion of the jam ends
  • -- cgit v1.2.3 From fa42a72ae957e8e62d1f554a8f21af5b8f247777 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Wed, 23 Jun 2021 21:44:08 -0400 Subject: Updating bootcamp information Adds time and more information about the GitHub bootcamp. --- .../templates/events/pages/code-jams/8/_index.html | 2 +- .../events/pages/code-jams/8/github-bootcamp.html | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 9ebca7c7..d3d3cc0f 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -25,7 +25,7 @@
  • Tuesday, June 15 - Form to submit theme suggestions opens
  • Monday, June 21 - The Qualifier is released
  • Friday, June 25 - Voting for the theme opens
  • -
  • Saturday, June 26 - GitHub Bootcamp
  • +
  • Saturday, June 26 @ 12PM UTC- GitHub Bootcamp
  • Wednesday, June 30 - The Qualifier closes
  • Friday, July 9 - Code Jam begins
  • Friday, July 16 - Coding portion of the jam ends
  • diff --git a/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html index 18951e48..bac03d11 100644 --- a/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html +++ b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html @@ -13,24 +13,29 @@ {% block event_content %}

    - This year we'll be running a GitHub Bootcamp on Saturday, June 26th. + This year we'll be running a GitHub Bootcamp on Saturday, June 26th at 4PM UTC. This bootcamp is intended to be an interactive workshop session where we help participants - get setup with git and using it in a team environment. + get setup with git and using it in a team environment. If you are new to git or would like to brush up on it, + then this is the perfect event for you. +

    +

    + The instructional parts of this bootcamp will be recorded. We'll also be providing a cheatsheet / reference guide to all attendees that will + be made available here for download.

    Session 1: Setting up Git

    - This session will run for an hour and be focused on installing and setting up git for the first time. - We'll have helpers available to help you set up git and get it integreated with your editor of choice. + This first session will run for an hour starting at 4PM UTC. It will be focused on installing and setting up git for the first time. + We'll have helpers available to help you set up git and integreated with your editor of choice. Whether it's PyCharm, VSCode, or vim, we can help you get rolling with version control.

    Session 2: Using git and github in a team environment

    - This session will run for an hour. It will be focused on using git and GitHub in a team environment. - You'll be put in a group of people with a repo to work on. + This session will run for an hour starting at 5PM UTC. It will be focused on using git and GitHub in a team environment. + You'll be put in a group with other attendees and use the common git commands for working in a repo. + You'll learn how to set-up a GitHub reposity with other contributors, how to make branches, make commits, pull down changes, and then make pull requests. + We'll also be going over different strategies for creating branches and best practices for commits and pull requests.

    - - {% endblock %} {% block sidebar %} -- cgit v1.2.3 From 57a6ff40d3abbad39db1394b679c5358bfa9b274 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Wed, 23 Jun 2021 22:01:50 -0400 Subject: Change time to UTC --- pydis_site/templates/events/pages/code-jams/8/_index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index d3d3cc0f..c510c250 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -25,7 +25,7 @@
  • Tuesday, June 15 - Form to submit theme suggestions opens
  • Monday, June 21 - The Qualifier is released
  • Friday, June 25 - Voting for the theme opens
  • -
  • Saturday, June 26 @ 12PM UTC- GitHub Bootcamp
  • +
  • Saturday, June 26 @ 4PM UTC- GitHub Bootcamp
  • Wednesday, June 30 - The Qualifier closes
  • Friday, July 9 - Code Jam begins
  • Friday, July 16 - Coding portion of the jam ends
  • -- cgit v1.2.3 From 0284db7f24fb1f624e0b548894d5248eb0eba1f5 Mon Sep 17 00:00:00 2001 From: Janine vN Date: Wed, 23 Jun 2021 22:08:37 -0400 Subject: Fix typos --- pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html index bac03d11..836ed3ed 100644 --- a/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html +++ b/pydis_site/templates/events/pages/code-jams/8/github-bootcamp.html @@ -25,14 +25,14 @@

    Session 1: Setting up Git

    This first session will run for an hour starting at 4PM UTC. It will be focused on installing and setting up git for the first time. - We'll have helpers available to help you set up git and integreated with your editor of choice. + We'll have helpers available to help you set up git and integrated with your editor of choice. Whether it's PyCharm, VSCode, or vim, we can help you get rolling with version control.

    Session 2: Using git and github in a team environment

    This session will run for an hour starting at 5PM UTC. It will be focused on using git and GitHub in a team environment. You'll be put in a group with other attendees and use the common git commands for working in a repo. - You'll learn how to set-up a GitHub reposity with other contributors, how to make branches, make commits, pull down changes, and then make pull requests. + You'll learn how to set-up a GitHub repository with other contributors, how to make branches, make commits, pull down changes, and then make pull requests. We'll also be going over different strategies for creating branches and best practices for commits and pull requests.

    -- cgit v1.2.3 From 05730b3c55811ec2b9c7c0ff8484714a3ee498b2 Mon Sep 17 00:00:00 2001 From: bast Date: Thu, 24 Jun 2021 07:34:59 -0700 Subject: Add pragma: no cover to mark failure condition of test as known ok --- pydis_site/apps/api/tests/test_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pydis_site') diff --git a/pydis_site/apps/api/tests/test_models.py b/pydis_site/apps/api/tests/test_models.py index 1303639e..5c9ddea4 100644 --- a/pydis_site/apps/api/tests/test_models.py +++ b/pydis_site/apps/api/tests/test_models.py @@ -56,7 +56,7 @@ class NitroMessageLengthTest(TestCase): try: message.clean_fields() - except Exception as e: + except Exception as e: # pragma: no cover self.fail(f"Creation of message of length 3950 failed with: {e}") def test_create_failure(self): -- cgit v1.2.3 From 6c9c7f078d2d677f4e377264e2741fd02a228cab Mon Sep 17 00:00:00 2001 From: bast Date: Thu, 24 Jun 2021 07:46:14 -0700 Subject: Recreate nitro message length migration and name it --- .../apps/api/migrations/0070_auto_20210618_2010.py | 18 ------------------ .../migrations/0071_increase_message_content_4000.py | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 pydis_site/apps/api/migrations/0070_auto_20210618_2010.py create mode 100644 pydis_site/apps/api/migrations/0071_increase_message_content_4000.py (limited to 'pydis_site') diff --git a/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py b/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py deleted file mode 100644 index b0c79b32..00000000 --- a/pydis_site/apps/api/migrations/0070_auto_20210618_2010.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.14 on 2021-06-18 20:10 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('api', '0069_documentationlink_validators'), - ] - - operations = [ - migrations.AlterField( - model_name='deletedmessage', - name='content', - field=models.CharField(blank=True, help_text='The content of this message, taken from Discord.', max_length=4000), - ), - ] diff --git a/pydis_site/apps/api/migrations/0071_increase_message_content_4000.py b/pydis_site/apps/api/migrations/0071_increase_message_content_4000.py new file mode 100644 index 00000000..6ca5d21a --- /dev/null +++ b/pydis_site/apps/api/migrations/0071_increase_message_content_4000.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.14 on 2021-06-24 14:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0070_auto_20210618_2114'), + ] + + operations = [ + migrations.AlterField( + model_name='deletedmessage', + name='content', + field=models.CharField(blank=True, help_text='The content of this message, taken from Discord.', max_length=4000), + ), + ] -- cgit v1.2.3 From 25cc5fbd8821c0bc1344de1ef9e613efd9ef8989 Mon Sep 17 00:00:00 2001 From: lemonsaurus Date: Sun, 27 Jun 2021 12:52:15 +0200 Subject: Move existing code jam assets into a folder. --- pydis_site/static/images/events/cj8_asciimatics.png | Bin 26219 -> 0 bytes pydis_site/static/images/events/cj8_blessed.gif | Bin 41307 -> 0 bytes pydis_site/static/images/events/cj8_curses.png | Bin 6483 -> 0 bytes pydis_site/static/images/events/cj8_prompttoolkit.png | Bin 144850 -> 0 bytes pydis_site/static/images/events/cj8_rich.gif | Bin 906975 -> 0 bytes pydis_site/static/images/events/cj8_urwid.png | Bin 318 -> 0 bytes .../static/images/events/summer_code_jam_2021.png | Bin 738161 -> 0 bytes .../images/events/summer_code_jam_2021/banner.png | Bin 0 -> 738161 bytes .../events/summer_code_jam_2021/cj8_asciimatics.png | Bin 0 -> 26219 bytes .../images/events/summer_code_jam_2021/cj8_blessed.gif | Bin 0 -> 41307 bytes .../images/events/summer_code_jam_2021/cj8_curses.png | Bin 0 -> 6483 bytes .../events/summer_code_jam_2021/cj8_prompttoolkit.png | Bin 0 -> 144850 bytes .../images/events/summer_code_jam_2021/cj8_rich.gif | Bin 0 -> 906975 bytes .../images/events/summer_code_jam_2021/cj8_urwid.png | Bin 0 -> 318 bytes .../templates/events/pages/code-jams/8/frameworks.html | 12 ++++++------ pydis_site/templates/events/sidebar/code-jams/8.html | 2 +- .../events/sidebar/code-jams/upcoming-code-jam.html | 2 +- .../templates/events/sidebar/upcoming-event.html | 2 +- 18 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 pydis_site/static/images/events/cj8_asciimatics.png delete mode 100644 pydis_site/static/images/events/cj8_blessed.gif delete mode 100644 pydis_site/static/images/events/cj8_curses.png delete mode 100644 pydis_site/static/images/events/cj8_prompttoolkit.png delete mode 100644 pydis_site/static/images/events/cj8_rich.gif delete mode 100644 pydis_site/static/images/events/cj8_urwid.png delete mode 100644 pydis_site/static/images/events/summer_code_jam_2021.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/banner.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_asciimatics.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_blessed.gif create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_curses.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_prompttoolkit.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_rich.gif create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/cj8_urwid.png (limited to 'pydis_site') diff --git a/pydis_site/static/images/events/cj8_asciimatics.png b/pydis_site/static/images/events/cj8_asciimatics.png deleted file mode 100644 index ac52338e..00000000 Binary files a/pydis_site/static/images/events/cj8_asciimatics.png and /dev/null differ diff --git a/pydis_site/static/images/events/cj8_blessed.gif b/pydis_site/static/images/events/cj8_blessed.gif deleted file mode 100644 index 8bdbf5b1..00000000 Binary files a/pydis_site/static/images/events/cj8_blessed.gif and /dev/null differ diff --git a/pydis_site/static/images/events/cj8_curses.png b/pydis_site/static/images/events/cj8_curses.png deleted file mode 100644 index c1a177ff..00000000 Binary files a/pydis_site/static/images/events/cj8_curses.png and /dev/null differ diff --git a/pydis_site/static/images/events/cj8_prompttoolkit.png b/pydis_site/static/images/events/cj8_prompttoolkit.png deleted file mode 100644 index a359a7af..00000000 Binary files a/pydis_site/static/images/events/cj8_prompttoolkit.png and /dev/null differ diff --git a/pydis_site/static/images/events/cj8_rich.gif b/pydis_site/static/images/events/cj8_rich.gif deleted file mode 100644 index 3a0ffbf3..00000000 Binary files a/pydis_site/static/images/events/cj8_rich.gif and /dev/null differ diff --git a/pydis_site/static/images/events/cj8_urwid.png b/pydis_site/static/images/events/cj8_urwid.png deleted file mode 100644 index 98a264b7..00000000 Binary files a/pydis_site/static/images/events/cj8_urwid.png and /dev/null differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021.png b/pydis_site/static/images/events/summer_code_jam_2021.png deleted file mode 100644 index 778c7c90..00000000 Binary files a/pydis_site/static/images/events/summer_code_jam_2021.png and /dev/null differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/banner.png b/pydis_site/static/images/events/summer_code_jam_2021/banner.png new file mode 100644 index 00000000..778c7c90 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/banner.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_asciimatics.png b/pydis_site/static/images/events/summer_code_jam_2021/cj8_asciimatics.png new file mode 100644 index 00000000..ac52338e Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_asciimatics.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_blessed.gif b/pydis_site/static/images/events/summer_code_jam_2021/cj8_blessed.gif new file mode 100644 index 00000000..8bdbf5b1 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_blessed.gif differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_curses.png b/pydis_site/static/images/events/summer_code_jam_2021/cj8_curses.png new file mode 100644 index 00000000..c1a177ff Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_curses.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_prompttoolkit.png b/pydis_site/static/images/events/summer_code_jam_2021/cj8_prompttoolkit.png new file mode 100644 index 00000000..a359a7af Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_prompttoolkit.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_rich.gif b/pydis_site/static/images/events/summer_code_jam_2021/cj8_rich.gif new file mode 100644 index 00000000..3a0ffbf3 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_rich.gif differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/cj8_urwid.png b/pydis_site/static/images/events/summer_code_jam_2021/cj8_urwid.png new file mode 100644 index 00000000..98a264b7 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/cj8_urwid.png differ diff --git a/pydis_site/templates/events/pages/code-jams/8/frameworks.html b/pydis_site/templates/events/pages/code-jams/8/frameworks.html index 2ee6715a..532fb71f 100644 --- a/pydis_site/templates/events/pages/code-jams/8/frameworks.html +++ b/pydis_site/templates/events/pages/code-jams/8/frameworks.html @@ -27,7 +27,7 @@
    - urwid + urwid

    Curses

    @@ -48,7 +48,7 @@
    - curses + curses

    Blessed

    @@ -62,7 +62,7 @@
    - blessed + blessed

    Rich

    @@ -76,7 +76,7 @@
    - rich + rich

    Asciimatics

    @@ -89,7 +89,7 @@
    - asciimatics + asciimatics

    Python Prompt Toolkit

    @@ -102,7 +102,7 @@
    - python prompt toolkit + python prompt toolkit
    diff --git a/pydis_site/templates/events/sidebar/code-jams/8.html b/pydis_site/templates/events/sidebar/code-jams/8.html index c1afdf47..ff5131c2 100644 --- a/pydis_site/templates/events/sidebar/code-jams/8.html +++ b/pydis_site/templates/events/sidebar/code-jams/8.html @@ -7,7 +7,7 @@
    - Summer Code Jam 2021 + Summer Code Jam 2021 Digital Ocean diff --git a/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html b/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html index 10494ad8..19806b4e 100644 --- a/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html +++ b/pydis_site/templates/events/sidebar/code-jams/upcoming-code-jam.html @@ -3,6 +3,6 @@ diff --git a/pydis_site/templates/events/sidebar/upcoming-event.html b/pydis_site/templates/events/sidebar/upcoming-event.html index d8ea18e0..cfa4cf88 100644 --- a/pydis_site/templates/events/sidebar/upcoming-event.html +++ b/pydis_site/templates/events/sidebar/upcoming-event.html @@ -3,6 +3,6 @@
    - Summer Code Jam 2021 + Summer Code Jam 2021
    -- cgit v1.2.3 From 56094871d188fb0c26bd4d774600f136f46568ae Mon Sep 17 00:00:00 2001 From: lemonsaurus Date: Sun, 27 Jun 2021 12:52:39 +0200 Subject: Add some new Summer Code Jam banners. --- .../front_page_banners/currently_live.png | Bin 0 -> 253088 bytes .../front_page_banners/random_team.png | Bin 0 -> 273798 bytes .../front_page_banners/sign_up_now.png | Bin 0 -> 209657 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png create mode 100644 pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png (limited to 'pydis_site') diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png new file mode 100644 index 00000000..c678c977 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png new file mode 100644 index 00000000..4f0999f5 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png new file mode 100644 index 00000000..98035441 Binary files /dev/null and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png differ -- cgit v1.2.3 From 8ad3f9c099a59978c9b05612b6666d372dc6b324 Mon Sep 17 00:00:00 2001 From: lemonsaurus Date: Sun, 27 Jun 2021 12:52:55 +0200 Subject: Put Summer Code Jam '21 banner on the front page. --- pydis_site/templates/home/index.html | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html index 08f98607..3d173d6d 100644 --- a/pydis_site/templates/home/index.html +++ b/pydis_site/templates/home/index.html @@ -11,15 +11,7 @@
    -
    -

    100K Member Milestone!

    -
    -
    - Thanks to all our members for helping us create this friendly and helpful community! -

    - As a nice treat, we've created a Timeline page for people - to discover the events that made our community what it is today. Be sure to check it out! -
    + Summer Code Jam 2021
    @@ -29,7 +21,7 @@
    {# Embedded Welcome video #} -
    +
    + + {# Code Jam banner #} +
    + Summer Code Jam 2021 +
    -- cgit v1.2.3 From eda0a551949beeda44a698ad22aac25f70198c9f Mon Sep 17 00:00:00 2001 From: lemonsaurus Date: Sun, 27 Jun 2021 15:24:55 +0200 Subject: Update banners to have vertically centered text. --- .../front_page_banners/currently_live.png | Bin 253088 -> 253545 bytes .../front_page_banners/random_team.png | Bin 273798 -> 273735 bytes .../front_page_banners/sign_up_now.png | Bin 209657 -> 209749 bytes 3 files changed, 0 insertions(+), 0 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png index c678c977..939aca2a 100644 Binary files a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/currently_live.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png index 4f0999f5..ea48ef4b 100644 Binary files a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/random_team.png differ diff --git a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png index 98035441..7258b1b9 100644 Binary files a/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png and b/pydis_site/static/images/events/summer_code_jam_2021/front_page_banners/sign_up_now.png differ -- cgit v1.2.3 From 70154a63c9a1fbac46bc2e16110217f9c295ae05 Mon Sep 17 00:00:00 2001 From: lemonsaurus Date: Sun, 27 Jun 2021 15:25:04 +0200 Subject: Hyperlink code jam banner to code jam page. --- pydis_site/templates/home/index.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pydis_site') diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html index 3d173d6d..2efa5b49 100644 --- a/pydis_site/templates/home/index.html +++ b/pydis_site/templates/home/index.html @@ -11,7 +11,9 @@
    - Summer Code Jam 2021 + + Summer Code Jam 2021 +
    @@ -45,7 +47,9 @@ {# Code Jam banner #}
    - Summer Code Jam 2021 + + Summer Code Jam 2021 +
    -- cgit v1.2.3