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
1c1be052
Commit
1c1be052
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
api improved to accept pagination params
parent
f7f0aa5b
No related branches found
No related tags found
1 merge request
!36
Resolve "configuration panel"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/api_urls.py
+1
-1
1 addition, 1 deletion
smash/web/api_urls.py
smash/web/api_views/configuration.py
+15
-1
15 additions, 1 deletion
smash/web/api_views/configuration.py
with
16 additions
and
2 deletions
smash/web/api_urls.py
+
1
−
1
View file @
1c1be052
...
@@ -25,7 +25,7 @@ urlpatterns = [
...
@@ -25,7 +25,7 @@ urlpatterns = [
url
(
r
'
^appointment_types$
'
,
appointment_type
.
appointment_types
,
name
=
'
web.api.appointment_types
'
),
url
(
r
'
^appointment_types$
'
,
appointment_type
.
appointment_types
,
name
=
'
web.api.appointment_types
'
),
# appointments
# appointments
url
(
r
'
^configuration_items$
'
,
configuration
.
configuration_items
,
name
=
'
web.api.configuration
'
),
url
(
r
'
^configuration_items$
'
,
configuration
.
configuration_items
,
name
=
'
web.api.configuration
_items
'
),
# subjects data
# subjects data
url
(
r
'
^cities$
'
,
subject
.
cities
,
name
=
'
web.api.cities
'
),
url
(
r
'
^cities$
'
,
subject
.
cities
,
name
=
'
web.api.cities
'
),
...
...
This diff is collapsed.
Click to expand it.
smash/web/api_views/configuration.py
+
15
−
1
View file @
1c1be052
...
@@ -6,14 +6,28 @@ from web.models import ConfigurationItem
...
@@ -6,14 +6,28 @@ from web.models import ConfigurationItem
@login_required
@login_required
def
configuration_items
(
request
):
def
configuration_items
(
request
):
# id of the query from dataTable: https://datatables.net/manual/server-side
draw
=
int
(
request
.
GET
.
get
(
"
draw
"
,
"
-1
"
))
start
=
int
(
request
.
GET
.
get
(
"
start
"
,
"
0
"
))
length
=
int
(
request
.
GET
.
get
(
"
length
"
,
"
10
"
))
items
=
ConfigurationItem
.
objects
.
all
()
items
=
ConfigurationItem
.
objects
.
all
()
count
=
items
.
count
()
count_filtered
=
count
sliced_items
=
items
[
start
:(
start
+
length
)]
data
=
[]
data
=
[]
for
configuration_item
in
items
:
for
configuration_item
in
sliced_
items
:
data
.
append
({
data
.
append
({
"
id
"
:
configuration_item
.
id
,
"
id
"
:
configuration_item
.
id
,
"
name
"
:
configuration_item
.
name
,
"
name
"
:
configuration_item
.
name
,
"
value
"
:
configuration_item
.
value
"
value
"
:
configuration_item
.
value
})
})
return
JsonResponse
({
return
JsonResponse
({
"
draw
"
:
draw
,
"
recordsTotal
"
:
count
,
"
recordsFiltered
"
:
count_filtered
,
"
data
"
:
data
"
data
"
:
data
})
})
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