please someone help me to solve this problem
请谁来帮我解决这个问题
# **Admin.py**
from django.contrib import admin
from .models import Task
admin.site.register(Task)
# **view.py**
from django.shortcuts import render
from django.views.generic.list import ListView
from .models import Task
class TaskList(ListView):
model = Task
context_object_name = 'tasks'
{Error
from .models import Task
ImportError: attempted relative import with no known parent package}
# **Model.py**
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Task(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
title = models.CharField(max_length=200)
description = models.TextField(null=True,blank=True)
complete = models.BooleanField(default=False)
create = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title
class Meta:
ordering = ['complete']
**
when is run on server the specific result on come and but server works perfectly.
when i run the code its send this error
**当在服务器上运行时,特定的结果会出现,但服务器运行得很好。当我运行代码时,它发送这个错误
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!