终端说:不能导入名称Post

时间:2017-11-08 17:20:29

标签: python django

终端说:

_filterMethod(evt) {
  this.gridItems = this.allItems.filter(it => it.col1 !== it.col2);
}

Models.py文件

 File "/Users/carlosecharte/makeblog/blogone/posts/admin.py", line 8, in <module>
   from .models import Post
   ImportError: cannot import name Post

admin.py文件:

 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals

 from django.db import models

    # Create your models here.
  class Post(models.Model):pass
     title = models.CharField(max_length=120)
     content = models.TextField()
     updated = models.DateTimeField(auto_now=True, auto_now_add=False)
     timestamp = models.DateTimeField(auto_now=False, auto_now_ad=True)


  def__unicode__(self):
     return self.title

如何让帖子应用转到我的管理信息中心?

基本上我怎样才能正确导入?

1 个答案:

答案 0 :(得分:-1)

admin.py 中试试这个:

from .models import post

admin.site.register(post)