From e553d098da343a202bbcb0c0c4b9bd42a0b8c37f Mon Sep 17 00:00:00 2001 From: Branson Stephens <branson.stephens@ligo.org> Date: Thu, 25 Sep 2014 14:15:23 -0500 Subject: [PATCH] Added new fields to event creation form. --- gracedb/forms.py | 11 ++++++++--- gracedb/models.py | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/gracedb/forms.py b/gracedb/forms.py index 554988419..d328ec9c2 100644 --- a/gracedb/forms.py +++ b/gracedb/forms.py @@ -3,6 +3,7 @@ from django import forms from django.utils.safestring import mark_safe from django.utils.html import escape from models import Event, Group, Label +from models import Pipeline, Search from django.contrib.auth.models import User from django.core.exceptions import FieldError @@ -39,11 +40,15 @@ class SimpleSearchForm(forms.Form): class CreateEventForm(forms.Form): groupChoices = [("","")]+[(g.name, g.name) for g in Group.objects.all()] - typeChoices= [("","")]+list(Event.ANALYSIS_TYPE_CHOICES) - + #typeChoices= [("","")]+list(Event.ANALYSIS_TYPE_CHOICES) + pipelineChoices = [("","")]+[(p.name, p.name) for p in Pipeline.objects.all()] + searchChoices = [("","")]+[(s.name, s.name) for s in Search.objects.all()] + eventFile = forms.FileField() group = forms.ChoiceField(groupChoices) - type = forms.ChoiceField(choices=typeChoices) + pipeline = forms.ChoiceField(pipelineChoices) + search = forms.ChoiceField(searchChoices) + #type = forms.ChoiceField(choices=typeChoices) class EventSearchForm(forms.Form): diff --git a/gracedb/models.py b/gracedb/models.py index 6c7b25171..d0986a5b9 100644 --- a/gracedb/models.py +++ b/gracedb/models.py @@ -77,18 +77,18 @@ class Event(models.Model): objects = InheritanceManager() # Queries can return subclasses, if available. -# ANALYSIS_TYPE_CHOICES = ( -# ("LM", "LowMass"), -# ("HM", "HighMass"), -# ("GRB", "GRB"), -# ("RD", "Ringdown"), -# ("OM", "Omega"), -# ("Q", "Q"), -# ("X", "X"), -# ("CWB", "CWB"), -# ("MBTA", "MBTAOnline"), -# ("HWINJ", "HardwareInjection"), -# ) + ANALYSIS_TYPE_CHOICES = ( + ("LM", "LowMass"), + ("HM", "HighMass"), + ("GRB", "GRB"), + ("RD", "Ringdown"), + ("OM", "Omega"), + ("Q", "Q"), + ("X", "X"), + ("CWB", "CWB"), + ("MBTA", "MBTAOnline"), + ("HWINJ", "HardwareInjection"), + ) DEFAULT_EVENT_NEIGHBORHOOD = (-5,5) submitter = models.ForeignKey(DjangoUser) -- GitLab