-
-
Notifications
You must be signed in to change notification settings - Fork 1k
funding.json (see https://floss.fund) #1753
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
Open
jacobian
wants to merge
5
commits into
django:main
Choose a base branch
from
jacobian:funding-json
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+130
−1
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
https://djangoproject.com/funding.json | ||
jacobian marked this conversation as resolved.
Show resolved
Hide resolved
|
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 |
---|---|---|
|
@@ -16,8 +16,10 @@ | |
from django.views.decorators.csrf import csrf_exempt | ||
from django.views.decorators.http import require_POST | ||
|
||
from members.models import CORPORATE_MEMBERSHIP_AMOUNTS | ||
|
||
from .forms import DjangoHeroForm, DonationForm, PaymentForm | ||
from .models import DjangoHero, Donation, Payment, Testimonial | ||
from .models import INTERVAL_CHOICES, DjangoHero, Donation, Payment, Testimonial | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
@@ -338,3 +340,114 @@ def checkout_session_completed(self): | |
) | ||
|
||
return HttpResponse(status=204) | ||
|
||
|
||
def funding_json(request): | ||
""" | ||
Generate a funding.json -- see https://floss.fund/funding-manifest/ | ||
""" | ||
funding = { | ||
"version": "v1.0.0", | ||
"entity": { | ||
"type": "organisation", | ||
"role": "owner", | ||
"name": "Django Software Foundation", | ||
"email": "[email protected]", | ||
"description": "Development of Django is supported by the Django Software Foundation, a 501(c)(3) non-profit.", | ||
"webpageUrl": { | ||
"url": "http://djangoproject.com/foundation", | ||
jacobian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
}, | ||
"projects": [ | ||
{ | ||
"guid": "django", | ||
"name": "Django", | ||
"description": "Django is a Python web framework that makes it possible to build better web apps quickly and with less code", | ||
"webpageUrl": { | ||
"url": "http://djangoproject.com/", | ||
jacobian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
"repositoryUrl": { | ||
"url": "http://github.com/django/django", | ||
jacobian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"wellKnown": "http://github.com/django/django/blob/main/static/.well-known/funding-manifest-urls", | ||
}, | ||
"licenses": ["spdx:BSD-3-Clause"], | ||
"tags": ["python", "web", "django"], | ||
} | ||
], | ||
"funding": { | ||
"channels": [ | ||
{ | ||
"guid": "stripe", | ||
"type": "payment-provider", | ||
"address": "https://www.djangoproject.com/fundraising/", | ||
"description": "Pay with your debit/credit card, and set up recurring support.", | ||
}, | ||
{ | ||
"guid": "github-sponsors", | ||
"type": "payment-provider", | ||
"address": "https://github.com/sponsors/django", | ||
"description": "Donate via GitHub sponsors", | ||
}, | ||
{ | ||
"guid": "bank", | ||
"type": "bank", | ||
"description": "Pay via bank transfer or check - contact [email protected] for details.", | ||
}, | ||
], | ||
"plans": [], | ||
}, | ||
} | ||
|
||
# translate our keys for frequency into the ones understood by funding.json | ||
frequency_translation = { | ||
"onetime": "one-time", | ||
"quarterly": "other", | ||
} | ||
|
||
# Pay-what-you-want individual funding levels | ||
for frequency, title in INTERVAL_CHOICES: | ||
funding["funding"]["plans"].append( | ||
{ | ||
"guid": f"individual-{frequency}", | ||
"status": "active", | ||
"name": f"Django Hero - {title}", | ||
"description": f"Support Django as an individual, - {title.lower()}", | ||
"amount": 0, | ||
"currency": "USD", | ||
"frequency": frequency_translation.get(frequency, frequency), | ||
"channels": [c["guid"] for c in funding["funding"]["channels"]], | ||
} | ||
) | ||
|
||
# "leadership level" donation | ||
funding["funding"]["plans"].append( | ||
{ | ||
"guid": "individual-leadership", | ||
"status": "active", | ||
"name": "Django Hero - Leadership Level", | ||
"description": "Django Hero - Leadership Level - Donate $1,000/yr or more", | ||
"amount": 1000, | ||
"currency": "USD", | ||
"frequency": "yearly", | ||
"channels": [c["guid"] for c in funding["funding"]["channels"]], | ||
} | ||
) | ||
|
||
# corporate sponsorships | ||
for level, amount in CORPORATE_MEMBERSHIP_AMOUNTS.items(): | ||
funding["funding"]["plans"].append( | ||
{ | ||
"guid": f"corporate-{level}", | ||
"status": "active", | ||
"name": f"Corporate Sponsorship - {level.title()}", | ||
"description": f"Corporate Sponsoreship - {level.title()}", | ||
"amount": amount, | ||
"currency": "USD", | ||
"frequency": "yearly", | ||
"channels": [c["guid"] for c in funding["funding"]["channels"]], | ||
} | ||
) | ||
|
||
# TODO: it'd be nice to do history. We do have the data, but not in the dp.com app. | ||
jacobian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return JsonResponse(funding) |
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.
Uh oh!
There was an error while loading. Please reload this page.