Remove duplicate image field
This commit is contained in:
parent
be4137aa7b
commit
47838fd652
1 changed files with 4 additions and 10 deletions
|
@ -11,13 +11,6 @@ class Entity(MetadataPageMixin, Page):
|
|||
created = models.DateTimeField(auto_now_add=True)
|
||||
modified = models.DateTimeField(auto_now=True)
|
||||
post_date = models.DateTimeField(null=True, blank=True)
|
||||
image = models.ForeignKey(
|
||||
'wagtailimages.Image',
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name='+',
|
||||
on_delete=models.SET_NULL
|
||||
)
|
||||
|
||||
promote_panels = [
|
||||
MultiFieldPanel([
|
||||
|
@ -29,14 +22,15 @@ class Entity(MetadataPageMixin, Page):
|
|||
], 'Common page configuration'),
|
||||
]
|
||||
|
||||
@property
|
||||
def image(self):
|
||||
return self.search_image
|
||||
|
||||
@property
|
||||
def short_body(self):
|
||||
body_words = str(self.body).split(' ')
|
||||
return ' '.join(body_words[:30]) # limit to 30 words (ish)
|
||||
|
||||
def get_meta_image(self):
|
||||
return self.image
|
||||
|
||||
def get_meta_description(self):
|
||||
return self.search_description or self.short_body
|
||||
|
||||
|
|
Reference in a new issue