Upgrade to Pro — share decks privately, control downloads, hide ads and more …

django-import-export で
マスターデータ管理生活

django-import-export で
マスターデータ管理生活

PYTHON KANSAI #02

Daisuke Konishi

December 08, 2019
Tweet

More Decks by Daisuke Konishi

Other Decks in Programming

Transcript

  1. from django.db import models class Food(models.Model): name = models.CharField('໊લ', max_length=128)

    class Meta: db_table = 'food' verbose_name = '৯΂෺' verbose_name_plural = '৯΂෺Ұཡ' def __str__(self): return(self.name) GPPENPEFMTQZ
  2. from import_export import resources from .models import Food class FoodResource(resources.ModelResource):

    class Meta: model = Food skip_unchanged = True report_skipped = False import_id_fields = ('name', ) from django.contrib import admin from import_export.admin import ImportExportModelAdmin from .foodResources import FoodResource from .models import Food @admin.register(Food) class FoodAdmin(ImportExportModelAdmin): resource_class = FoodResource GPPEBENJOQZ GPPEGPPE3FTPVSDFTQZ