def portfolio_render_reference(portfolio, display_edit_link=True, field_name='portfolios'): html = '<span class="reference-span">%s</span>' % portfolio.title images = instance_get_thumbnail(portfolio, field_name='images', size='50x50') if images: html_images = '' for image in images[0:3]: html_images = html_images + ( '<img class="reference-span" src="%s" />' % image) html = '%s %s' % (html_images, html) if display_edit_link: html = '%s <a class="reference-span autocomplete-add-another pull-right" id="edit_id_%s" href="%s?_popup=1"><span class="glyphicon glyphicon-edit"></span> %s</a>' % ( html, field_name, reverse('portfolio_edit', args=[portfolio.id ]), _('edit')) html = '<span class="portfolio-reference-wrapper reference-wrapper">%s</span>' % html return common_clean(html)
def received_funding_render_reference(received_funding, display_edit_link=True, field_name='received_fundings'): if 'receive' in field_name: verb_display = 'Receives funding' if 'invest' in field_name: verb_display = 'Receives investing' html = '<span class="reference-span">%s <strong>%s %s</strong> from</span>' % ( verb_display, received_funding.amount, settings.CURRENCY) target = received_funding.dst else: verb_display = 'Gives funding' if 'invest' in field_name: verb_display = 'Gives investing' html = '<span class="reference-span">%s <strong>%s %s</strong> to</span>' % ( verb_display, received_funding.amount, settings.CURRENCY) target = received_funding.src if target: image = instance_get_thumbnail(target.get_inst(), field_name='image', size='50x50') if image: html = '%s <img class="reference-span" src="%s" /> %s' % ( html, image, target.get_display_name()) else: html = '%s %s' % (html, target.get_display_name()) else: pass received_funding.delete() return common_clean( '<span class="reference-span">Deleted record</span>') if display_edit_link: html = '%s <a class="reference-span autocomplete-add-another pull-right" id="edit_id_%s" href="%s?_popup=1"><span class="glyphicon glyphicon-edit"></span> %s</a>' % ( html, field_name, reverse('party_received_funding_party_edit', args=[received_funding.id]), _('edit')) html = '<span class="received_funding-reference-wrapper reference-wrapper">%s</span>' % html return common_clean(html)
def user_render_reference(user, display_edit_link=False, field_name='admins'): html = '<span class="reference-span">%s</span>' % user.get_display_name( allow_email=False) if user.image: html = '<img class="reference-span" src="%s" /> %s' % ( instance_get_thumbnail(user, field_name='image', size='50x50'), html) if display_edit_link: html = '%s <a class="reference-span autocomplete-add-another pull-right" id="edit_id_%s" href="%s?_popup=1"><span class="glyphicon glyphicon-edit"></span> %s</a>' % ( html, field_name, reverse('account_edit', args=[user.id ]), _('edit')) html = '<span class="people-reference-wrapper reference-wrapper">%s</span>' % html return common_clean(html)
def experience_render_reference(experience, display_edit_link=True, field_name='experiences'): html = '<span class="reference-span">%s</span>' % experience.title image = instance_get_thumbnail(experience.dst, field_name='image', size='50x50', crop=None) if image: html = '%s at <img class="reference-span" src="%s" /> %s' % ( html, image, experience.dst.name) else: html = '%s at %s' % (html, experience.dst.name) if display_edit_link: html = '%s <a class="reference-span autocomplete-add-another pull-right" id="edit_id_%s" href="%s?_popup=1"><span class="glyphicon glyphicon-edit"></span> %s</a>' % ( html, field_name, reverse('user_experience_organization_edit', args=[experience.id ]), _('edit')) html = '<span class="experience-reference-wrapper reference-wrapper">%s</span>' % html return common_clean(html)
def organization_render_reference(organization, display_edit_link=False, field_name=''): html = '<span class="reference-span">%s</span>' % organization.get_display_name( ) if organization.status == STATUS_PENDING: html = '%s <strong class="pending">(pending)</strong>' % html if organization.image: html = '<img class="reference-span" src="%s" /> %s' % ( instance_get_thumbnail( organization, field_name='image', size='50x50', crop=None), html) if display_edit_link: html = '%s <a class="reference-span autocomplete-add-another pull-right" id="edit_id_%s" href="%s?_popup=1"><span class="glyphicon glyphicon-edit"></span> %s</a>' % ( html, field_name, reverse('account_edit', args=[organization.id ]), _('edit')) html = '<span class="organization-reference-wrapper reference-wrapper title-choice">%s</span>' % html return common_clean(html)
def get_thumbnail_in_primary(self): return instance_get_thumbnail(self, size='150x150', crop=None, upscale=False)
def get_thumbnail(self): return instance_get_thumbnail(self, crop=None, size='x360')
def render(self, value): return mark_safe('<div class="small-logo thumbnail"><span><img src="%s" /></span></div>' % instance_get_thumbnail(bypass_image=value, size='80x80', crop=None))
def get_images(self): return instance_get_thumbnail(self, field_name='images', size='345', crop=None, upscale=False)
def get_thumbnails(self): return instance_get_thumbnail(self, field_name='images', size='306x190', crop='center', upscale=True)
def get_thumbnail_in_primary(self): return instance_get_thumbnail(self, size='150x150', crop='center', upscale=True)
def get_thumbnail(self): return instance_get_thumbnail(self, 'image')