mirror of https://github.com/sipwise/repoapi.git
https://django-import-export.readthedocs.io/en/latest/getting_started.html#creating-import-export-resource * admin integration https://django-import-export.readthedocs.io/en/latest/getting_started.html#admin-integration Change-Id: I67da67943eea7b39fe63d7d8a910e2b889f92f6epull/5/head
parent
beb1909fe7
commit
8da6c9cb48
@ -0,0 +1,29 @@
|
|||||||
|
# Copyright (C) 2022 The Sipwise Team - http://sipwise.com
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by the Free
|
||||||
|
# Software Foundation, either version 3 of the License, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
# more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
from django.contrib import admin
|
||||||
|
from import_export import resources
|
||||||
|
from import_export.admin import ImportExportModelAdmin
|
||||||
|
|
||||||
|
from . import models
|
||||||
|
|
||||||
|
|
||||||
|
class WorkfrontNoteInfoResource(resources.ModelResource):
|
||||||
|
class Meta:
|
||||||
|
model = models.WorkfrontNoteInfo
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(models.WorkfrontNoteInfo)
|
||||||
|
class WorkfrontNoteInfoAdmin(ImportExportModelAdmin):
|
||||||
|
resource_class = WorkfrontNoteInfoResource
|
||||||
@ -1,24 +1,49 @@
|
|||||||
# Copyright (C) 2016 The Sipwise Team - http://sipwise.com
|
# Copyright (C) 2016-2022 The Sipwise Team - http://sipwise.com
|
||||||
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by the Free
|
# under the terms of the GNU General Public License as published by the Free
|
||||||
# Software Foundation, either version 3 of the License, or (at your option)
|
# Software Foundation, either version 3 of the License, or (at your option)
|
||||||
# any later version.
|
# any later version.
|
||||||
|
#
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
# more details.
|
# more details.
|
||||||
|
#
|
||||||
# You should have received a copy of the GNU General Public License along
|
# You should have received a copy of the GNU General Public License along
|
||||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from import_export import resources
|
||||||
|
from import_export.admin import ImportExportModelAdmin
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
|
|
||||||
|
class ProjectResource(resources.ModelResource):
|
||||||
|
class Meta:
|
||||||
|
model = models.Project
|
||||||
|
|
||||||
|
|
||||||
|
class DockerTagResource(resources.ModelResource):
|
||||||
|
class Meta:
|
||||||
|
model = models.DockerTag
|
||||||
|
|
||||||
|
|
||||||
|
class DockerImageResource(resources.ModelResource):
|
||||||
|
class Meta:
|
||||||
|
model = models.DockerImage
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.DockerTag)
|
@admin.register(models.DockerTag)
|
||||||
|
class DockerTagAdmin(ImportExportModelAdmin):
|
||||||
|
resource_class = DockerTagResource
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.DockerImage)
|
@admin.register(models.DockerImage)
|
||||||
|
class DockerImageAdmin(ImportExportModelAdmin):
|
||||||
|
resource_class = DockerImageResource
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.Project)
|
@admin.register(models.Project)
|
||||||
class ProjectAdmin(admin.ModelAdmin):
|
class ProjectAdmin(ImportExportModelAdmin):
|
||||||
pass
|
resource_class = ProjectResource
|
||||||
|
|||||||
@ -1,27 +1,40 @@
|
|||||||
# Copyright (C) 2015 The Sipwise Team - http://sipwise.com
|
# Copyright (C) 2015-2022 The Sipwise Team - http://sipwise.com
|
||||||
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by the Free
|
# under the terms of the GNU General Public License as published by the Free
|
||||||
# Software Foundation, either version 3 of the License, or (at your option)
|
# Software Foundation, either version 3 of the License, or (at your option)
|
||||||
# any later version.
|
# any later version.
|
||||||
|
#
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
# more details.
|
# more details.
|
||||||
|
#
|
||||||
# You should have received a copy of the GNU General Public License along
|
# You should have received a copy of the GNU General Public License along
|
||||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from repoapi import models
|
from import_export import resources
|
||||||
|
from import_export.admin import ImportExportModelAdmin
|
||||||
|
|
||||||
|
from . import models
|
||||||
|
|
||||||
|
|
||||||
|
class JenkinsBuildInfoResource(resources.ModelResource):
|
||||||
|
class Meta:
|
||||||
|
model = models.JenkinsBuildInfo
|
||||||
|
|
||||||
|
|
||||||
|
class GerritRepoInfoResource(resources.ModelResource):
|
||||||
|
class Meta:
|
||||||
|
model = models.GerritRepoInfo
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.JenkinsBuildInfo)
|
@admin.register(models.JenkinsBuildInfo)
|
||||||
class JenkinsBuildInfoAdmin(admin.ModelAdmin):
|
class JenkinsBuildInfoAdmin(ImportExportModelAdmin):
|
||||||
list_filter = ('param_release', 'projectname')
|
resource_class = JenkinsBuildInfoResource
|
||||||
|
list_filter = ("param_release", "projectname")
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.GerritRepoInfo)
|
@admin.register(models.GerritRepoInfo)
|
||||||
class GerritRepoInfoAdmin(admin.ModelAdmin):
|
class GerritRepoInfoAdmin(ImportExportModelAdmin):
|
||||||
pass
|
resource_class = GerritRepoInfoResource
|
||||||
|
|||||||
Loading…
Reference in new issue