简体   繁体   English

我在仅访问记录中的 django 管理中遇到操作错误

[英]I'm getting an operational error in django administration in access records only

I get this error:我收到此错误:

操作错误

What changes should I do to remove this error?我应该做些什么改变来消除这个错误?

This is the code I wrote in the models.py file:这是我在models.py文件中编写的代码:

from django.db import models

# Create your models here.
class Topic(models.Model):
    top_name = models.CharField(max_length=264,unique=True)

    def __str__(self):
        return self.top_name



class Webpage(models.Model):
    topic = models.ForeignKey(Topic, on_delete=models.CASCADE)
    name = models.CharField(max_length=264,unique=True)
    url = models.URLField(unique=True)

    def __str__(self):
        return self.name

class AccessRecord(models.Model):
    name = models.ForeignKey(Webpage, on_delete=models.CASCADE)
    data = models.DateField()

    def __str__(self):
        return str(self.data)

I think you are useing wrong model name in views.py, Use dj_app.AccessRecord.data in views in state of dj_app_accessrecord.data in views.py我认为您在views.py 中使用了错误的model 名称,在views.py 中的dj_app_accessrecord.data 的state 的视图中使用dj_app.AccessRecord.data

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM