python - Unknown Column `comments_count` -
i'm having weird problem 1 of models. have model podcast
inherits base model bccfchildpage
has ratingfield
, commentsfield
.
every other child model works except podcast
. it's weird it's happening 1 of models , not else.
any input or comments great.
thanks.
models:
base model:
class bccfchildpage(bccfbasepage, richtext, adminthumbmixin): """ page shows in 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 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...
child model (podcast):
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 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'
error
(1054, "unknown column 'bccf_podcast.comments_count' in 'field list'")
traceback
environment: request method: 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) 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. 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. 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 @ /admin/bccf/podcast/ exception value: (1054, "unknown column 'bccf_podcast.comments_count' in 'field list'")
are using mezzanine? i'm new django if read mezzanine's documentation advice inherit page (additionally richtext) , blogpost classes. found myself same trouble twice while adding translation capabilities , new custom post types. if object doesn't fit of 2 classes, can inherit models , inject changes desire: http://mezzanine.jupo.org/docs/model-customization.html
i think that's mezzanine way..
Comments
Post a Comment