Parcourir la source

Previous entry form will not retain the selected date. The current months entry form will auto select the current day as long as a previous form submission hasn't set a selected date.

Entries are now identified with a randomly generated UID.

Entries also have new data properties, approved, status, approved. These will be used for managing entries by supervisors and generating reports.
Adam Day il y a 4 ans
Parent
commit
8114d4b27c
2 fichiers modifiés avec 5 ajouts et 13 suppressions
  1. 4 9
      app/forms.py
  2. 1 4
      app/templates/timesheet.html

+ 4 - 9
app/forms.py

@@ -1,7 +1,6 @@
 from django import forms
 from django.core.validators import RegexValidator, MaxLengthValidator, MinLengthValidator, ValidationError
 from . models import Project, Setting
-from calendar import monthrange
 
 numeric = RegexValidator(r'^[0-9+]', 'Only numeric characters.')
 time_max_length = MaxLengthValidator(4, 'Length limit exceeds 4 characters.')
@@ -25,14 +24,10 @@ def pin_blacklist(value):
 
 
 hours = []
-try:
-    max_daily_hours = Setting.objects.get(setting='Max Daily Hours')
-    for hour in range(0, int(max_daily_hours.value)+1):
-        hours.append(("%i" % hour, "%i" % hour))
-except Exception as e:
-    print(e)
-    for hour in range(0, 9):
-        hours.append(("%i" % hour, "%i" % hour))
+max_daily_hours = Setting.objects.get(setting='Max Daily Hours')
+for hour in range(0, int(max_daily_hours.value)+1):
+    hours.append(("%i" % hour, "%i" % hour))
+
 
 days = (
     ('1', '1'),

+ 1 - 4
app/templates/timesheet.html

@@ -68,10 +68,7 @@
                         <div class="col-sm-6">
                             <h3 class="mt-2">Total Time Worked: {{ total_time_worked }}</h3>
                         </div>
-                        <div class="col-sm-3 text-center">
-
-                        </div>
-                        <div class="col-sm-3 text-end mb-3">
+                        <div class="col-sm-6 text-end mb-3">
                             <a href="#!" class="btn btn-lg btn-dark"><span class="oi" data-glyph="print"></span></a>
                         </div>
                     </div>