-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch SET_NULL back to DO_NOTHING We want to keep the repo_id value as-is, even if the associated repo has disappeared, so as to keep related object grouped together, and to prevent uniqueness constraint violations.
- Loading branch information
Showing
9 changed files
with
105 additions
and
89 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
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
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
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,66 @@ | ||
from django.contrib import admin | ||
|
||
from lando.pushlog.models import ( | ||
Commit, | ||
File, | ||
Push, | ||
Tag, | ||
) | ||
|
||
|
||
class PushLogAdmin(admin.ModelAdmin): | ||
"""A base ModelAdmin class for PushLog-related admin parameters.""" | ||
|
||
def has_add_permission(self, request, obj=None): | ||
"""Fordib addition of any pushlog object from the admin interface.""" | ||
return False | ||
|
||
def has_delete_permission(self, request, obj=None): | ||
"""Fordib deletion of any pushlog object from the admin interface.""" | ||
return False | ||
|
||
|
||
class PushAdmin(PushLogAdmin): | ||
readonly_fields = ( | ||
"push_id", | ||
"repo", | ||
"repo_url", | ||
"branch", | ||
"datetime", | ||
"user", | ||
"commits", | ||
) | ||
|
||
|
||
class CommitAdmin(PushLogAdmin): | ||
readonly_fields = ( | ||
"repo", | ||
"hash", | ||
"parents", | ||
"author", | ||
"datetime", | ||
"desc", | ||
"_files", | ||
"_parents", | ||
) | ||
|
||
|
||
class FileAdmin(PushLogAdmin): | ||
readonly_fields = ( | ||
"repo", | ||
"name", | ||
) | ||
|
||
|
||
class TagAdmin(PushLogAdmin): | ||
readonly_fields = ( | ||
"repo", | ||
"name", | ||
"commit", | ||
) | ||
|
||
|
||
admin.site.register(Push, PushAdmin) | ||
admin.site.register(Commit, CommitAdmin) | ||
admin.site.register(File, FileAdmin) | ||
admin.site.register(Tag, TagAdmin) |
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
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
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
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
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