minmal working example

This commit is contained in:
pstruebi
2022-06-12 11:47:13 +02:00
parent b8c2d31784
commit 171f6dfa36
6 changed files with 62 additions and 30 deletions

10
app.py
View File

@@ -28,14 +28,14 @@ def index():
events = calendar_interface.get_all_calendar_events()
if post is None:
if events is None:
abort(404)
else:
return render_template('index.html', events=events)
@app.route('/<int:event_id>')
def post(post_id):
post = get_post(post_id)
return render_template('show_event.html', post=post)
# @app.route('/<int:event_id>')
# def post(post_id):
# post = get_post(post_id)
# return render_template('show_event.html', post=post)

View File

@@ -2,6 +2,7 @@
import json
from lib2to3.pgen2.tokenize import TokenError
import logging
import argparse
import requests
import msal
@@ -80,3 +81,4 @@ if __name__ == "__main__":
print("Available calendars are:")
print(json.dumps(cal_name_id, indent=2))
print(json.dumps(list(get_all_calendar_events()[0].keys()), indent=2))

48
readme.md Normal file
View File

@@ -0,0 +1,48 @@
# Available calendar attributes are:
[
"@odata.etag",
"id",
"createdDateTime",
"lastModifiedDateTime",
"changeKey",
"categories",
"transactionId",
"originalStartTimeZone",
"originalEndTimeZone",
"iCalUId",
"reminderMinutesBeforeStart",
"isReminderOn",
"hasAttachments",
"subject",
"bodyPreview",
"importance",
"sensitivity",
"isAllDay",
"isCancelled",
"isOrganizer",
"responseRequested",
"seriesMasterId",
"showAs",
"type",
"webLink",
"onlineMeetingUrl",
"isOnlineMeeting",
"onlineMeetingProvider",
"allowNewTimeProposals",
"occurrenceId",
"isDraft",
"hideAttendees",
"responseStatus",
"body",
"start",
"end",
"location",
"locations",
"recurrence",
"attendees",
"organizer",
"onlineMeeting",
"calendar@odata.associationLink",
"calendar@odata.navigationLink"
]

View File

@@ -21,18 +21,9 @@
<li class="nav-item active">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{url_for('create')}}">New Post</a>
</li>
</ul>
</div>
</nav>
<div class="container">
{% for message in get_flashed_messages() %}
<div class="alert alert-danger">{{ message }}</div>
{% endfor %}
{% block content %} {% endblock %}
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->

View File

@@ -1,17 +1,15 @@
<!-- {% extends 'base.html' %} -->
{% block content %}
<h1>{% block title %} Welcome to FlaskBlog {% endblock %}</h1>
{% for post in posts %}
<a href="{{ url_for('post', post_id=post['id']) }}">
<h2>{{ post['title'] }}</h2>
<h1>{% block title %} Welcome {% endblock %}</h1>
{% for event in events %}
<a>
<h2>{{ event['subject'] }}</h2>
</a>
<span class="badge badge-primary">{{ post['created'] }}</span>
<span class="badge badge-primary">{{ event["subject"] }}</span>
<a href="{{ url_for('edit', id=post['id']) }}">
<a>
<span class="badge badge-warning">Edit</span>
</a>
<hr>
<hr>
{% endfor %}
{% endblock %}

View File

@@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% block content %}
<h2>{% block title %} {{ post['title'] }} {% endblock %}</h2>
<span class="badge badge-primary">{{ post['created'] }}</span>
<p>{{ post['content'] }}</p>
{% endblock %}