Views¶
-
class
tom_observations.views.ObservationFilter(data=None, queryset=None, *, request=None, prefix=None)¶ Defines the available fields for filtering the list of
ObservationRecordobjects.
-
class
tom_observations.views.ObservationListView(**kwargs)¶ View that displays all
ObservationRecordobjects.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
filterset_class¶
-
model¶
-
get_queryset(*args, **kwargs)¶ Gets the set of
ObservationRecordobjects associated with the targets that the user is authorized to view.- Returns
set of ObservationRecords
- Return type
QuerySet
-
get(request, *args, **kwargs)¶ Handles the GET requests to this view. If update_status is passed in the query parameters, calls the updatestatus management command to query for new statuses for
ObservationRecordobjects.- Parameters
request (HTTPRequest) – request object for this GET request
-
-
class
tom_observations.views.ObservationCreateView(**kwargs)¶ View for creation/submission of an observation. Requires authentication.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
get_target_id()¶ Parses the target id for the given observation from the query parameters.
- Returns
id of the target for observing
- Return type
int
-
get_target()¶ Gets the target for observing from the database
- Returns
target for observing
- Return type
-
get_facility()¶ Gets the facility from which the target is being observed from the query parameters
- Returns
facility name
- Return type
str
-
get_facility_class()¶ Gets the facility interface class
- Returns
facility class name
- Return type
str
-
get_context_data(**kwargs)¶ Adds the available observation types for the observing facility to the context object.
- Returns
context dictionary
- Return type
dict
-
get_form_class()¶ Gets the observation form class for the facility and selected observation type in the query parameters.
- Returns
observation form
- Return type
subclass of GenericObservationForm
-
get_form()¶ Gets an instance of the form appropriate for the request.
- Returns
observation form
- Return type
subclass of GenericObservationForm
-
get_initial()¶ Populates the observation form with initial data including the id of the target to be observed, the facility at which the observation will take place, and the observation type desired.
- Returns
initial form data
- Return type
dict
-
form_valid(form)¶ Runs after form validation. Submits the observation to the desired facility and creates an associated
ObservationRecord, then redirects to the detail page of the target to be observed.If the facility returns more than one record, a group is created and all observation records from the request are added to it.
- Parameters
form (subclass of GenericObservationForm) – form containing observating request parameters
-
-
class
tom_observations.views.ObservationRecordUpdateView(**kwargs)¶ This view allows for the updating of the observation id, which will eventually be expanded to more fields.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model¶
-
-
class
tom_observations.views.AddExistingObservationView(**kwargs)¶ View for associating a pre-existing observation with a target. Requires authentication.
The GET view returns a confirmation page for adding duplicate ObservationRecords. Two duplicates are any two ObservationRecords with the same target_id, facility, and observation_id.
The POST view validates the form and redirects to the confirmation page if the confirm flag isn’t set.
This view is intended to be navigated to via the existing_observation_button templatetag, as the AddExistingObservationForm has a hidden confirmation checkbox selected by default.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_class¶ alias of
tom_observations.forms.AddExistingObservationForm
-
get_initial()¶ Populates the
ManualObservationFormhidden field for target id with the id from the specified target.- Returns
initial form data
- Return type
dict
-
form_valid(form)¶ Runs after form validation. Creates a new
ObservationRecordassociated with the specified target and facility.
-
-
class
tom_observations.views.ObservationRecordDetailView(**kwargs)¶ View for displaying the details of an
ObservationRecordobject.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model¶
-
get_queryset(*args, **kwargs)¶ Gets the set of
ObservationRecordobjects associated with targets that the current user is authorized to view.- Returns
set of ObservationRecords
- Return type
QuerySet
-
get_context_data(*args, **kwargs)¶ Adds a number of items to the context object for this view, including the form for adding resulting
DataProductobjects to aDataProductGroup, theDataProductobjects associated with theObservationRecord, and the most recent image from thisObservationRecord. It also populates theDataProductUploadFormhidden fields with initial data.- Returns
context dictionary
- Return type
dict
-
-
class
tom_observations.views.ObservationGroupCreateView(**kwargs)¶ View that handles the creation of
ObservationGroupobjects. Requires authentication.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model¶
-
form_valid(form)¶ Runs after form validation. Saves the observation group and assigns the user’s permissions to the group.
- Parameters
form (django.forms.ModelForm) – Form data for observation group creation
-
-
class
tom_observations.views.ObservationGroupListView(**kwargs)¶ View that handles the display of
ObservationGroup. Requires authorization.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model¶
-
-
class
tom_observations.views.ObservationGroupDeleteView(**kwargs)¶ View that handles the deletion of
ObservationGroupobjects. Requires authorization.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model¶
-
-
class
tom_observations.views.ObservationTemplateFilter(data=None, queryset=None, *, request=None, prefix=None)¶ Defines the available fields for filtering the list of
ObservationTemplateobjects.
-
class
tom_observations.views.ObservationTemplateListView(**kwargs)¶ Displays the observing strategies that exist in the TOM.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model¶
-
filterset_class¶
-
-
class
tom_observations.views.ObservationTemplateCreateView(**kwargs)¶ Displays the form for creating a new observation template. Uses the observation template form specified in the respective facility class.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
class
tom_observations.views.ObservationTemplateUpdateView(**kwargs)¶ View for updating an existing observation template.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.