Views

class tom_alerts.views.BrokerQueryCreateView(**kwargs)

View for creating a new query to a broker. Requires authentication.

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

get_broker_name()

Returns the broker specified in the request

Returns

Broker name

Return type

str

get_form_class()

Returns the form class to use in this view. The form class will be the one defined in the specific broker module for which a new query is being created.

get_form()

Returns an instance of the form to be used in this view.

Returns

Form instance

Return type

django.forms.Form

get_initial()

Returns the initial data to use for forms on this view.

Returns

dict of initial values

Return type

dict

form_valid(form)

Saves the associated BrokerQuery and redirects to the BrokerQuery list.

class tom_alerts.views.BrokerQueryUpdateView(**kwargs)

View that handles the modification of a previously saved BrokerQuery. Requires authentication.

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

get_object()

Returns the BrokerQuery object that corresponds with the ID in the query path.

Returns

BrokerQuery object

Return type

BrokerQuery

get_form_class()

Returns the form class to use in this view. The form class will be the one defined in the specific broker module for which the query is being updated.

get_form()

Returns an instance of the form to be used in this view.

Returns

Form instance

Return type

django.forms.Form

get_initial()

Returns the initial data to use for forms on this view. Initial data for this form consists of the name of the broker that the query is for.

Returns

dict of initial values

Return type

dict

form_valid(form)

Saves the associated BrokerQuery and redirects to the BrokerQuery list.

class tom_alerts.views.BrokerQueryFilter(data=None, queryset=None, *, request=None, prefix=None)

Defines the available fields for filtering the list of broker queries.

class tom_alerts.views.BrokerQueryListView(**kwargs)

View that displays all saved BrokerQuery objects.

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

model

alias of tom_alerts.models.BrokerQuery

filterset_class

alias of BrokerQueryFilter

get_context_data(*args, **kwargs)

Adds the brokers available to the TOM to the context dictionary.

Returns

context

Return type

dict

class tom_alerts.views.BrokerQueryDeleteView(**kwargs)

View that handles the deletion of a saved BrokerQuery. Requires authentication.

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

model

alias of tom_alerts.models.BrokerQuery

class tom_alerts.views.RunQueryView(**kwargs)

View that handles the running of a specific BrokerQuery.

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

get_context_data(*args, **kwargs)

Runs the fetch_alerts method specific to the given BrokerQuery and adds the matching alerts to the context dictionary.

Returns

context

Return type

dict

class tom_alerts.views.CreateTargetFromAlertView(**kwargs)

View that handles the creation of Target objects from a BrokerQuery result. Requires authentication.

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

post(request, *args, **kwargs)

Handles the POST requests to this view. Creates a Target for each alert sent in the POST. Redirects to the TargetListView if multiple targets were created, and the TargetUpdateView if only one was created. Redirects to the RunQueryView if no Target objects. were successfully created.

class tom_alerts.views.SubmitAlertUpstreamView(**kwargs)

View used to submit alerts to an upstream broker, such as SCIMMA’s Hopskotch or the Transient Name Server.

While this view handles the query parameters for target_id and observation_record_id by default, it will send any additional query parameters to the broker, allowing a broker to use any arbitrary parameters.

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

get_redirect_url()

If next is provided in the query params, redirects to next. If HTTP_REFERER is present on the META property of the request, redirects to HTTP_REFERER. Else redirects to /.

Returns

url to redirect to

Return type

str