Use organization image for social media sharing of common events
This commit is contained in:
parent
2d06dde5b7
commit
b74c95e923
2 changed files with 16 additions and 1 deletions
|
@ -345,6 +345,21 @@ class CommonEvent(models.Model):
|
||||||
schema = 'https'
|
schema = 'https'
|
||||||
return "%s://%s%s" % (schema, site.domain, self.get_absolute_url())
|
return "%s://%s%s" % (schema, site.domain, self.get_absolute_url())
|
||||||
|
|
||||||
|
@property
|
||||||
|
def full_img_url(self):
|
||||||
|
if self.organization.tile_img is not None and self.organization.tile_img .name is not None:
|
||||||
|
if self.organization.tile_img .url.startswith('http'):
|
||||||
|
return self.organization.tile_img .url
|
||||||
|
else:
|
||||||
|
site = self.organization.site
|
||||||
|
if settings.DEBUG:
|
||||||
|
schema = 'http'
|
||||||
|
else:
|
||||||
|
schema = 'https'
|
||||||
|
return "%s://%s%s" % (schema, site.domain, self.organization.tile_img .url)
|
||||||
|
else:
|
||||||
|
return self.category.img_url
|
||||||
|
|
||||||
def location(self):
|
def location(self):
|
||||||
if self.city:
|
if self.city:
|
||||||
return self.city
|
return self.city
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:title" content="{{common_event.name}}" />
|
<meta property="og:title" content="{{common_event.name}}" />
|
||||||
<meta property="og:description" content="{{common_event.summary}}" />
|
<meta property="og:description" content="{{common_event.summary}}" />
|
||||||
<meta property="og:image" content="{{common_event.category.img_url}}" />
|
<meta property="og:image" content="{{ common_event.full_img_url }}" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
|
|
Loading…
Reference in a new issue