优化列表分页和分支记录,确保更好的数据管理。优秀!
This commit is contained in:
parent
c42a262f41
commit
5802b36f46
@ -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
|
||||
|
||||
@ -134,15 +134,16 @@ class GitLabProvider(GitProvider):
|
||||
:param project_id:
|
||||
:return:
|
||||
"""
|
||||
models.ProjectHistory.objects.create(
|
||||
project_id=project_id,
|
||||
project_url=request_data.get("project", {}).get("web_url"),
|
||||
mr_url=request_data.get('object_attributes', {}).get("url"),
|
||||
source_branch=request_data.get('object_attributes', {}).get("source_branch"),
|
||||
target_branch=request_data.get('object_attributes', {}).get("target_branch"),
|
||||
mr_title=request_data.get('object_attributes', {}).get("title"),
|
||||
source_data=request_data,
|
||||
)
|
||||
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"),
|
||||
mr_url=request_data.get('object_attributes', {}).get("url"),
|
||||
source_branch=request_data.get('object_attributes', {}).get("source_branch"),
|
||||
target_branch=request_data.get('object_attributes', {}).get("target_branch"),
|
||||
mr_title=request_data.get('object_attributes', {}).get("title"),
|
||||
source_data=request_data,
|
||||
)
|
||||
|
||||
def run_command(self, mr_url, project_commands):
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user