Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 未知列`comments\u count`_Python_Django_Mezzanine - Fatal编程技术网

Python 未知列`comments\u count`

Python 未知列`comments\u count`,python,django,mezzanine,Python,Django,Mezzanine,我的一个模特有个奇怪的问题。我有一个模型Podcast,它继承了一个基本模型BCCFChildPage,该模型具有RatingField和CommentsField 除了播客,其他所有子模型都可以工作。奇怪的是,这只发生在我的一个模特身上,而不是其他所有模特身上 任何意见都会很好 谢谢 型号: 基本型号: class BCCFChildPage(BCCFBasePage, RichText, AdminThumbMixin): """ This is the page that

我的一个模特有个奇怪的问题。我有一个模型
Podcast
,它继承了一个基本模型
BCCFChildPage
,该模型具有
RatingField
CommentsField

除了
播客
,其他所有子模型都可以工作。奇怪的是,这只发生在我的一个模特身上,而不是其他所有模特身上

任何意见都会很好

谢谢

型号:

基本型号:

class BCCFChildPage(BCCFBasePage, RichText, AdminThumbMixin):
    """
    This is the page that shows up in the fancy carousels.
    """
    TYPES = (
        ('parent', 'Parents'),
        ('professional', 'Professionals'),
    )

    parent = models.ForeignKey('BCCFChildPage', blank=True, null=True)
    gparent = models.ForeignKey('BCCFPage', verbose_name="Parent Page", blank=True, null=True)
    bccf_topic = models.ManyToManyField('BCCFTopic', blank=True, null=True)
    featured = models.BooleanField('Featured', default=False)
    titles = models.CharField(editable=False, max_length=1000, null=True)
    content_model = models.CharField(editable=False, max_length=50, null=True, blank=True)
    rating = RatingField(verbose_name='Rating')
    comments = CommentsField()
    page_for = models.CharField('Type', max_length=13, default='parent', blank=True, null=True, choices=TYPES)
    image = FileField("Image",
        upload_to = upload_to("bccf.ChildPage.image_file", "childpage"),
        extensions = ['.png', '.jpg', '.bmp', '.gif'],
        max_length = 255,
        null = True,
        blank = True,
        help_text = 'You can upload an image. '
            'Acceptable file types: .png, .jpg, .bmp, .gif.')

    objects = managers.ChildPageManager()

    class Meta:
        verbose_name = 'BCCF Child Page'
        verbose_name_plural = 'BCCF Child Pages'
        ordering = ("-created",)

    # Functions below...
class Podcast(BCCFChildPage):
    attached_audio = FileField('Audio File',
       upload_to = upload_to("bccf.Podcast.attachment_audio", "resource/audio"),
        extensions = ['.mp3'],
        max_length = 1024,
        null = True,
        blank = True,
        help_text = 'You can upload an MP3. Acceptable file types: mp3')
    product = models.ForeignKey(Product, verbose_name='Associated Product', blank=True, null=True)

    class Meta:
        verbose_name = 'Podcast'
        verbose_name_plural = 'Podcasts'
儿童模型(播客):

class BCCFChildPage(BCCFBasePage, RichText, AdminThumbMixin):
    """
    This is the page that shows up in the fancy carousels.
    """
    TYPES = (
        ('parent', 'Parents'),
        ('professional', 'Professionals'),
    )

    parent = models.ForeignKey('BCCFChildPage', blank=True, null=True)
    gparent = models.ForeignKey('BCCFPage', verbose_name="Parent Page", blank=True, null=True)
    bccf_topic = models.ManyToManyField('BCCFTopic', blank=True, null=True)
    featured = models.BooleanField('Featured', default=False)
    titles = models.CharField(editable=False, max_length=1000, null=True)
    content_model = models.CharField(editable=False, max_length=50, null=True, blank=True)
    rating = RatingField(verbose_name='Rating')
    comments = CommentsField()
    page_for = models.CharField('Type', max_length=13, default='parent', blank=True, null=True, choices=TYPES)
    image = FileField("Image",
        upload_to = upload_to("bccf.ChildPage.image_file", "childpage"),
        extensions = ['.png', '.jpg', '.bmp', '.gif'],
        max_length = 255,
        null = True,
        blank = True,
        help_text = 'You can upload an image. '
            'Acceptable file types: .png, .jpg, .bmp, .gif.')

    objects = managers.ChildPageManager()

    class Meta:
        verbose_name = 'BCCF Child Page'
        verbose_name_plural = 'BCCF Child Pages'
        ordering = ("-created",)

    # Functions below...
class Podcast(BCCFChildPage):
    attached_audio = FileField('Audio File',
       upload_to = upload_to("bccf.Podcast.attachment_audio", "resource/audio"),
        extensions = ['.mp3'],
        max_length = 1024,
        null = True,
        blank = True,
        help_text = 'You can upload an MP3. Acceptable file types: mp3')
    product = models.ForeignKey(Product, verbose_name='Associated Product', blank=True, null=True)

    class Meta:
        verbose_name = 'Podcast'
        verbose_name_plural = 'Podcasts'
错误

(1054,“字段列表”中的未知列“bccf”播客。评论数)

回溯

Environment:


Request Method: GET
Request URL: http://bccf-staging.bjola.ca/admin/bccf/podcast/

Django Version: 1.6.2
Python Version: 2.7.3
Installed Applications:
('mezzanine.boot',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.redirects',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.sitemaps',
 'django.contrib.staticfiles',
 'ckeditor',
 'mezzanine.conf',
 'mezzanine.core',
 'mezzanine.generic',
 'mezzanine.forms',
 'mezzanine.pages',
 'mezzanine.twitter',
 'mezzanine.accounts',
 'news',
 'pybb',
 'bccf',
 'cartridge.shop',
 'formable.builder',
 'form_utils',
 'embed_video',
 'filebrowser_safe',
 'south',
 'grappelli_safe',
 'django.contrib.admin',
 'django.contrib.comments')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'cartridge.shop.middleware.ShopMiddleware',
 'mezzanine.core.request.CurrentRequestMiddleware',
 'mezzanine.core.middleware.RedirectFallbackMiddleware',
 'mezzanine.core.middleware.TemplateForDeviceMiddleware',
 'mezzanine.core.middleware.TemplateForHostMiddleware',
 'mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware',
 'mezzanine.core.middleware.SitePermissionMiddleware',
 'mezzanine.pages.middleware.PageMiddleware',
 'pybb.middleware.PybbMiddleware')


Traceback:
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
  432.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  99.                     response = view_func(request, *args, **kwargs)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  52.         response = view_func(request, *args, **kwargs)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  198.             return view(request, *args, **kwargs)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
  29.             return bound_func(*args, **kwargs)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  99.                     response = view_func(request, *args, **kwargs)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
  25.                 return func(self, *args2, **kwargs2)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/contrib/admin/options.py" in changelist_view
  1395.             media = self.media + formset.media
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/forms/formsets.py" in media
  373.         if self.forms:
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/utils/functional.py" in __get__
  49.         res = instance.__dict__[self.func.__name__] = self.func(instance)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/forms/formsets.py" in forms
  133.         forms = [self._construct_form(i) for i in xrange(self.total_form_count())]
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/forms/formsets.py" in total_form_count
  108.             initial_forms = self.initial_form_count()
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/forms/models.py" in initial_form_count
  550.             return len(self.get_queryset())
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/db/models/query.py" in __len__
  77.         self._fetch_all()
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
  854.             self._result_cache = list(self.iterator())
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/db/models/query.py" in iterator
  220.         for row in compiler.results_iter():
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in results_iter
  709.         for rows in self.execute_sql(MULTI):
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  782.         cursor.execute(sql, params)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  69.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  99.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/django/db/backends/mysql/base.py" in execute
  124.             return self.cursor.execute(query, args)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/MySQLdb/cursors.py" in execute
  201.             self.errorhandler(self, exc, value)
File "/home/vcn/webapps/bccf/lib/python2.7/site-packages/MySQLdb/connections.py" in defaulterrorhandler
  36.     raise errorclass, errorvalue

Exception Type: OperationalError at /admin/bccf/podcast/
Exception Value: (1054, "Unknown column 'bccf_podcast.comments_count' in 'field list'")

你在用夹层吗?我对django非常陌生,但如果您阅读了mezzanine的文档,他们建议您只继承他们的页面(另外还有Richtext)和BlogPost类。在添加翻译功能和新的自定义帖子类型时,我发现自己两次遇到同样的问题。如果对象不适合这两个类中的任何一个,则可以从这些模型继承并注入所需的任何更改:

我想那是夹层通道