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

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

PYTHON KANSAI #02

F703b996b502414dd880bc39789faa8f?s=128

Daisuke Konishi

December 08, 2019
Tweet

Transcript

  1. 4.
  2. 8.

    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
  3. 9.

    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