from django.contrib import admin
from import_export.admin import ImportExportModelAdmin

from import_export import resources
from .models import *

admin.site.register(Fournisseur)
admin.site.register(ProductsFournisseur)
admin.site.register(TypeProduct)
#admin.site.register(Product)
admin.site.register(TransactionProduct)
admin.site.register(Customer)
admin.site.register(TypeTransaction)
admin.site.register(Transaction)

#admin.site.register(Product)
#class ProductAdmin(ImportExportModelAdmin):
#    pass
class PersonResource(resources.ModelResource):
    class Meta:
        model = Product
        import_id_fields = ['id']  # Clé unique pour éviter les doublons

# Configurer l'interface admin avec ImportExportModelAdmin
@admin.register(Product)
class PersonAdmin(ImportExportModelAdmin):
    resource_class = PersonResource
