aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/home/views/home.py (follow)
Commit message (Collapse)AuthorAgeLines
* Add a readme for the home appGravatar Johannes Christ2023-03-29-163/+0
| | | | | | | | This commit also moves the nested structures for models and views in the home app into a single module, as they were not split up as part of the subpackage, with the goal of making this a bit more overseeable. Part of #674.
* Add Setting For Static BuildsGravatar Hassan Abouelela2022-08-13-5/+3
| | | | | | | Adds an explicit setting for static builds instead of relying on the environment variable. Signed-off-by: Hassan Abouelela <[email protected]>
* Switch Out requests For httpxGravatar Hassan Abouelela2022-07-11-3/+3
| | | | | | | | The requests library has been replaced by httpx. It's a drop-in replacement, but provides a better interface for certain things, such as client sessions, and sync/async support. Signed-off-by: Hassan Abouelela <[email protected]>
* Add a readme to the Django project directoryGravatar Johannes Christ2022-02-26-1/+0
|
* Remove and merge superfluous modulesGravatar Johannes Christ2022-02-26-4/+4
| | | | The constants module more or less did what belongs to the settings.
* Adds Static Route ConfigurationsGravatar Hassan Abouelela2021-10-10-7/+19
| | | | | Adds configuration which specifies how routes should be handled when building a static preview.
* Update repository selection on home pageGravatar Joe Banks2021-09-10-1/+1
| | | In accordance with a poll in #dev-contrib, King Arthur becomes the 6th repository featured on the Python Discord homepage.
* Timeout when fetching GitHub repository metadataGravatar Chris Lovering2021-09-03-4/+11
| | | | Not having this timeout could cause a worker to hang indefinitely
* Address review comment.Gravatar Johannes Christ2021-07-15-3/+6
|
* Improvements & fixes to homepage repository display.Gravatar Johannes Christ2021-07-11-31/+31
| | | | | | | | | | | | | | | | | | | | | These changes mainly aim to prevent multiple concurrent requests from deadlocking the table due to the lazy evaluation imposed by `objects.all()`, and introduce some quality of life changes whilst doing so. To prevent unwanted locks, the following is done: - Instead of evaluating the first item of `objects.all()` only in order to determine when the table was most recently updated, we query for the least recent updated entry and use that instead. As we use `.first()`, the model instance is loaded directly. The following quality of life changes are introduced: - Instead of manual "update or create" logic for repositories retrieved from the API, use Django's `update_or_create` instead. - Instead of manual bulk creation of entries on initial data retrieve, Django's `bulk_create` method is used instead. - To allow for local testing of this endpoint without having to manually set up GitHub REST authorization, anonymous GitHub access is used when no `GITHUB_TOKEN` is configured.
* Authenticate with the github api to avoid rate limitsGravatar Chris2021-05-23-1/+3
|
* Merge branch 'master' into hotfix/lemon/front-page-project-sanityGravatar Dennis Pham2020-12-26-1/+1
|\
| * Increase per_page to 100 for GitHub API call.Gravatar Leon Sandøy2020-12-13-1/+1
| | | | | | | | | | | | | | Snekbox was being banished to page 2 and we were not iterating pages, so it was not appearing in the data we got from our call to /repos. This commit changes the request to use `per_page=100`, which will work at least until we have >100 repos in our organisation.
* | Improve the RepositoryMetadata cleanup code.Gravatar Leon Sandøy2020-12-26-3/+1
| | | | | | Co-authored-by: Dennis Pham <[email protected]>
* | Clean up stale metadata when HomeView starts.Gravatar Leon Sandøy2020-12-13-0/+6
|/ | | | | | | We don't want to keep lots of old metadata for repos we no longer need to track on the frontpage. Previously, whenever we changed the frontpage line-up, we'd be left with useless, stale data in the database. This fixes that, and adds tests.
* Remove pointless try/except.Gravatar Leon Sandøy2020-12-13-17/+7
| | | | | I don't think we need to check for TypeError here, so that saves us the trouble of testing these lines to appease coverage.
* Add a test repo with bad types.Gravatar Leon Sandøy2020-12-13-1/+1
| | | | This should restore 100% coverage.
* Add even more sanity for the HomeView.Gravatar Leon Sandøy2020-12-13-72/+81
| | | | | | | This rewrite will ensure we always return whichever repositories we're able to resolve, and none of the others. It also shortens the code, shrinks all the try/excepts, and generally makes things a little more readable.
* Add some sanity to frontpage projects.Gravatar Leon Sandøy2020-12-13-16/+22
| | | | | | If no API data is available, the front page shouldn't crash and burn. This commit will ensure the front page will just render without the projects it can't get API data for instead of crashing the whole thing.
* Change seasonalbot to sir-lancebotGravatar Sebastiaan Zeeff2020-11-21-1/+1
|
* Merge branch 'master' into feat/timelineGravatar Joe Banks2020-10-10-1/+1
|\
| * Update landing page.Gravatar Leon Sandøy2020-09-03-1/+1
| | | | | | | | Replace flake8-annotations with metricity.
* | add timeline viewGravatar Derek2020-09-02-0/+5
|/ | | | add timeline route
* Catch ConnectionError when trying to get updated repository dataGravatar Dennis Pham2020-06-22-1/+1
| | | This will prevent a 500 server error on our homepage when GitHub's API is down, allowing us to use the cached data we have instead.
* Replace django-crispy-bulma -> flake8-annotationsGravatar Leon Sandøy2020-06-07-1/+1
|
* Fix a bug where GitHub API rate limit could crash Home.Gravatar Leon Sandøy2019-09-15-17/+34
| | | | | | | | | | | The bug was caused by a naive approach to caching and retrieving the data. This commit rectifies this by making the following changes: - We will now cache for 1 hour instead of 10 minutes - If the data is stale but API is rate limited, return cache, not crash. - If the cache doesn't exist and API is rate limited, return dummy data, and try again in 10 minutes. This will prevent all crashes, and should still have more or less the same user experience.
* Fix misconfigured flake8 so docstrings are properly lintedGravatar S. Co12019-09-05-1/+1
| | | Relint
* Give a code a lintGravatar Jeremiah Boby2019-07-10-3/+2
|
* Teach new lint rules to old codeGravatar Jeremiah Boby2019-07-10-3/+0
|
* Make the flakes happy.Gravatar Johannes Christ2019-04-20-2/+1
|
* Add type hinting.Gravatar Leon Sandøy2019-04-20-3/+8
|
* Addressing volcyys third review.Gravatar Leon Sandøy2019-04-20-3/+4
|
* Addressing all comments in volcyy's second review. The tests now mock the ↵Gravatar Leon Sandøy2019-04-19-0/+110
API calls so we don't have to actually call the API every time we run tests.