Brain views
This is the module that the user will use to connect to the database. This can be defined in either a web page or in a REST API call. This module is the ‘V’ in the MVC framework for the brain.
- class brain.views.AnimalDetail(**kwargs)
Returns the animal string. It is used with this URL: http://server/animal/DKXX and it returns all animal info.
- get(request, pk, format=None)
This method safely gets the object and serializes it.
- Parameters:
pk – animal name as the primary key.
- Returns:
a HTTP response with the serialized data.
- get_object(pk)
This method safely gets an animal object.
- Parameters:
pk – animal name as the primary key.
- Returns:
Either the object or a useful error message.
- class brain.views.AnimalList(**kwargs)
List all animals for the REST API.
- get(request, format=None)
Gets all active animals ordered by the prep_id (animal name).
- Returns:
serialized animal objects
- class brain.views.ScanResolution(**kwargs)
A simple class to return the x,y,z scan resolution.
- get(request, prep_id='Atlas', format=None)
This fetches the xy and z scan resolution for an animal.
- Parameters:
request – HTTP request
prep_id – name of the animal, defaults to ‘Atlas’
format – None
- Returns:
a simple dictionary containing the xy and z resolution.
- brain.views.image_list(request)
A method to provide a list of all active animals in a nice dropdown menu format.
- Returns:
HTML for the dropdown menu