diff --git a/feedler/feedparser.py b/feedler/feedparser.py index 8d7f9e0..8533ae1 100644 --- a/feedler/feedparser.py +++ b/feedler/feedparser.py @@ -49,7 +49,10 @@ def parse(obj, raw, stream): obj.content = '' # Detect language - obj.lang = guess_language(obj.content) or '' + try: + obj.lang = guess_language(obj.content) or '' + except: + obj.lang = '' # Collect tags tags = [] diff --git a/feedler/models/models.py b/feedler/models/models.py index 3b77c6c..e6d9b54 100644 --- a/feedler/models/models.py +++ b/feedler/models/models.py @@ -40,9 +40,14 @@ class Entry(models.Model): tags = models.TextField(blank=True) stream = models.ForeignKey(Stream, - blank=True, on_delete=models.CASCADE, + blank=False, on_delete=models.CASCADE, verbose_name='Original stream') + @property + def no_image(self): + if not self.visual: return 'X' + return '' + class Meta: verbose_name_plural = 'Entries' diff --git a/feedler/wagtail_hooks.py b/feedler/wagtail_hooks.py index ed8abd5..ea449eb 100644 --- a/feedler/wagtail_hooks.py +++ b/feedler/wagtail_hooks.py @@ -11,7 +11,7 @@ class EntryModelAdmin(ModelAdmin): menu_order = 200 add_to_settings_menu = False exclude_from_explorer = True - list_display = ('published', 'title', 'author', 'tags') + list_display = ('published', 'title', 'no_image', 'lang') list_filter = ('author', 'tags') search_fields = ('title', 'author', 'content', 'tags')