Views¶
- class tom_dataproducts.views.DataProductSaveView(**kwargs)¶
View that handles saving a
DataProduct
generated by an observation. Requires authentication.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- post(request, *args, **kwargs)¶
Method that handles POST requests for the
DataProductSaveView
. Gets the observation facility that created the data and saves the selected data products asDataProduct
objects. Redirects to theObservationDetailView
for the specificObservationRecord
.- Parameters:
request (HttpRequest) – Django POST request object
- class tom_dataproducts.views.DataProductUploadView(**kwargs)¶
View that handles manual upload of DataProducts. Requires authentication.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- form_valid(form)¶
Runs after
DataProductUploadForm
is validated. Saves eachDataProduct
and callsrun_data_processor
on each saved file. Redirects to the previous page.
- form_invalid(form)¶
Adds errors to Django messaging framework in the case of an invalid form and redirects to the previous page.
- class tom_dataproducts.views.DataProductDeleteView(*args, **kwargs)¶
View that handles the deletion of a
DataProduct
. Requires authentication.- model¶
alias of
DataProduct
- get_success_url()¶
Gets the URL specified in the query params by “next” if it exists, otherwise returns the URL for home.
- Returns:
referer or the index URL
- Return type:
str
- delete(request, *args, **kwargs)¶
Method that handles DELETE requests for this view. First deletes all
ReducedDatum
objects associated with theDataProduct
, then deletes theDataProduct
.- Parameters:
request (HttpRequest) – Django POST request object
- get_context_data(*args, **kwargs)¶
Adds the referer to the query parameters as “next” and returns the context dictionary.
- Returns:
context dictionary
- Return type:
dict
- class tom_dataproducts.views.DataProductListView(**kwargs)¶
View that handles the list of
DataProduct
objects.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- model¶
alias of
DataProduct
- get_queryset()¶
Gets the set of
DataProduct
objects that the user has permission to view.- Returns:
Set of
DataProduct
objects- Return type:
QuerySet
- get_context_data(*args, **kwargs)¶
Adds the set of
DataProductGroup
objects to the context dictionary.- Returns:
context dictionary
- Return type:
dict
- class tom_dataproducts.views.DataProductFeatureView(**kwargs)¶
View that handles the featuring of
DataProduct``s. A featured ``DataProduct
is displayed on theTargetDetailView
.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- get(request, *args, **kwargs)¶
Method that handles the GET requests for this view. Sets all other
DataProduct``s to unfeatured in the database, and sets the specified ``DataProduct
to featured. Caches the featured image. Deletes previously featured images from the cache.
View that handles the sharing of data either through HERMES or with another TOM.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
Adds errors to Django messaging framework in the case of an invalid form and redirects to the previous page.
Method that handles the POST requests for sharing data. Handles Data Products and All the data of a type for a target as well as individual Reduced Datums. Submit to Hermes, or Share with TOM (soon).
When sharing a DataProduct with another TOM we likely want to share the data product itself and let the other TOM process it rather than share the Reduced Datums :param tom_name: name of destination tom in settings.DATA_SHARING :param product: DataProduct model instance :return:
Custom sharing protocols used to determine when data is shared with a destination. This example prevents sharing if a datum has already been published to the given Hermes topic. :param destination: sharing destination string :param reduced_datums: selected input datums :return: queryset of reduced datums to be shared
- class tom_dataproducts.views.DataProductGroupDetailView(**kwargs)¶
View that handles the viewing of a specific
DataProductGroup
.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- model¶
alias of
DataProductGroup
- post(request, *args, **kwargs)¶
Handles the POST request for this view.
- class tom_dataproducts.views.DataProductGroupListView(**kwargs)¶
View that handles the display of all
DataProductGroup
objects.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- model¶
alias of
DataProductGroup
- class tom_dataproducts.views.DataProductGroupCreateView(**kwargs)¶
View that handles the creation of a new
DataProductGroup
.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- model¶
alias of
DataProductGroup
- class tom_dataproducts.views.DataProductGroupDeleteView(*args, **kwargs)¶
View that handles the deletion of a
DataProductGroup
. Requires authentication.- model¶
alias of
DataProductGroup
- class tom_dataproducts.views.DataProductGroupDataView(**kwargs)¶
View that handles the addition of
DataProduct``s to a ``DataProductGroup
. Requires authentication.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- form_valid(form)¶
Runs after form validation. Adds the specified
DataProduct
objects to the group.- Parameters:
form (AddProductToGroupForm) – Form with data products and group information
- class tom_dataproducts.views.UpdateReducedDataView(**kwargs)¶
View that handles the updating of reduced data tied to a
DataProduct
that was automatically ingested from a broker. Requires authentication.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- get(request, *args, **kwargs)¶
Method that handles the GET requests for this view. Calls the management command to update the reduced data and adds a hint using the messages framework about automation.
- get_redirect_url()¶
Returns redirect URL as specified in the HTTP_REFERER field of the request.
- Returns:
referer
- Return type:
str