forked from OWASP-BLT/BLT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4af40e
commit 6364c3a
Showing
3 changed files
with
91 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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,18 @@ | ||
# Generated by Django 5.1.3 on 2024-11-30 14:15 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("website", "0160_merge_20241129_0712"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="badge", | ||
name="icon", | ||
field=models.ImageField(blank=True, null=True, upload_to="badges/"), | ||
), | ||
] |
This file contains 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 @@ | ||
# Generated by Django 5.1.3 on 2024-11-30 14:15 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def add_new_badges(apps, schema_editor): | ||
# Get the Badge model | ||
Badge = apps.get_model("website", "Badge") | ||
|
||
# Define the new badges to add | ||
new_badges = [ | ||
{"title": "First IP Reported", "description": "Awarded for reporting the first intellectual property.", "type": "automatic"}, | ||
{"title": "First Bid Placed", "description": "Awarded for placing the first bid.", "type": "manual"}, | ||
{"title": "First Bug Bounty", "description": "Awarded for earning the first bug bounty.", "type": "manual"}, | ||
{"title": "First Suggestion", "description": "Awarded for making the first suggestion.", "type": "manual"}, | ||
] | ||
|
||
# Loop through the new badges and create them if they don't already exist | ||
for badge in new_badges: | ||
Badge.objects.get_or_create( | ||
title=badge["title"], | ||
defaults={ | ||
"description": badge["description"], | ||
"type": badge["type"], | ||
}, | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("website", "0161_alter_badge_icon"), # Adjust based on your actual previous migration | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(add_new_badges), | ||
] |
This file contains 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