diff --git a/dmapp/dmweb/__init__.pyc b/dmapp/dmweb/__init__.pyc new file mode 100644 index 0000000..ed385b7 Binary files /dev/null and b/dmapp/dmweb/__init__.pyc differ diff --git a/dmapp/dmweb/dmcal.py b/dmapp/dmweb/dmcal.py index 0de9875..866af14 100644 --- a/dmapp/dmweb/dmcal.py +++ b/dmapp/dmweb/dmcal.py @@ -1,4 +1,4 @@ -import datetime +from datetime import datetime from pprint import pprint from flask import Blueprint, render_template import pytz @@ -21,13 +21,17 @@ class DMHTMLCalendar(calendar.HTMLCalendar): def setcalmonth(self, month): self.dmmonth = month + def setcalyear(self, year): + self.dmyear = year + def oneday(self,month,day): - start = datetime.datetime(2020, month, day).replace(hour=0, + current_year = datetime.today().year + start = datetime(self.dmyear, month, day).replace(hour=0, minute=0, second=0) - end = datetime.datetime(2020, month, day).replace (hour=23, + end = datetime(self.dmyear, month, day).replace (hour=23, minute=59, second=59) @@ -63,11 +67,11 @@ class DMHTMLCalendar(calendar.HTMLCalendar): break - start = datetime.datetime(2020, month, start_day).replace(hour=0, + start = datetime(self.dmyear, month, start_day).replace(hour=0, minute=0, second=0) - end = datetime.datetime(2020, month, end_day).replace (hour=23, + end = datetime(self.dmyear, month, end_day).replace (hour=23, minute=59, second=59) @@ -82,18 +86,6 @@ class DMHTMLCalendar(calendar.HTMLCalendar): return returnstr - # def formatmonthname(self, theyear, themonth, withyear=True): - # """ - # Return a month name as a table row. - # """ - # if withyear: - # s = '%s %s' % (month_name[themonth], theyear) - # else: - # s = '%s' % month_name[themonth] - # return '%s' % ( - # self.cssclass_month_head, s) - - def formatweekheader(self): """ Return a header for a week as a table row. @@ -128,13 +120,15 @@ class DMHTMLCalendar(calendar.HTMLCalendar): @dmbp.route("/calendar/") def calmain(month=None): - usemonth = datetime.datetime.today().month + usemonth = datetime.today().month + useyear = datetime.today().year if month: usemonth = month - + cal = DMHTMLCalendar(calendar.SATURDAY) cal.setcalmonth(usemonth) + cal.setcalyear(useyear) - return render_template("calendar.html", content=cal.formatmonth(2020,usemonth)) + return render_template("calendar.html", content=cal.formatmonth(useyear,usemonth)) diff --git a/dmapp/dmweb/static/styles/dm.css b/dmapp/dmweb/static/styles/dm.css index ee20e41..14dc11a 100644 --- a/dmapp/dmweb/static/styles/dm.css +++ b/dmapp/dmweb/static/styles/dm.css @@ -1,3 +1,7 @@ +.sat { + height: 200px; +} + table { border: 1px solid black; } \ No newline at end of file diff --git a/dmapp/dmweb/templates/calendar.html b/dmapp/dmweb/templates/calendar.html index 6603aea..5f85e93 100644 --- a/dmapp/dmweb/templates/calendar.html +++ b/dmapp/dmweb/templates/calendar.html @@ -4,6 +4,17 @@