-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into wine-b-gone
- Loading branch information
Showing
97 changed files
with
4,517 additions
and
5,843 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
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 |
---|---|---|
@@ -1,47 +1,21 @@ | ||
import shutil | ||
|
||
from django.contrib import admin | ||
|
||
from django.db.models.query import QuerySet | ||
|
||
from coreapp.middleware import Request | ||
|
||
from .models.github import GitHubRepo, GitHubRepoBusyException, GitHubUser | ||
|
||
from .models.course import Course, CourseChapter, CourseScenario | ||
from .models.github import GitHubUser | ||
from .models.preset import Preset | ||
from .models.profile import Profile | ||
from .models.project import Project, ProjectFunction, ProjectImportConfig, ProjectMember | ||
from .models.project import Project, ProjectMember | ||
from .models.scratch import Asm, Assembly, CompilerConfig, Scratch | ||
from .models.course import Course, CourseChapter, CourseScenario | ||
|
||
|
||
class GitHubRepoAdmin(admin.ModelAdmin[GitHubRepo]): | ||
actions = ["pull", "reclone"] | ||
|
||
def pull(self, request: Request, queryset: QuerySet[GitHubRepo]) -> None: | ||
for repo in queryset.all(): | ||
repo.pull() | ||
|
||
def reclone(self, request: Request, queryset: QuerySet[GitHubRepo]) -> None: | ||
for repo in queryset.all(): | ||
if repo.is_pulling: | ||
raise GitHubRepoBusyException() | ||
|
||
repo.last_pulled = None | ||
shutil.rmtree(repo.get_dir()) | ||
repo.pull() | ||
|
||
|
||
admin.site.register(Profile) | ||
admin.site.register(GitHubUser) | ||
admin.site.register(Asm) | ||
admin.site.register(Assembly) | ||
admin.site.register(Scratch) | ||
admin.site.register(CompilerConfig) | ||
admin.site.register(Preset) | ||
admin.site.register(Project) | ||
admin.site.register(ProjectFunction) | ||
admin.site.register(ProjectMember) | ||
admin.site.register(ProjectImportConfig) | ||
admin.site.register(GitHubRepo, GitHubRepoAdmin) | ||
admin.site.register(Course) | ||
admin.site.register(CourseChapter) | ||
admin.site.register(CourseScenario) |
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
Oops, something went wrong.