Animals Application

The animal app contains and controls the display of data about animals.

Animals are tracked as individual entities, and given associations to breeding cages to follow ancestry, and strains.

Animal

Most parameters about an animal are set within the animal object. Here is where the animals strain, breeding, parentage and many other parameters are included. Animals have foreignkey relationships with both Strain and Breeding, so an animal may only belong to one of each of those. As an example, a mouse cannot come from more than one Breeding set, and cannot belong to more than one strain.

Backcrosses and Generations

For this software, optional tracking of backcrosses and generations is available and is stored as an attribute of an animal. When an inbred cross is made against a pure background, the backcross increases by 1. When a heterozygote cross is made, the generation increases by one. As an example, for every time a mouse in a C57/BL6 background is crossed against a wildtype C57/B6 mouse, the backcross (but not the generation) increases by one. For every time a mutant strain is crosses against itself (either vs a heterozygote or homozygote of that strain), the generation will increase by one. Backcrosses should typically be performed against a separate colony of purebred mouse, rather than against wild-type alleles of the mutant strain.

Breeding Cages

A breeding cage is defined as a set of one or more male and one or more female mice. Because of this, it is not always clear who the precise parentage of an animal is. If the parentage is known, then the Mother and Father fields can be set for a particular animal.

Strains

A strain is a set of mice with a similar genetics. Importantly strains are separated from Backgrounds. For example, one might have mice with the genotype ob/ob but these mice may be in either a C57-Black6 or a mixed background. This difference is set at the individual animal level. The result of this is that a query for a particular strain may then need to be filtered to a specific background.

Animal Data Models

This module describes the Strain, Animal, Breeding and Cage data models.

This module stores all data regarding a particular laboratory animal. Information about experimental data and timed matings are stored in the data and timed_matings packages. This module describes the database structure for each data model.

class mousedb.animal.models.Animal(*args, **kwargs)

A data model describing an animal.

This data model describes a wide variety of parameters of an experimental animal. This model is linked to the Strain. If the parentage of a mouse is known, this can be identified (the breeding set may not be clear on this matter). Mice are automatically marked as not alive when a Death date is provided and the object is saved. Strain, Background and Genotype are required fields. By default, querysets are ordered first by strain then by MouseID.

age()

Calculates the animals age, relative to the current date (if alive) or the date of death (if not).

breeding_female_location_type()

This attribute defines whether a female’s current location is the same as the breeding cage to which it belongs.

This attribute is used to color breeding table entries such that male mice which are currently in a different cage can quickly be identified. The location is relative to the first breeding cage an animal is assigned to.

breeding_male_location_type()

This attribute defines whether a male’s current location is the same as the breeding cage to which it belongs.

This attribute is used to color breeding table entries such that male mice which are currently in a different cage can quickly be identified. The location is relative to the first breeding cage an animal is assigned to.

save()

The save method for Animal class is over-ridden to set Alive=False when a Death date is entered. This is not the case for a cause of death.

class mousedb.animal.models.Breeding(*args, **kwargs)

This data model stores information about a particular breeding set

A breeding set may contain one ore more males and females and must be defined via the progeny strain. For example, in the case of generating a new strain, the strain indicates the new strain not the parental strains. A breeding cage is defined as one male with one or more females. If the breeding set is part of a timed mating experiment, then Timed_Mating must be selected. Breeding cages are automatically inactivated upon saving when a End date is provided. The only required field is Strain. By default, querysets are ordered by Strain, then Start.

duration()

Calculates the breeding cage’s duration.

This is relative to the current date (if alive) or the date of inactivation (if not). The duration is formatted in days.

male_breeding_location_type()

This attribute defines whether a breeding male’s current location is the same as the breeding cage.

This attribute is used to color breeding table entries such that male mice which are currently in a different cage can quickly be identified.

save()

The save function for a breeding cage has to automatic over-rides, Active and the Cage for the Breeder.

In the case of Active, if an End field is specified, then the Active field is set to False. In the case of Cage, if a Cage is provided, and animals are specified under Male or Females for a Breeding object, then the Cage field for those animals is set to that of the breeding cage. The same is true for both Rack and Rack Position.

unweaned()

This attribute generates a queryset of unweaned animals for this breeding cage. It is filtered for only Alive animals.

class mousedb.animal.models.Strain(*args, **kwargs)

A data model describing a mouse strain.

This is separate from the background of a mouse. For example a ob/ob mouse on a mixed or a black-6 background still have the same strain. The background is defined in the animal and breeding cages. Strain and Strain_slug are required.

get_absolute_url(*moreargs, **morekwargs)

For a Strain object, the permalinked absolute url is /strain/strain-slug.

Animal App Views and URLs

This package contains all url dispatchers for the animal app.

It is broken down into animal, strain, breeding, cage and date url dispatchers for clarity. Each of these takes a different subfolder directive (ie the animal module is for /animal... requests.

Breeding URLS

This URLconf defines the routing of pages for breeding objects.

This includes generic views for breeding, breeding details and create, change, search and delete breeding cages.

Cage URLS

Date URLS

This package is the url dispatcher for date views.

This urlconf takes a url in the form /date/... and can generate a general archive, yearly archive or monthly archive.

Mouse URLS

This url dispatcher for animal objects

controls views in the form /mouse..., /mice... or /animal...

This includes create, update, delete views as well as animal-list, and animal-list all and animal-multiple-new.

Strain URLS

This module is the url dispatcher for strain related views.

It takes the root /strain... and generates strain-list, strain-new, strain-edit, strain-delete, strain-detail and strain-detail-all views from animal.views.

ToDo List URLS

URL configuration file for todo subpages.

This controls any page /mousedb/todo/... and sends it to the appropriate views.

Views

These views define template redirects for the animal app.

This module contains all views for this app as class based views.

class mousedb.animal.views.AnimalCreate(**kwargs)

This class generates the new Animal view (animal-new).

This permission restricted view takes a url in the form /animal/new and generates an empty animal_form.html. This view is restricted to those with the animal.create_animal permission.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

form_class

alias of AnimalForm

model

alias of Animal

class mousedb.animal.views.AnimalDelete(**kwargs)

This class generates the delete Animal view (animal-delete).

This permission restricted view takes a url in the form /animal/#/delete and passes that object to the confirm_delete.html page. This view is restricted to those with the animal.delete_animal permission.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

model

alias of Animal

class mousedb.animal.views.AnimalDetail(**kwargs)

This view displays specific details about an Animal object as animal-detail.

It takes a request in the form animal/(id), mice/(id) or mouse/(id) and renders the detail page for that mouse. The request is defined for id not MouseID (or barcode) because this allows for details to be displayed for mice without barcode identification. Therefore care must be taken that animal/4932 is id=4932 and not barcode=4932. The animal name is defined at the top of the page. This page is restricted to logged-in users.

model

alias of Animal

class mousedb.animal.views.AnimalList(**kwargs)

This view generates a list of Animal objects as animal-list

This view responds to a url in the form /animal It sends a variable animal containing all animals to animal_list.html. This view is login protected.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

model

alias of Animal

class mousedb.animal.views.AnimalListAlive(**kwargs)

This view generates a list of alive Animal objects.

This view subclasses AnimalList The main use for this view is to take a url in the form /animal/all and to return a list of all alive animals to animal_list.html in the context animal. It also adds an extra context variable, “list type” as Alive. This view is login protected.

get_context_data(**kwargs)

This add in the context of list_type and returns this as Alive.

class mousedb.animal.views.AnimalMonthArchive(**kwargs)

This view generates a list of animals born within the specified year.

It takes a url in the form of /date/#### where #### is the four digit code of the year. This view is restricted to logged in users.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

model

alias of Animal

class mousedb.animal.views.AnimalUpdate(**kwargs)

This class generates the update Animal view (animal-edit).

This permission restricted view takes a url in the form /animal/#/edit and generates a animal_form.html with that object. This view is restricted to those with the animal.update_animal permission.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

form_class

alias of AnimalForm

model

alias of Animal

class mousedb.animal.views.AnimalYearArchive(**kwargs)

This view generates a list of animals born within the specified year.

It takes a url in the form of /date/#### where #### is the four digit code of the year. This view is restricted to logged in users.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

model

alias of Animal

class mousedb.animal.views.BreedingCreate(**kwargs)

This class generates the breeding-new view.

This permission restricted view takes a url in the form /breeding/new and generates an empty plugevents_form.html.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

form_class

alias of BreedingForm

model

alias of Breeding

class mousedb.animal.views.BreedingDelete(**kwargs)

This class generates the breeding-delete view.

This permission restricted view takes a url in the form /breeding/#/delete and passes that object to the confirm_delete.html page.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

model

alias of Breeding

class mousedb.animal.views.BreedingDetail(**kwargs)

This view displays specific details about a Breeding object.

It takes a request in the form /breeding/(breeding_id) and renders the detail page for that breeding set. The breeding_id refers to the background id of the Breeding object, and not the breeding cage barcode. This page is restricted to logged-in users.

model

alias of Breeding

class mousedb.animal.views.BreedingList(**kwargs)

This class generates an object list for active Breeding objects.

This login protected view takes all Breeding objects and sends them to strain_list.html as a strain_list dictionary. It also passes a strain_list_alive and cages dictionary to show the numbers for total cages and total strains. The url for this view is /strain/

get_context_data(**kwargs)

This adds into the context of breeding_type and sets it to Active.

class mousedb.animal.views.BreedingListAll(**kwargs)

This class generates a view for all Breeding objects.

This class is a subclass of BreedingList, changing the queryset and the breeding_type context.

get_context_data(**kwargs)

This add in the context of breeding_type and sets it to All.

class mousedb.animal.views.BreedingListTimedMating(**kwargs)

This class generates a view for Breeding objects, showing only timed mating cages.

This class is a subclass of BreedingList, changing the queryset and the breeding_type context.

get_context_data(**kwargs)

This add in the context of breeding_type and sets it to Timed_Matings.

class mousedb.animal.views.BreedingSearch(**kwargs)

This class generates a view for breeding objects, showing the results of a search query for cage number.

This class is a subclass of BreedingList, changing the queryset and the breeding_type context as well as providing the search query and search results if available.

get_context_data(**kwargs)

This add in the context of breeding_type and sets it to Search it also returns the query and the queryset.

class mousedb.animal.views.BreedingUpdate(**kwargs)

This class generates the breeding-edit view.

This permission restricted view takes a url in the form /breeding/#/edit and generates a breeding_form.html with that object.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

form_class

alias of BreedingForm

model

alias of Breeding

class mousedb.animal.views.CrossTypeAnimalList(**kwargs)

This view filters animal objects for a particular strain showing only the results of a particular breeding type.

This view takes a url in the form /strain/<strain_slug>/<breeding_type> and filters Animal objects on that basis, via both of those keyword arguments. Notably breeding_type has to be the display value not the key value of CROSS_TYPE. This view is a subclass of AnimalList.

get_context_data(**kwargs)

This add in the context of list_type and returns this as whatever the crosstype was.

queryset()

This function sets the queryset according to the keyword arguments. For the crosstype, the input value is the the display value of CROSS_TYPE. This is done because the spaces in HET vs HET are not recognized. Therefore the queryset must be matched exactly (ie by case so Intercross not intercross). The function also filters the strain by the strain_slug keyword argument.

class mousedb.animal.views.EarTagList(**kwargs)

This view is for showing animals which need to be eartagged.

This view is a subclass of AnimalList. This list shows animals that do not have an eartag (MouseID) and are older than the age set by WEAN_AGE in localsettings.py (default is 14 days). It takes a view /todo/eartag. This view is login protected.

class mousedb.animal.views.GenotypeList(**kwargs)

This view is for showing animals which need to be genotyped.

This view is a subclass of AnimalList. This list shows animals that do not have a genotype (ie N.D. or ?) and are older than GENOTYPE_AGE as designated in localsettings.py (default is 21 days). It takes a view /todo/genotype. This view is login protected.

class mousedb.animal.views.NoCageList(**kwargs)

This view is for showing animals which need to have a cage entered.

This list shows animals that have no cage number and are alive. This view is a subclass of AnimalList It takes a view /todo/no_cage. This view is login protected.

class mousedb.animal.views.NoRackList(**kwargs)

This view is for showing animals which need to have a cage entered.

This list shows animals that have no cage number and are alive. This view is a subclass of AnimalList It takes a view /todo/no_rack. This view is login protected.

class mousedb.animal.views.StrainCreate(**kwargs)

This class generates the new Strain view (strain-new).

This permission restricted view takes a url in the form /strain/new and generates an empty strain_form.html. This view is restricted to those with the animal.create_strain permission.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

model

alias of Strain

class mousedb.animal.views.StrainDelete(**kwargs)

This class generates the delete Strain view (strain-delete).

This permission restricted view takes a url in the form /strain/#/delete and passes that object to the confirm_delete.html page. This view is restricted to those with the animal.delete_strain permission.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

model

alias of Strain

class mousedb.animal.views.StrainDetail(**kwargs)

This view displays specific details about a Strain object showing only current related objects.

It takes a request in the form strain/(strain_slug)/ and renders the detail page for that Strain. This view also passes along a dictionary of alive animals belonging to that strain. This page is restricted to logged-in users.

get_context_data(**kwargs)

This add in the context of strain_list_alive (which filters for only alive animals and active) and cages which filters for the number of current cages.

class mousedb.animal.views.StrainDetailAll(**kwargs)

This view displays specific details about a Strain showing all related objects.

This view subclasses StrainDetail and modifies the get_context_data to show associated active objects. It takes a request in the form strain/(strain_slug)/all and renders the detail page for that Strain. This view also passes along a dictionary of alive animals belonging to that Strain. This page is restricted to logged-in users.

get_context_data(**kwargs)

This adds into the context of strain_list_all (which filters for all alive Animal objects and active cages) and cages which filters for the number of current cages.

class mousedb.animal.views.StrainList(**kwargs)

This class generates an object list for Strain objects.

This login protected view takes all Strain objects and sends them to strain_list.html as a strain_list dictionary. It also passes a strain_list_alive and cages dictionary to show the numbers for total cages and total strains. The url for this view is /strain/

get_context_data(**kwargs)

This add in the context of strain_list_alive (which filters for all alive animals) and cages which filters for the number of current cages.

model

alias of Strain

class mousedb.animal.views.StrainUpdate(**kwargs)

This class generates the update Strain view (strain-edit).

This permission restricted view takes a url in the form /strain/#/edit and generates a strain_form.html with that object. This view is restricted to those with the animal.update_strain permission.

dispatch(*args, **kwargs)

This decorator sets this view to have restricted permissions.

model

alias of Strain

class mousedb.animal.views.WeanList(**kwargs)

This view is for showing animals which need to be weaned.

This list shows animals that need to be weaned. This view is a subclass of AnimalList filtering for animals that are older than the WEAN_AGE and are alive. It takes a view /todo/wean. This view is login protected.

mousedb.animal.views.breeding_change(request, *args, **kwargs)

This view is used to generate a form by which to change pups which belong to a particular breeding set.

This view typically is used to modify existing pups. This might include marking animals as sacrificed, entering genotype or marking information or entering movement of mice to another cage. It is used to show and modify several animals at once. It takes a request in the form /breeding/(breeding_id)/change/ and returns a form specific to the breeding set defined in breeding_id. breeding_id is the background identification number of the breeding set and does not refer to the barcode of any breeding cage. This view returns a formset in which one row represents one animal. To add extra animals to a breeding set use /breeding/(breeding_id)/pups/. This view is restricted to those with the permission animal.change_animal.

mousedb.animal.views.breeding_pups(request, *args, **kwargs)

This view is used to generate a form by which to add pups which belong to a particular breeding set.

This view is intended to be used to add initial information about pups, including eartag, genotype, gender and birth or weaning information. It takes a request in the form /breeding/(breeding_id)/pups/ and returns a form specific to the breeding set defined in breeding_id. breeding_id is the background identification number of the breeding set and does not refer to the barcode of any breeding cage. This view is restricted to those with the permission animal.add_animal.

mousedb.animal.views.breeding_wean(request, *args, **kwargs)

This view is used to generate a form by which to wean pups which belong to a particular breeding set.

This view typically is used to wean existing pups. This includes the MouseID, Cage, Markings, Gender and Wean Date fields. For other fields use the breeding-change page. It takes a request in the form /breeding/(breeding_id)/wean/ and returns a form specific to the breeding set defined in breeding_id. breeding_id is the background identification number of the breeding set and does not refer to the barcode of any breeding cage. This view returns a formset in which one row represents one animal. To add extra animals to a breeding set use /breeding/(breeding_id)/pups/. This view is restricted to those with the permission animal.change_animal.

mousedb.animal.views.date_archive_year(request)

This view will generate a table of the number of mice born on an annual basis.

This view is associated with the url name archive-home, and returns an dictionary of a date and a animal count.

mousedb.animal.views.multiple_breeding_pups(request, breeding_id)

This view is used to enter multiple animals at the same time from a breeding cage.

It will generate a form containing animal information and a number of mice. It is intended to create several identical animals with the same attributes.
This view requres an input of a breeding_id to generate the correct form.
mousedb.animal.views.multiple_pups(request)

This view is used to enter multiple animals at the same time.

It will generate a form containing animal information and a number of mice. It is intended to create several identical animals with the same attributes.

mousedb.animal.views.todo(request, *args, **kwargs)

This view generates a summary of the todo lists.

The login restricted view passes lists for ear tagging, genotyping and weaning and passes them to the template todo.html.

Administrative Interface

Admin site settings for the animal app.

class mousedb.animal.admin.AnimalAdmin(model, admin_site)

Provides parameters for animal objects within the admin interface.

mark_estimated_death(request, queryset)

An admin action for marking several animals as sacrificed.

This action sets the selected animals as Alive=False, Death=today and Cause_of_Death as Estimated. To use other paramters, mice muse be individually marked as sacrificed. This admin action also shows as the output the number of mice sacrificed.

mark_sacrificed(request, queryset)

An admin action for marking several animals as sacrificed.

This action sets the selected animals as Alive=False, Death=today and Cause_of_Death as sacrificed. To use other paramters, mice muse be individually marked as sacrificed. This admin action also shows as the output the number of mice sacrificed.

class mousedb.animal.admin.AnimalInline(parent_model, admin_site)

Provides an inline tabular formset for animal objects.

Currently used with the breeding admin page.

model

alias of Animal

class mousedb.animal.admin.BreedingAdmin(model, admin_site)

Settings in the admin interface for dealing with Breeding objects.

This interface also includes an form for adding objects associated with this breeding cage.

mark_deactivated(request, queryset)

An admin action for marking several cages as inactive.

This action sets the selected cages as Active=False and Death=today. This admin action also shows as the output the number of mice sacrificed.

class mousedb.animal.admin.StrainAdmin(model, admin_site)

Settings in the admin interface for dealing with Strain objects.

Animal App Unit Tests

This file contains tests for the animal application.

These tests will verify generation and function of a new breeding, strain and animal object.

class mousedb.animal.tests.AnimalModelTests(methodName='runTest')

Tests the model attributes of Animal objects contained in the animal app.

setUp()

Instantiate the test client.

tearDown()

Depopulate created model instances from test database.

test_animal_unicode()

This is a test for creating a new animal object, with only the minimum fields being entered. It then tests that the correct unicode representation is being generated.

test_create_animal_minimal()

This is a test for creating a new animal object, with only the minimum fields being entered

class mousedb.animal.tests.AnimalViewTests(methodName='runTest')

Tests the views associated with animal objects.

setUp()

Instantiate the test client. Creates a test user.

tearDown()

Depopulate created model instances from test database.

test_animal_delete()

This test checks the view which displays an animal deletion page.

It checks for the correct templates and status code and that the animal is passed correctly to the context.

test_animal_detail()

This tests the animal-detail view, ensuring that templates are loaded correctly.

This view uses a user with superuser permissions so does not test the permission levels for this view.

test_animal_edit()

This test checks the view which displays a animal edit page.

It checks for the correct templates and status code and that the animal is passed correctly to the context.

test_animal_list()

This test checks the view which displays a breeding list page showing active animals. It checks for the correct templates and status code.

test_animal_list_all()

This test checks the view which displays a breeding list page showing all animals. It checks for the correct templates and status code.

test_animal_new()

This test checks the view which displays a new animal.

It checks for the correct templates and status code.

class mousedb.animal.tests.BreedingModelTests(methodName='runTest')

Tests the model attributes of Breeding objects contained in the animal app.

setUp()

Instantiate the test client.

tearDown()

Depopulate created model instances from test database.

test_autoset_active_state()

This is a test for creating a new breeding object, with only the minimum being entered. That object is then tested for the active state being automatically set when a End date is specified.

test_create_breeding_minimal()

This is a test for creating a new breeding object, with only the minimum being entered.

test_duration()

This test verifies that the duration is set correctly.

test_study_absolute_url()

This test verifies that the absolute url of a breeding object is set correctly.

test_unweaned()

This is a test for the unweaned animal list. It creates several animals for a breeding object and tests that they are tagged as unweaned. They are then weaned and retested to be tagged as not unweaned. This test is incomplete.

class mousedb.animal.tests.BreedingViewTests(methodName='runTest')

These are tests for views based on Breeding objects. Included are tests for breeding list (active and all), details, create, update and delete pages as well as for the timed mating lists.

test_breeding_delete()

This test checks the view which displays a breeding detail page. It checks for the correct templates and status code.

test_breeding_detail()

This test checks the view which displays a breeding detail page. It checks for the correct templates and status code.

test_breeding_edit()

This test checks the view which displays a breeding edit page. It checks for the correct templates and status code.

test_breeding_list()

This test checks the view which displays a breeding list page showing active breeding cages. It checks for the correct templates and status code.

test_breeding_list_all()

This test checks the view which displays a breeding list page, for all the cages. It checks for the correct templates and status code.

test_breeding_new()

This test checks the view which displays a new breeding page. It checks for the correct templates and status code.

test_timed_mating_list()

This test checks the view which displays a breeding list page, for all the cages. It checks for the correct templates and status code.

class mousedb.animal.tests.CageViewTests(methodName='runTest')

These are tests for views based on animal objects as directed by cage urls. Included are tests for cage-list, cage-list-all and cage-detail

test_cage_detail()

This test checks the view which displays a animal list page showing all animals with a specified cage number. It checks for the correct templates and status code.

test_cage_list()

This test checks the view which displays a cage list page showing all animals. It checks for the correct templates and status code.

class mousedb.animal.tests.DateViewTests(methodName='runTest')

These are tests for views based on animal objects as directed by date based urls. Included are tests for archive-home, archive-month and archive-year

test_archive_home()

This test checks the view which displays a summary of the birthdates of animals. It checks for the correct templates and status code.

test_archive_month()

This test checks the view which displays a list of the animals, filtered by month. It checks for the correct templates and status code.

test_archive_year()

This test checks the view which displays a list of the animals, filtered by year. It checks for the correct templates and status code.

class mousedb.animal.tests.StrainModelTests(methodName='runTest')

Tests the model attributes of Strain objects contained in the animal app.

setUp()

Instantiate the test client. Creates a test user.

tearDown()

Depopulate created model instances from test database.

test_create_strain_all()

This is a test for creating a new strain object, with only all fields being entered

test_create_strain_minimal()

This is a test for creating a new strain object, with only the minimum fields being entered

test_strain_absolute_url()

This is a test for creating a new strain object, then testing absolute url.

test_strain_unicode()

This is a test for creating a new strain object, then testing the unicode representation of the strain.

class mousedb.animal.tests.StrainViewTests(methodName='runTest')

Test the views contained in the animal app relating to Strain objects.

setUp()

Instantiate the test client. Creates a test user.

tearDown()

Depopulate created model instances from test database.

test_strain_crosstype()

This tests the strain-crosstype view, ensuring that templates are loaded correctly.

This view uses a user with superuser permissions so does not test the permission levels for this view.

test_strain_delete()

This tests the strain-delete view, ensuring that templates are loaded correctly.

This view uses a user with superuser permissions so does not test the permission levels for this view.

test_strain_detail()

This tests the strain-detail view, ensuring that templates are loaded correctly.

This view uses a user with superuser permissions so does not test the permission levels for this view.

test_strain_detail_all()

This tests the strain-detail-all view, ensuring that templates are loaded correctly.

This view uses a user with superuser permissions so does not test the permission levels for this view.

test_strain_edit()

This tests the strain-edit view, ensuring that templates are loaded correctly.

This view uses a user with superuser permissions so does not test the permission levels for this view.

test_strain_list()

This tests the strain-list view, ensuring that templates are loaded correctly.

This view uses a user with superuser permissions so does not test the permission levels for this view.

test_strain_new()

This tests the strain-new view, ensuring that templates are loaded correctly.

This view uses a user with superuser permissions so does not test the permission levels for this view.

class mousedb.animal.tests.ToDoViewTests(methodName='runTest')

Tests the views associated with animal objects for the three todo lists.

setUp()

Instantiate the test client. Creates a test user.

tearDown()

Depopulate created model instances from test database.

test_eartag_list()

This test checks the view which displays an animal list page showing animals which need to be eartagged. It checks for the correct templates and status code.

test_genotype_list()

This test checks the view which displays an animal list page showing animals which need to be genotyped. It checks for the correct templates and status code.

test_no_cage_list()

This test checks the view which displays an animal list page showing animals which need to have a cage entered. It checks for the correct templates and status code.

test_no_rack_list()

This test checks the view which displays an animal list page showing animals which need to have a rack entered. It checks for the correct templates and status code.

test_todo_home()

This test checks the view which displays a summary of the todo lists. It checks for the correct templates and status code.

test_wean_list()

This test checks the view which displays an animal list page showing animals which need to be weaned. It checks for the correct templates and status code.

Animal App Utilities

Forms for use in manipulating objects in the animal app.

class mousedb.animal.forms.AnimalForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=':', empty_permitted=False, instance=None)

This modelform provides fields for modifying animal data.

This form also automatically loads javascript and css for the datepicker jquery-ui widget. It also includes auto

class mousedb.animal.forms.BreedingForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=':', empty_permitted=False, instance=None)

This form provides most fields for creating and entring breeding cage data.

This form is used from the url /mousedb/breeding/new and is a generic create view. This view includes a datepicker widget for Stat and End dates and autocomplete fields for the Females and Male fields

class mousedb.animal.forms.MultipleAnimalForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=':', empty_permitted=False, instance=None)

This modelform provides fields for entering multiple identical copies of a set of mice.

This form only includes the required fields Background and Strain.

class mousedb.animal.forms.MultipleBreedingAnimalForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=':', empty_permitted=False, instance=None)

This modelform provides fields for entering multiple pups within a breeding set.

The only fields presented are Born, Weaned, Gender and Count. Several other fields will be automatically entered based on the Breeding Set entries.

This is a configuration file for the ajax lookups for the animal app.

See http://code.google.com/p/django-ajax-selects/ for information about configuring the ajax lookups.

class mousedb.animal.lookups.AnimalLookup

This is the generic lookup for animals.

It is to be used for all animal requests and directs to the ‘animal’ channel.

format_item(animal)

the display of a currently selected object in the area below the search box. html is OK

format_result(animal)

This controls the display of the dropdown menu.

This is set to show the unicode name of the animal, as well as its Cage and its Markings.

get_objects(ids)

given a list of ids, return the objects ordered as you would like them on the admin page. this is for displaying the currently selected items (in the case of a ManyToMany field)

get_query(q, request)

This sets up the query for the lookup.

The lookup searches the MouseID or the id (database identifier) for the mouse.

class mousedb.animal.lookups.AnimalLookupFemale

This is the generic lookup for animals.

It is to be used for all animal requests and directs to the ‘animal-female’ channel.

format_item(animal)

the display of a currently selected object in the area below the search box. html is OK

format_result(animal)

This controls the display of the dropdown menu.

This is set to show the unicode name of the animal, as well as its Cage and its Markings.

get_objects(ids)

given a list of ids, return the objects ordered as you would like them on the admin page. this is for displaying the currently selected items (in the case of a ManyToMany field)

get_query(q, request)

This sets up the query for the lookup.

The lookup searches the MouseID or the id (database identifier) for the mouse. It then filters this set for only females.

class mousedb.animal.lookups.AnimalLookupMale

This is the generic lookup for animals.

It is to be used for all animal requests and directs to the ‘animal-male’ channel.

format_item(animal)

the display of a currently selected object in the area below the search box. html is OK

format_result(animal)

This controls the display of the dropdown menu.

This is set to show the unicode name of the animal, as well as its Cage and its Markings.

get_objects(ids)

given a list of ids, return the objects ordered as you would like them on the admin page. this is for displaying the currently selected items (in the case of a ManyToMany field)

get_query(q, request)

This sets up the query for the lookup.

The lookup searches the MouseID or the id (database identifier) for the mouse. It then filters this set for only males.