mirror of https://gitlab.com/tildes/tildes.git
Ivan Fonseca
6 years ago
committed by
Deimos
9 changed files with 139 additions and 1 deletions
-
30tildes/alembic/versions/3f83028d1673_add_user_bio_column.py
-
33tildes/tildes/models/user/user.py
-
1tildes/tildes/routes.py
-
16tildes/tildes/schemas/user.py
-
5tildes/tildes/templates/settings.jinja2
-
25tildes/tildes/templates/settings_bio.jinja2
-
7tildes/tildes/templates/user.jinja2
-
16tildes/tildes/views/api/web/user.py
-
7tildes/tildes/views/settings.py
@ -0,0 +1,30 @@ |
|||
"""Add user bio column |
|||
|
|||
Revision ID: 3f83028d1673 |
|||
Revises: 4ebc3ca32b48 |
|||
Create Date: 2019-02-20 08:17:49.636855 |
|||
|
|||
""" |
|||
from alembic import op |
|||
import sqlalchemy as sa |
|||
|
|||
|
|||
# revision identifiers, used by Alembic. |
|||
revision = "3f83028d1673" |
|||
down_revision = "4ebc3ca32b48" |
|||
branch_labels = None |
|||
depends_on = None |
|||
|
|||
|
|||
def upgrade(): |
|||
op.add_column("users", sa.Column("bio_markdown", sa.Text(), nullable=True)) |
|||
op.add_column("users", sa.Column("bio_rendered_html", sa.Text(), nullable=True)) |
|||
op.create_check_constraint( |
|||
"bio_markdown_length", "users", "LENGTH(bio_markdown) <= 2000" |
|||
) |
|||
|
|||
|
|||
def downgrade(): |
|||
op.drop_constraint("ck_users_bio_markdown_length", "users") |
|||
op.drop_column("users", "bio_rendered_html") |
|||
op.drop_column("users", "bio_markdown") |
@ -0,0 +1,25 @@ |
|||
{# Copyright (c) 2019 Tildes contributors <code@tildes.net> #} |
|||
{# SPDX-License-Identifier: AGPL-3.0-or-later #} |
|||
|
|||
{% extends 'base_no_sidebar.jinja2' %} |
|||
|
|||
{% from 'macros/forms.jinja2' import markdown_textarea %} |
|||
|
|||
{% block title %}Edit your user bio{% endblock %} |
|||
|
|||
{% block main_heading %}Edit your user bio{% endblock %} |
|||
|
|||
{% block content %} |
|||
<form |
|||
method="post" |
|||
name="user-bio" |
|||
autocomplete="off" |
|||
data-ic-patch-to="{{ request.route_url("ic_user", username=request.user.username) }}" |
|||
> |
|||
{{ markdown_textarea('User Bio (Markdown)', text=request.user.bio_markdown) }} |
|||
|
|||
<div class="form-buttons"> |
|||
<button type="submit" class="btn btn-primary">Submit</button> |
|||
</div> |
|||
</form> |
|||
{% endblock %} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue