-
-
Notifications
You must be signed in to change notification settings - Fork 629
feat: add sponsors program support #4342
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
Utkarsh-0304
wants to merge
11
commits into
OWASP:main
Choose a base branch
from
Utkarsh-0304:feat/sponsors
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.
Open
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7e03fa5
feat: add sponsors program support
Utkarsh-0304 1cc02f0
fix: coderabbit_and_cubic_dev_ai
Utkarsh-0304 6d9e84c
Merge branch 'main' of https://github.com/OWASP/Nest into feat/sponsors
Utkarsh-0304 5f434b7
fix: minor
Utkarsh-0304 164f3ee
feat: display description inside sponsor card
Utkarsh-0304 ce71791
Merge branch 'main' of https://github.com/OWASP/Nest into feat/sponsors
Utkarsh-0304 2365f35
fix:sonarqube_security_hotspot
Utkarsh-0304 18cc1c2
Merge branch 'main' of https://github.com/OWASP/Nest into feat/sponsors
Utkarsh-0304 2266aa8
fix: validateWebsite function
Utkarsh-0304 f8d25cc
fix: case-sensitive URLs
Utkarsh-0304 b3c22a2
Merge branch 'main' of https://github.com/OWASP/Nest into feat/sponsors
Utkarsh-0304 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
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,3 @@ | ||
| """Sponsor Mutations.""" | ||
|
|
||
| from .sponsor import SponsorMutation |
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,40 @@ | ||
| """OWASP sponsors GraphQL mutations.""" | ||
|
|
||
| import logging | ||
|
|
||
| import strawberry | ||
| from django.db import IntegrityError | ||
| from django.utils import timezone | ||
|
|
||
| from apps.common.utils import slugify | ||
| from apps.owasp.api.internal.nodes.sponsor import CreateSponsorInput, SponsorNode | ||
| from apps.owasp.models import Sponsor | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| SPONSOR_EXISTS_ERROR = "A sponsor with this name already exists." | ||
|
|
||
|
|
||
| @strawberry.type | ||
| class SponsorMutation: | ||
| """GraphQL mutations related to sponsor.""" | ||
|
|
||
| @strawberry.mutation | ||
| def create_sponsor(self, input_data: CreateSponsorInput) -> SponsorNode: | ||
| """Create a new sponsor.""" | ||
| try: | ||
| sponsor = Sponsor.objects.create( | ||
| key=slugify(input_data.name), | ||
| sort_name=input_data.name, | ||
| name=input_data.name, | ||
| contact_email=input_data.contact_email, | ||
| message=input_data.message, | ||
| url=input_data.url, | ||
| created_at=timezone.now(), | ||
| ) | ||
| except IntegrityError as err: | ||
| raise ValueError(SPONSOR_EXISTS_ERROR) from err | ||
|
|
||
| logger.info("Sponsor created successfully") | ||
|
|
||
| return sponsor |
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
22 changes: 22 additions & 0 deletions
22
backend/apps/owasp/migrations/0073_sponsor_contact_email_sponsor_created_at.py
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,22 @@ | ||
| # Generated by Django 6.0.3 on 2026-03-13 11:38 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("owasp", "0072_project_project_name_gin_idx_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="sponsor", | ||
| name="contact_email", | ||
| field=models.EmailField(blank=True, max_length=254), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="sponsor", | ||
| name="created_at", | ||
| field=models.DateTimeField(blank=True, null=True, verbose_name="Created At"), | ||
| ), | ||
| ] |
36 changes: 36 additions & 0 deletions
36
backend/apps/owasp/migrations/0074_sponsor_chapter_sponsor_project_sponsor_status.py
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,36 @@ | ||
| # Generated by Django 6.0.3 on 2026-03-13 11:58 | ||
|
|
||
| import django.db.models.deletion | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("owasp", "0073_sponsor_contact_email_sponsor_created_at"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="sponsor", | ||
| name="chapter", | ||
| field=models.ForeignKey( | ||
| null=True, on_delete=django.db.models.deletion.SET_NULL, to="owasp.chapter" | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="sponsor", | ||
| name="project", | ||
| field=models.ForeignKey( | ||
| null=True, on_delete=django.db.models.deletion.SET_NULL, to="owasp.project" | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="sponsor", | ||
| name="status", | ||
| field=models.CharField( | ||
| choices=[("Draft", "Draft"), ("Active", "Active"), ("Archived", "Archived")], | ||
| default="Draft", | ||
| max_length=20, | ||
| ), | ||
| ), | ||
| ] |
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,17 @@ | ||
| # Generated by Django 6.0.3 on 2026-03-21 14:43 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("owasp", "0074_sponsor_chapter_sponsor_project_sponsor_status"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="sponsor", | ||
| name="message", | ||
| field=models.TextField(blank=True, verbose_name="Message"), | ||
| ), | ||
| ] |
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
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.