Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 0 additions & 275 deletions backend/apps/owasp/admin.py

This file was deleted.

19 changes: 19 additions & 0 deletions backend/apps/owasp/admin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""OWASP admin module initialization."""

from django.contrib import admin

from apps.owasp.models.project_health_requirements import ProjectHealthRequirements

from .chapter import ChapterAdmin
from .committee import CommitteeAdmin
from .event import EventAdmin
from .post import PostAdmin
from .project import ProjectAdmin
from .project_health_metrics import ProjectHealthMetricsAdmin
from .snapshot import SnapshotAdmin
from .sponsor import SponsorAdmin

# Register models that don't have custom admin classes
admin.site.register(ProjectHealthRequirements)

# All other models are registered in their respective admin files
25 changes: 25 additions & 0 deletions backend/apps/owasp/admin/chapter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from django.contrib import admin

from apps.owasp.models.chapter import Chapter

from .mixins import GenericEntityAdminMixin, LeaderAdminMixin


class ChapterAdmin(admin.ModelAdmin, GenericEntityAdminMixin, LeaderAdminMixin):
"""Admin for Chapter model."""

autocomplete_fields = ("owasp_repository",)
filter_horizontal = LeaderAdminMixin.filter_horizontal
list_display = (
"name",
"created_at",
"updated_at",
"region",
"custom_field_owasp_url",
"custom_field_github_urls",
)
list_filter = ("is_active", "is_leaders_policy_compliant", "country", "region")
search_fields = ("name", "key")


admin.site.register(Chapter, ChapterAdmin)
16 changes: 16 additions & 0 deletions backend/apps/owasp/admin/committee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.contrib import admin

from apps.owasp.models.committee import Committee

from .mixins import GenericEntityAdminMixin, LeaderAdminMixin


class CommitteeAdmin(admin.ModelAdmin, GenericEntityAdminMixin, LeaderAdminMixin):
"""Admin for Committee model."""

autocomplete_fields = ("leaders", "owasp_repository")
filter_horizontal = LeaderAdminMixin.filter_horizontal
search_fields = ("name",)


admin.site.register(Committee, CommitteeAdmin)
15 changes: 15 additions & 0 deletions backend/apps/owasp/admin/event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.contrib import admin

from apps.owasp.models.event import Event

from .mixins import StandardOWASPAdminMixin


class EventAdmin(admin.ModelAdmin, StandardOWASPAdminMixin):
"""Admin for Event model."""

list_display = ("name", "suggested_location")
search_fields = ("name",)


admin.site.register(Event, EventAdmin)
Loading