-
-
Notifications
You must be signed in to change notification settings - Fork 199
Sync OWASP Awards data and integrate with user profiles #2024
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
trucodd
wants to merge
12
commits into
OWASP:main
Choose a base branch
from
trucodd:feature/owasp-awards-profilesync
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 all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9517ffd
Sync OWASP Awards data and integrate with user profiles
trucodd d6a12a1
Add Award import
trucodd c8f22eb
Add Django migrations for Award andbadge models
trucodd 9a15aa5
Refactor: Remove badge-related code implement awards syncing
trucodd 9cab822
clean up Award implementation and fix migration conflicts
trucodd 89edc96
remove indexes from Award model meta class and update migration
trucodd b3e323d
Rename winner_image to winner_image_url and fix
trucodd 45524b2
Added is_reviewed field to Award model and update admin and badge logic
trucodd 14df37d
Implement Award model with bulk operations
trucodd 644c5e7
fix Award model name field to be unique
trucodd 94ed30c
Waspy Award Winner badge integration
trucodd 84f3b1f
implement OWASP awards system improvements
trucodd 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,15 @@ | ||
"""Admin configuration for the Badge model in the OWASP app.""" | ||
"""Badge admin configuration.""" | ||
|
||
from django.contrib import admin | ||
|
||
from apps.nest.models.badge import Badge | ||
|
||
|
||
@admin.register(Badge) | ||
class BadgeAdmin(admin.ModelAdmin): | ||
"""Admin for Badge model.""" | ||
|
||
fieldsets = ( | ||
( | ||
"Basic Information", | ||
{ | ||
"fields": ( | ||
"name", | ||
"description", | ||
"weight", | ||
) | ||
}, | ||
), | ||
("Display Settings", {"fields": ("css_class",)}), | ||
( | ||
"Timestamps", | ||
{ | ||
"fields": ( | ||
"nest_created_at", | ||
"nest_updated_at", | ||
) | ||
}, | ||
), | ||
) | ||
list_display = ( | ||
"name", | ||
"description", | ||
"weight", | ||
"css_class", | ||
"nest_created_at", | ||
"nest_updated_at", | ||
) | ||
list_display = ("name", "description", "weight", "css_class") | ||
list_filter = ("weight",) | ||
ordering = ( | ||
"weight", | ||
"name", | ||
) | ||
readonly_fields = ( | ||
"nest_created_at", | ||
"nest_updated_at", | ||
) | ||
search_fields = ( | ||
"css_class", | ||
"description", | ||
"name", | ||
) | ||
|
||
|
||
admin.site.register(Badge, BadgeAdmin) | ||
search_fields = ("name", "description") | ||
ordering = ("weight", "name") |
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,81 @@ | ||
"""Award admin configuration.""" | ||
|
||
from django.contrib import admin | ||
|
||
from apps.owasp.models.award import Award | ||
|
||
|
||
@admin.register(Award) | ||
class AwardAdmin(admin.ModelAdmin): | ||
"""Admin for Award model.""" | ||
|
||
list_display = ( | ||
"name", | ||
"category", | ||
"year", | ||
"winner_name", | ||
"user", | ||
"is_reviewed", | ||
"nest_created_at", | ||
"nest_updated_at", | ||
) | ||
list_display_links = ("name", "winner_name") | ||
list_per_page = 50 | ||
list_filter = ( | ||
"category", | ||
"year", | ||
"is_reviewed", | ||
) | ||
search_fields = ( | ||
"name", | ||
"winner_name", | ||
"description", | ||
"winner_info", | ||
"user__login", | ||
) | ||
ordering = ("-year", "category", "name") | ||
|
||
autocomplete_fields = ("user",) | ||
actions = ("mark_reviewed", "mark_not_reviewed") | ||
list_select_related = ("user",) | ||
|
||
fieldsets = ( | ||
( | ||
"Basic Information", | ||
{"fields": ("name", "category", "year", "description")}, | ||
), | ||
( | ||
"Winner Information", | ||
{ | ||
"fields": ( | ||
"winner_name", | ||
"winner_info", | ||
"winner_image_url", | ||
"user", | ||
"is_reviewed", | ||
), | ||
"classes": ("collapse",), | ||
}, | ||
), | ||
( | ||
"Timestamps", | ||
{ | ||
"fields": ("nest_created_at", "nest_updated_at"), | ||
"classes": ("collapse",), | ||
}, | ||
), | ||
) | ||
|
||
readonly_fields = ("nest_created_at", "nest_updated_at") | ||
|
||
@admin.action(description="Mark selected awards as reviewed") | ||
def mark_reviewed(self, request, queryset): | ||
"""Mark selected awards as reviewed.""" | ||
updated = queryset.update(is_reviewed=True) | ||
self.message_user(request, f"Marked {updated} award(s) as reviewed.") | ||
|
||
@admin.action(description="Mark selected awards as not reviewed") | ||
def mark_not_reviewed(self, request, queryset): | ||
"""Mark selected awards as not reviewed.""" | ||
updated = queryset.update(is_reviewed=False) | ||
self.message_user(request, f"Marked {updated} award(s) as not reviewed.") |
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.