-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Move sponsors to DB #9512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Move sponsors to DB #9512
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
9e2a8aa
Create Sponsor model
berinhard 8e6fab6
Service column can be empty
berinhard 3b49e92
Command to load sponsors to database
berinhard e2d039c
initdb should load sponsors
berinhard 02d450a
Add sqlalchemy-utils as a dependency
berinhard 5b5f150
Use URL type as fields and refactor to have a single migration
berinhard 36ffefd
Populate images URL using current pypi static as the URL prefix
berinhard b6bf1de
Fix code lint warnings
berinhard 918203a
Add direnv's .envrc to gitignore
berinhard c5f0d7a
Change sponsors page to read data from db instead of HTML include
berinhard 582581f
Fix routes test
berinhard 8d5b1cc
Unit test sponsors page
berinhard 5f838e4
Better name for url field
berinhard 023472f
Replace pickle by pg's array type
berinhard f8247e8
Update migration file
berinhard 6d351c3
Revert "Unit test sponsors page"
berinhard c761787
Revert "Fix routes test"
berinhard 4b92c8f
Revert "Change sponsors page to read data from db instead of HTML inc…
berinhard 77b8d47
Test utils for sponsors app
berinhard 9f9aec0
Add sponsors list to all requests (except for static files)
berinhard a70dc28
Update templates to read sponsors from request variable
berinhard 0581a0f
Reformat
berinhard 28dee11
Camoify logos
berinhard f9236e8
Merge branch 'main' into feature/sponsors-db
berinhard 7c5021d
Add minimal sponsor list to admin
berinhard 1707067
Add link to sponsors list
berinhard 6983c69
Add minimal edit page
berinhard a69bf77
Merge branch 'main' into feature/sponsors-db
berinhard a0a88f1
Reformat
berinhard 741e90a
Simple admin view to create sponsors
berinhard f370a72
Unit test sponsors admin
berinhard e21fb9b
Update migration to define activity as a markdown field
berinhard a634e27
Update code do handle activity as markdown
berinhard b8d8740
Add missing pretend calls to admin routes test
berinhard a3eb825
Fix flake8 lint warnings
berinhard 1861123
Add new is_active flag to control sponsors display
berinhard 2d51b26
Only display active sponsors
berinhard e5e5b82
Add is_active boolean to sponsors admin
berinhard a4a256d
Add feedback message after sponsor update
berinhard cea2bf1
Color logo is required by the admin
berinhard 0f34b61
Do not validate footer sponsor without white logo
berinhard 6b78742
Implement new view to delete a sponsor
berinhard fe4b489
Add modal to confirm sponsor before deletion
berinhard ed70823
Run make translations to fix CI
berinhard 41e6ecb
Footer sponsors can be only infra sponsors as well
berinhard c75f3c1
Increase test coverage for sponsors/models.py
berinhard 97b7727
100% test coverage at cli/sponsors.py
berinhard ed003db
Add simple unit test to make explicit validation done by readme lib
berinhard 96d9d4f
Merge branch 'main' into feature/sponsors-db
ewdurbin 69f929c
Add sponsors app to the docs
berinhard dd25985
Add new boolean flag is_psf_staff to user model
berinhard e1d9e20
Introduce PSF Staff group and permission
berinhard 3c13356
Configure permissions considering PSF staff members
berinhard 36d957a
Use SQL false function instead
berinhard 6bae6c3
Refactor permissions introducing a base one to guarantee admin access
berinhard 384278a
Rename admin dashboard access permission
berinhard 529f0f1
Merge branch 'main' into feature/sponsors-db
ewdurbin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
.coverage | ||
.state | ||
.idea | ||
.envrc | ||
|
||
docs/_build/ | ||
build/ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from factory import fuzzy | ||
|
||
from warehouse.sponsors.models import Sponsor | ||
|
||
from .base import FuzzyUrl, WarehouseFactory | ||
|
||
|
||
class SponsorFactory(WarehouseFactory): | ||
class Meta: | ||
model = Sponsor | ||
|
||
name = fuzzy.FuzzyText(length=12) | ||
service = fuzzy.FuzzyText(length=12) | ||
activity_markdown = fuzzy.FuzzyText(length=12) | ||
|
||
link_url = FuzzyUrl() | ||
color_logo_url = FuzzyUrl() | ||
white_logo_url = FuzzyUrl() | ||
|
||
is_active = True | ||
footer = True | ||
psf_sponsor = True | ||
infra_sponsor = False | ||
one_time = False | ||
sidebar = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a plan to run this in production?
As an aside, this is a lot of work for something we only need once. Wow!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this will be run then axed.