大家好,我需要在 django admin 中导入 excel 文件我找到了这个视频,我应用了这些步骤,但我有行号:1 - name 'name' is not defined error我该如何解决这个问题?models.pyfrom django.db import modelsclass Ekle(models.Model): name = models.CharField(max_length = 50, blank = False) lastname = models.CharField(max_length = 50) price = models.CharField(max_length = 50) def __str__(self): return nameadmin.pyfrom django.contrib import adminfrom .models import *from import_export.admin import ImportExportModelAdmin@admin.register(Ekle)class ViewAdmin(ImportExportModelAdmin): pass
1 回答
陪伴而非守候
TA贡献1757条经验 获得超8个赞
大家好,我需要在 django admin 中导入 excel 文件我找到了这个视频,我应用了这些步骤,但我有行号:1 - name 'name' is not defined error我该如何解决这个问题?
models.py
from django.db import models
class Ekle(models.Model):
name = models.CharField(max_length = 50, blank = False)
lastname = models.CharField(max_length = 50)
price = models.CharField(max_length = 50)
def __str__(self):
return name
admin.py
from django.contrib import admin
from .models import *
from import_export.admin import ImportExportModelAdmin
@admin.register(Ekle)
class ViewAdmin(ImportExportModelAdmin):
pass
添加回答
举报
0/150
提交
取消