优化列表分页和分支记录,确保更好的数据管理。优秀!

This commit is contained in:
张建平 2025-02-26 17:28:55 +08:00
parent c42a262f41
commit 5802b36f46
2 changed files with 11 additions and 9 deletions

View File

@ -49,6 +49,7 @@ class ProjectHistoryAdmin(admin.ModelAdmin):
list_display = ["project", "mr_url", "source_branch", "target_branch", "mr_title"]
list_filter = ["project"]
list_per_page = 10
def save_model(self, request, obj, form, change):
obj.create_by = request.user.username

View File

@ -134,6 +134,7 @@ class GitLabProvider(GitProvider):
:param project_id:
:return:
"""
if request_data.get('object_attributes', {}).get("source_branch") and request_data.get('object_attributes', {}).get("target_branch"):
models.ProjectHistory.objects.create(
project_id=project_id,
project_url=request_data.get("project", {}).get("web_url"),