Views

class tom_observations.views.ObservationFilter(data=None, queryset=None, *, request=None, prefix=None)

Defines the available fields for filtering the list of ObservationRecord objects.

class tom_observations.views.ObservationListView(**kwargs)

View that displays all ObservationRecord objects.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

filterset_class

alias of ObservationFilter

model

alias of tom_observations.models.ObservationRecord

get_queryset(*args, **kwargs)

Gets the set of ObservationRecord objects 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 ObservationRecord objects.

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

Target

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

alias of tom_observations.models.ObservationRecord

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 ManualObservationForm hidden 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 ObservationRecord associated with the specified target and facility.

class tom_observations.views.ObservationRecordDetailView(**kwargs)

View for displaying the details of an ObservationRecord object.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of tom_observations.models.ObservationRecord

get_queryset(*args, **kwargs)

Gets the set of ObservationRecord objects 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 DataProduct objects to a DataProductGroup, the DataProduct objects associated with the ObservationRecord, and the most recent image from this ObservationRecord. It also populates the DataProductUploadForm hidden fields with initial data.

Returns

context dictionary

Return type

dict

class tom_observations.views.ObservationGroupCreateView(**kwargs)

View that handles the creation of ObservationGroup objects. Requires authentication.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of tom_observations.models.ObservationGroup

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

alias of tom_observations.models.ObservationGroup

class tom_observations.views.ObservationGroupDeleteView(**kwargs)

View that handles the deletion of ObservationGroup objects. Requires authorization.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of tom_observations.models.ObservationGroup

class tom_observations.views.ObservationTemplateFilter(data=None, queryset=None, *, request=None, prefix=None)

Defines the available fields for filtering the list of ObservationTemplate objects.

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

alias of tom_observations.models.ObservationTemplate

filterset_class

alias of ObservationTemplateFilter

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.

class tom_observations.views.ObservationTemplateDeleteView(**kwargs)

Deletes an observation template.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of tom_observations.models.ObservationTemplate