forked from miguelgrinberg/flasky
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80675d1
commit cb7face
Showing
7 changed files
with
111 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
{% extends "base.html" %} | ||
{% import "bootstrap/wtf.html" as wtf %} | ||
|
||
{% block title %}Flasky{% endblock %} | ||
|
||
{% block page_content %} | ||
<div class="page-header"> | ||
<h1>Hello, {% if current_user.is_authenticated %}{{ current_user.username }}{% else %}Stranger{% endif %}!</h1> | ||
</div> | ||
<div> | ||
{% if current_user.can(Permission.WRITE) %} | ||
{{ wtf.quick_form(form) }} | ||
{% endif %} | ||
</div> | ||
<ul class="posts"> | ||
{% for post in posts %} | ||
<li class="post"> | ||
<div class="post-thumbnail"> | ||
<a href="{{ url_for('.user', username=post.author.username) }}"> | ||
<img class="img-rounded profile-thumbnail" src="{{ post.author.gravatar(size=40) }}"> | ||
</a> | ||
</div> | ||
<div class="post-content"> | ||
<div class="post-date">{{ moment(post.timestamp).fromNow() }}</div> | ||
<div class="post-author"><a href="{{ url_for('.user', username=post.author.username) }}">{{ post.author.username }}</a></div> | ||
<div class="post-body">{{ post.body }}</div> | ||
</div> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""post model | ||
Revision ID: 1b966e7f4b9e | ||
Revises: 198b0eebcf9 | ||
Create Date: 2013-12-31 00:00:14.700591 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '1b966e7f4b9e' | ||
down_revision = '198b0eebcf9' | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
def upgrade(): | ||
### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('posts', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('body', sa.Text(), nullable=True), | ||
sa.Column('timestamp', sa.DateTime(), nullable=True), | ||
sa.Column('author_id', sa.Integer(), nullable=True), | ||
sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_index('ix_posts_timestamp', 'posts', ['timestamp'], unique=False) | ||
### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index('ix_posts_timestamp', 'posts') | ||
op.drop_table('posts') | ||
### end Alembic commands ### |