SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 712cc76c authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Finished new finance/timesheets view

parent 11331410
No related branches found
No related tags found
No related merge requests found
......@@ -106,14 +106,12 @@ class MonthYearWidget(Widget):
if not self.required:
index += 1
y = self.year_choices[index][0]
if y and m:
# Days are used for filtering, but not communicated to the user
if self.round_to_end:
d = calendar.monthrange(int(y), int(m))[1]
else:
d = 1
d = '1'
return '%s-%s-%s' % (y, m, d)
return data.get(name, None)
......
......@@ -66,14 +66,17 @@ class LogsFilter(forms.Form):
self.initial['end'] = today.today()
def clean(self):
# TODO: Something's bugging here if `employee` data is given. Have no clue what's going on yet.
data = self.cleaned_data
data['months'] = [dt for dt in rrule(MONTHLY, dtstart=data['start'], until=data['end'])]
return data
if self.is_valid():
self.cleaned_data['months'] = [
dt for dt in rrule(
MONTHLY,
dtstart=self.cleaned_data['start'],
until=self.cleaned_data['end'])]
return self.cleaned_data
def get_months(self):
if self.is_valid():
return self.cleaned_data['months']
return self.cleaned_data.get('months', [])
return []
def filter(self):
......
......@@ -40,7 +40,7 @@
<div class="row">
<div class="col-12">
{% if form.is_bound %}
{% if form.is_bound and form.is_valid %}
<h2 class="mb-2 mt-4">Team timesheets</h2>
<h4 class="mb-1">{{ user_log.user.first_name }} {{ user_log.user.last_name }}</h4>
<table class="table table-hover">
......
......@@ -39,7 +39,7 @@
<div class="row">
<div class="col-12">
{% if form.is_bound %}
{% if form.is_bound and form.is_valid %}
<h2 class="mb-2 mt-4">Team timesheets</h2>
{% for user_log in form.filter %}
<h4 class="mb-1">{{ user_log.user.first_name }} {{ user_log.user.last_name }}</h4>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment