Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
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
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
IGWN Computing and Software
GraceDB
GraceDB Server
Commits
08876dfd
Commit
08876dfd
authored
12 years ago
by
Branson Stephens
Browse files
Options
Downloads
Patches
Plain Diff
added custom template filter for slots
parent
19e4ccb6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gracedb/api.py
+1
-1
1 addition, 1 deletion
gracedb/api.py
gracedb/templatetags/slot.py
+18
-0
18 additions, 0 deletions
gracedb/templatetags/slot.py
with
19 additions
and
1 deletion
gracedb/api.py
+
1
−
1
View file @
08876dfd
...
@@ -917,7 +917,7 @@ class EventSlot(APIView):
...
@@ -917,7 +917,7 @@ class EventSlot(APIView):
# when encoded in the HTTP request body. Hence the 'None' string
# when encoded in the HTTP request body. Hence the 'None' string
# below. If somebody intentionally named a file 'None', then
# below. If somebody intentionally named a file 'None', then
# they deserve to get this error message.
# they deserve to get this error message.
if
filename
==
''
or
filename
==
'
None
'
or
filename
=
None
:
if
filename
==
''
or
filename
==
'
None
'
or
filename
=
=
None
:
return
Response
(
"
Please submit a filename or upload a file.
"
,
return
Response
(
"
Please submit a filename or upload a file.
"
,
status
=
status
.
HTTP_400_BAD_REQUEST
)
status
=
status
.
HTTP_400_BAD_REQUEST
)
# Check for existence of the file.
# Check for existence of the file.
...
...
This diff is collapsed.
Click to expand it.
gracedb/templatetags/slot.py
0 → 100644
+
18
−
0
View file @
08876dfd
from
django
import
template
from
django.utils.encoding
import
force_unicode
from
django.utils.safestring
import
mark_safe
from
..models
import
Slot
,
EventLog
register
=
template
.
Library
()
@register.filter
(
"
slot
"
)
def
slot
(
event
,
slotname
):
if
event
is
None
:
return
mark_safe
(
""
)
try
:
slot
=
Slot
.
objects
.
filter
(
event
=
event
).
filter
(
name
=
slotname
)[
0
]
out
=
slot
.
value
except
:
return
mark_safe
(
"
Object not found.
"
)
return
mark_safe
(
out
)
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