mirror of https://github.com/snachodog/mybuddy.git
Add basic import/export support for tags
This commit is contained in:
parent
7804fe8f2d
commit
bdc28991cb
|
@ -184,11 +184,17 @@ class TaggedItemInline(admin.StackedInline):
|
||||||
model = models.Tagged
|
model = models.Tagged
|
||||||
|
|
||||||
|
|
||||||
|
class TagImportExportResource(ImportExportResourceBase):
|
||||||
|
class Meta:
|
||||||
|
model = models.Tag
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.Tag)
|
@admin.register(models.Tag)
|
||||||
class TagAdmin(admin.ModelAdmin):
|
class TagAdmin(ImportExportMixin, ExportActionMixin, admin.ModelAdmin):
|
||||||
form = TagAdminForm
|
form = TagAdminForm
|
||||||
inlines = [TaggedItemInline]
|
inlines = [TaggedItemInline]
|
||||||
list_display = ["name", "slug", "color", "last_used"]
|
list_display = ["name", "slug", "color", "last_used"]
|
||||||
ordering = ["name", "slug"]
|
ordering = ["name", "slug"]
|
||||||
search_fields = ["name"]
|
search_fields = ["name"]
|
||||||
prepopulated_fields = {"slug": ["name"]}
|
prepopulated_fields = {"slug": ["name"]}
|
||||||
|
resource_class = TagImportExportResource
|
||||||
|
|
Loading…
Reference in New Issue