Language exceptions, no visual column

This commit is contained in:
Oleg Lavrovsky 2017-09-14 09:56:38 +02:00
parent 13d9dafbd9
commit d97112373e
3 changed files with 11 additions and 3 deletions

View file

@ -49,7 +49,10 @@ def parse(obj, raw, stream):
obj.content = '' obj.content = ''
# Detect language # Detect language
obj.lang = guess_language(obj.content) or '' try:
obj.lang = guess_language(obj.content) or ''
except:
obj.lang = ''
# Collect tags # Collect tags
tags = [] tags = []

View file

@ -40,9 +40,14 @@ class Entry(models.Model):
tags = models.TextField(blank=True) tags = models.TextField(blank=True)
stream = models.ForeignKey(Stream, stream = models.ForeignKey(Stream,
blank=True, on_delete=models.CASCADE, blank=False, on_delete=models.CASCADE,
verbose_name='Original stream') verbose_name='Original stream')
@property
def no_image(self):
if not self.visual: return 'X'
return ''
class Meta: class Meta:
verbose_name_plural = 'Entries' verbose_name_plural = 'Entries'

View file

@ -11,7 +11,7 @@ class EntryModelAdmin(ModelAdmin):
menu_order = 200 menu_order = 200
add_to_settings_menu = False add_to_settings_menu = False
exclude_from_explorer = True exclude_from_explorer = True
list_display = ('published', 'title', 'author', 'tags') list_display = ('published', 'title', 'no_image', 'lang')
list_filter = ('author', 'tags') list_filter = ('author', 'tags')
search_fields = ('title', 'author', 'content', 'tags') search_fields = ('title', 'author', 'content', 'tags')