Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jonah Kanner
gracedb
Commits
1120e0c3
Commit
1120e0c3
authored
May 25, 2017
by
Tanner Prestegard
Browse files
Merge branch 'offline' into 'master'
Adding offline boolean parameter to Event model class See merge request !4
parents
eaa8fffd
b9585f48
Changes
6
Hide whitespace changes
Inline
Side-by-side
gracedb/forms.py
View file @
1120e0c3
...
...
@@ -57,6 +57,11 @@ class CreateEventForm(forms.Form):
labels
=
forms
.
CharField
(
required
=
False
)
#type = forms.ChoiceField(choices=typeChoices)
# Offline boolean. required=False means that if the user
# doesn't provide a value, we use the default defined in models.py.
# This ensures backwards-compatibility for client versions which
# don't specify this parameter.
offline
=
forms
.
BooleanField
(
required
=
False
)
class
EventSearchForm
(
forms
.
Form
):
groupChoices
=
[(
""
,
""
)]
+
[(
g
.
name
,
g
.
name
)
for
g
in
Group
.
objects
.
all
()]
...
...
gracedb/migrations/0021_event_offline.py
0 → 100644
View file @
1120e0c3
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'gracedb'
,
'0020_fix_lib_perms'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'event'
,
name
=
'offline'
,
field
=
models
.
BooleanField
(
default
=
False
),
),
]
gracedb/models.py
View file @
1120e0c3
...
...
@@ -135,6 +135,13 @@ class Event(models.Model):
# searches quite considerably.
perms
=
models
.
TextField
(
null
=
True
)
# Boolean which determines whether the event was submitted by an offline
# analysis (True) or an online/low-latency analysis (False). Because this
# is being implemented during a run (O2), we use a default value of False
# so as to ensure backwards-compatibility; i.e., all events treated as
# "online" by default.
offline
=
models
.
BooleanField
(
default
=
False
)
class
Meta
:
ordering
=
[
"-id"
]
...
...
gracedb/view_logic.py
View file @
1120e0c3
...
...
@@ -45,6 +45,7 @@ def _createEventFromForm(request, form):
pipeline
=
Pipeline
.
objects
.
get
(
name
=
form
.
cleaned_data
[
'pipeline'
])
search_name
=
form
.
cleaned_data
[
'search'
]
label_str
=
form
.
cleaned_data
[
'labels'
]
offline
=
form
.
cleaned_data
[
'offline'
]
if
search_name
:
search
=
Search
.
objects
.
get
(
name
=
form
.
cleaned_data
[
'search'
])
else
:
...
...
@@ -67,6 +68,7 @@ def _createEventFromForm(request, form):
event
.
group
=
group
event
.
pipeline
=
pipeline
event
.
search
=
search
event
.
offline
=
offline
# If the event is an injection, look for certain attributes in the POST data.
# These attributes are unfortunately not found in the SimInspiralTable
...
...
gracedb/view_utils.py
View file @
1120e0c3
...
...
@@ -134,6 +134,7 @@ def eventToDict(event, columns=None, request=None):
rv
[
'gpstime'
]
=
event
.
gpstime
rv
[
'instruments'
]
=
event
.
instruments
rv
[
'nevents'
]
=
event
.
nevents
rv
[
'offline'
]
=
event
.
offline
far_is_upper_limit
=
False
display_far
=
event
.
far
...
...
templates/gracedb/event_detail.html
View file @
1120e0c3
...
...
@@ -119,6 +119,11 @@
</div>
{% endif %}
{% if object.offline %}
<div
style=
"text-align: center;"
>
<h2
style=
"color: red;"
>
OFFLINE EVENT
</h2>
</div>
{% endif %}
<!-- Here is a section for the EM advocate signoffs. -->
<!-- XXX So much ugliness here. Is there a way to do this with the JS? -->
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment