python - 'NoneType' object has no attribute 'src' -
if i'm not wrong, think error mean i'm trying display doesn't exist. i've provided content, don't know why error. i'll explain in detail: i'm using django-ckeditor, , when try post image , text, grouped content. , i'm trying use image thumbnail front page, separate content. i'm using python goose extract image content. in models.py
class post(models.model): content = richtextuploadingfield(config_name='default') @property def thumbnail(self): g = goose() thumbnail = g.extract(raw_html=self.content).top_image.src return thumbnail
in html
<img src="{{ post.thumbnail }}" />
the error dissapears if def thumbnail(self, content) (and nothing gets displayed) shouldn't since i'm extracting post model, , content self.content.
Comments
Post a Comment