def to_representation(self, value): safe_value = sanitize_html(value, allow_images=True) html = BeautifulSoup(safe_value, "html.parser") for image in html.find_all("img"): image["src"] = generate_url(image.get("data-file-key")) return str(html)
def to_representation(self, value): safe_value = sanitize_html(value, allow_images=True) html = BeautifulSoup(safe_value, 'html.parser') for image in html.find_all('img'): image['src'] = generate_url(image.get('data-file-key')) return str(html)
def render_abakus_group(abakus_group): logo = None if abakus_group.logo_id: logo = generate_url(abakus_group.logo_id, height=100, width=100) return { "id": abakus_group.id, "name": abakus_group.name, "type": abakus_group.type, "logo": logo, }
def render_abakus_group(abakus_group): logo = None if abakus_group.logo_id: logo = generate_url(abakus_group.logo_id, height=100, width=100) return { 'id': abakus_group.id, 'name': abakus_group.name, 'type': abakus_group.type, 'logo': logo }
def render_user(user): return { "id": user.id, "username": user.username, "first_name": user.first_name, "last_name": user.last_name, "profile_picture": generate_url(user.profile_picture, height=100, width=100), }
def render_user(user): return { 'id': user.id, 'username': user.username, 'first_name': user.first_name, 'last_name': user.last_name, 'profile_picture': generate_url(user.profile_picture, height=100, width=100) }
def to_representation(self, value): return generate_url(unquote(value.pk), **self.options)