Init "join" and "dashboard" pages
This commit is contained in:
parent
670dd34856
commit
d6302ea673
7 changed files with 78 additions and 2 deletions
|
@ -45,5 +45,8 @@ def create_app():
|
|||
from .auth import bp as auth_bp
|
||||
app.register_blueprint(auth_bp)
|
||||
|
||||
from .dashboard import bp as dash_bp
|
||||
app.register_blueprint(dash_bp)
|
||||
|
||||
|
||||
return app
|
||||
|
|
9
acmsite/dashboard/__init__.py
Normal file
9
acmsite/dashboard/__init__.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
from flask import Blueprint, render_template
|
||||
|
||||
|
||||
bp = Blueprint('dashboard', __name__, url_prefix='/dashboard')
|
||||
|
||||
@bp.route("/")
|
||||
def home():
|
||||
return render_template('dashboard.html')
|
|
@ -29,3 +29,12 @@ class PwResetRequest(db.Model):
|
|||
id = Column(String, primary_key=True)
|
||||
user_id = Column(String, ForeignKey('acm_users.id'), nullable=False)
|
||||
expires = Column(DateTime, nullable=False)
|
||||
|
||||
class Event(db.Model):
|
||||
__tablename__ = "acm_events"
|
||||
id = Column(String, primary_key=True)
|
||||
name = Column(String, nullable=False)
|
||||
description = Column(String, nullable=True)
|
||||
location = Column(String, nullable=False)
|
||||
start_time=Column(DateTime, nullable=False)
|
||||
end_time=Column(DateTime, nullable=False)
|
||||
|
|
16
acmsite/templates/dashboard.html
Normal file
16
acmsite/templates/dashboard.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{% extends "layout.html" %}
|
||||
|
||||
{% block app_content %}
|
||||
|
||||
<h1>Welcome back, {{ current_user.first_name }}!</h1>
|
||||
|
||||
<p>For a list of upcoming events, take a look at our <a href="{{
|
||||
url_for('main.events')
|
||||
}}">events
|
||||
listing</a>.
|
||||
Otherwise, there's not
|
||||
a whole lot here
|
||||
unless you're an
|
||||
officer!</p>
|
||||
|
||||
{% endblock app_content %}
|
|
@ -3,6 +3,9 @@
|
|||
{% block app_content %}
|
||||
|
||||
<h1>Join ACM</h1>
|
||||
|
||||
<p>Want to join us? Show up to our GBMs and events every week!</p>
|
||||
|
||||
<p>Our upcoming events are:</p>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
</ul>
|
||||
<ul class="nav navbar-nav">
|
||||
{% if current_user.is_authenticated %}
|
||||
{{ render_nav_item('main.homepage', 'Dashboard') }}
|
||||
{{ render_nav_item('dashboard.home', 'Dashboard') }}
|
||||
{% if current_user.is_admin %}
|
||||
{{ render_nav_item('main.homepage', 'Admin Dash') }}
|
||||
{{ render_nav_item('dashboard.home', 'Admin Dash') }}
|
||||
{% endif %}
|
||||
{{ render_nav_item('auth.logout', 'Logout') }}
|
||||
{% else %}
|
||||
|
|
36
migrations/versions/6d239e987242_create_event_table.py
Normal file
36
migrations/versions/6d239e987242_create_event_table.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
"""Create event table
|
||||
|
||||
Revision ID: 6d239e987242
|
||||
Revises: 7cdd046a2abf
|
||||
Create Date: 2024-03-03 20:20:57.235877
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6d239e987242'
|
||||
down_revision = '7cdd046a2abf'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('acm_events',
|
||||
sa.Column('id', sa.String(), nullable=False),
|
||||
sa.Column('name', sa.String(), nullable=False),
|
||||
sa.Column('description', sa.String(), nullable=True),
|
||||
sa.Column('location', sa.String(), nullable=False),
|
||||
sa.Column('start_time', sa.DateTime(), nullable=False),
|
||||
sa.Column('end_time', sa.DateTime(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('acm_events')
|
||||
# ### end Alembic commands ###
|
Loading…
Add table
Reference in a new issue