Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Merge requests
!60
Resolve "Export to Excel"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Export to Excel"
131-export-to-excel
into
master
Overview
0
Commits
8
Pipelines
1
Changes
13
Merged
Piotr Gawron
requested to merge
131-export-to-excel
into
master
7 years ago
Overview
0
Commits
8
Pipelines
1
Changes
13
Expand
Closes
#131 (closed)
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
5f512d13
8 commits,
7 years ago
13 files
+
134
−
49
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
13
Search (e.g. *.vue) (Ctrl+P)
smash/web/api_views/appointment.py
+
6
−
2
Options
import
traceback
from
datetime
import
datetime
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
JsonResponse
from
django.urls
import
reverse
from
django.utils
import
timezone
from
web.models
import
Appointment
from
web.views
import
e500_error
@@ -29,9 +31,11 @@ def get_appointments(request, type, min_date, max_date):
raise
TypeError
(
"
Unknown query type:
"
+
type
)
if
min_date
is
not
None
:
min_date
=
datetime
.
strptime
(
min_date
,
"
%Y-%m-%d
"
).
replace
(
tzinfo
=
timezone
.
now
().
tzinfo
)
result
=
result
.
filter
(
datetime_when__gt
=
min_date
)
if
max_date
is
not
None
:
max_date
=
datetime
.
strptime
(
max_date
,
"
%Y-%m-%d
"
).
replace
(
tzinfo
=
timezone
.
now
().
tzinfo
)
result
=
result
.
filter
(
datetime_when__lt
=
max_date
)
return
result
.
order_by
(
"
datetime_when
"
)
@@ -57,12 +61,12 @@ def appointments(request, type):
sliced_subjects
=
all_appointments
[
start
:(
start
+
length
)]
appointments
=
sliced_subjects
result_
appointments
=
sliced_subjects
count_filtered
=
all_appointments
.
count
()
data
=
[]
for
appointment
in
appointments
:
for
appointment
in
result_
appointments
:
data
.
append
(
serialize_appointment
(
appointment
))
return
JsonResponse
({
Loading