输出中的错误日志:
NameError at /admin/todo/todomodel/add/
name 'unicode' is not defined
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/todo/todomodel/add/
Django Version: 2.2
Exception Type: NameError
Exception Value:
name 'unicode' is not defined
关于系统和异常的更多细节:
异常位置:C:\Users\PEE TEE\Desktop\ToDoApp\lib\site-packages\slugify.py in slugify, line 24
Python可执行文件: C:\Users\PEE TEE\Desktop\ToDoApp\Scripts\python.exe
蟒蛇版本:3.7.6
蟒蛇路径:
['C:\\Users\\PEE TEE\\Desktop\\ToDoApp\\src',
'C:\\Users\\PEE TEE\\Desktop\\ToDoApp\\Scripts\\python37.zip',
'C:\\Users\\PEE TEE\\Desktop\\ToDoApp\\DLLs',
'C:\\Users\\PEE TEE\\Desktop\\ToDoApp\\lib',
'C:\\Users\\PEE TEE\\Desktop\\ToDoApp\\Scripts',
'c:\\users\\pee tee\\appdata\\local\\programs\\python\\python37\\Lib',
'c:\\users\\pee tee\\appdata\\local\\programs\\python\\python37\\DLLs',
'C:\\Users\\PEE TEE\\Desktop\\ToDoApp',
'C:\\Users\\PEE TEE\\Desktop\\ToDoApp\\lib\\site-packages']
服务器时间:2020 年 2 月 4 日星期二 03:03:37 +0000
这是我的模型:
from django.db import models
from django.db.models.signals import post_save
from slugify import slugify
# Create your models here.
class ToDoModel(models.Model):
author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
what_todo = models.CharField(max_length=255, default="Event to be done")
date_todo = models.DateField(auto_now=False,auto_now_add=False)
slug = models.SlugField(null=True, blank=True)
def save(self, *args, **kwargs):
if self.what_todo and not self.slug:
self.slug = slugify(self.what_todo)
return super(ToDoModel, self).save(*args, **kwargs)
def __str__(self):
return str(self.what_todo)
缥缈止盈
摇曳的蔷薇
相关分类