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
Commits
5e850f27
Commit
5e850f27
authored
8 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
api for list of locations
parent
241fba6a
No related branches found
No related tags found
1 merge request
!34
Performance of subject list
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/api_urls.py
+1
-0
1 addition, 0 deletions
smash/web/api_urls.py
smash/web/api_views.py
+12
-4
12 additions, 4 deletions
smash/web/api_views.py
with
13 additions
and
4 deletions
smash/web/api_urls.py
+
1
−
0
View file @
5e850f27
...
...
@@ -22,6 +22,7 @@ urlpatterns = [
url
(
r
'
^countries$
'
,
api_views
.
countries
,
name
=
'
web.api.countries
'
),
url
(
r
'
^specializations$
'
,
api_views
.
specializations
,
name
=
'
web.api.specializations
'
),
url
(
r
'
^units$
'
,
api_views
.
units
,
name
=
'
web.api.units
'
),
url
(
r
'
^locations$
'
,
api_views
.
locations
,
name
=
'
web.api.locations
'
),
url
(
r
'
^referrals$
'
,
api_views
.
referrals
,
name
=
'
web.api.referrals
'
),
url
(
r
'
^appointment_types$
'
,
api_views
.
appointment_types
,
name
=
'
web.api.appointment_types
'
),
url
(
r
'
^subjects/(?P<type>[A-z]+)$
'
,
api_views
.
subjects
,
name
=
'
web.api.subjects
'
),
...
...
This diff is collapsed.
Click to expand it.
smash/web/api_views.py
+
12
−
4
View file @
5e850f27
...
...
@@ -3,7 +3,7 @@ import json
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
JsonResponse
from
models
import
Subject
,
Worker
,
AppointmentType
from
models
import
Subject
,
Worker
,
AppointmentType
,
Location
from
views.subject
import
SUBJECT_LIST_GENERIC
...
...
@@ -15,6 +15,14 @@ def cities(request):
})
@login_required
def
locations
(
request
):
X
=
Location
.
objects
.
values_list
(
'
name
'
).
distinct
()
return
JsonResponse
({
"
locations
"
:
[
x
[
0
]
for
x
in
X
]
})
@login_required
def
countries
(
request
):
X
=
Subject
.
objects
.
filter
(
country__isnull
=
False
).
values_list
(
'
country
'
).
distinct
()
...
...
@@ -94,11 +102,11 @@ def get_subjects_filtered(subjects, filters):
elif
column
==
"
screening_number
"
:
result
=
result
.
filter
(
screening_number__contains
=
value
)
elif
column
==
"
dead
"
:
result
=
result
.
filter
(
dead
=
(
value
==
"
true
"
))
result
=
result
.
filter
(
dead
=
(
value
==
"
true
"
))
elif
column
==
"
resigned
"
:
result
=
result
.
filter
(
resigned
=
(
value
==
"
true
"
))
result
=
result
.
filter
(
resigned
=
(
value
==
"
true
"
))
elif
column
==
"
postponed
"
:
result
=
result
.
filter
(
postponed
=
(
value
==
"
true
"
))
result
=
result
.
filter
(
postponed
=
(
value
==
"
true
"
))
else
:
print
row
# elif order_column == "default_location":
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment