API Views¶
Admin¶
Factories¶
Forms¶
Species forms.
TaxonForm ¶
Bases: ModelForm
Taxon form.
Models¶
Serializers¶
Scripts¶
SpeciesCSVUpload ¶
Bases: object
Source code in django_project/species/scripts/data_upload.py
check_compulsory_fields ¶
Check if compulsory fields are empty.
Source code in django_project/species/scripts/data_upload.py
error_file ¶
Write to error file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row |
error data |
required |
Source code in django_project/species/scripts/data_upload.py
error_row ¶
Get error in row
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
error message for a row |
required |
finish ¶
Finishing the csv upload process
Source code in django_project/species/scripts/data_upload.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
population_estimate_category ¶
Save Population estimate category.
Source code in django_project/species/scripts/data_upload.py
population_status ¶
Fetch Population status.
Source code in django_project/species/scripts/data_upload.py
presence ¶
Fetch presence value.
Source code in django_project/species/scripts/data_upload.py
process_csv_dict_reader ¶
Read and process data from csv file
Source code in django_project/species/scripts/data_upload.py
process_data ¶
Processing row of csv file.
Source code in django_project/species/scripts/data_upload.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 |
|
row_value ¶
Get row value by key
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row |
row data |
required | |
key |
key |
required |
Returns:
Type | Description |
---|---|
row value |
Source code in django_project/species/scripts/data_upload.py
start ¶
Start processing the csv file from upload session
Source code in django_project/species/scripts/data_upload.py
survey_method ¶
Get survey method.
Source code in django_project/species/scripts/data_upload.py
map_string_to_value ¶
Convert a string to the value in dictionary of value_mapping.
string_to_boolean ¶
Convert a string to boolean.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
The string to convert |
required |
string_to_number ¶
Convert a string to a number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
The string to convert |
required |
Test Case¶
TaxonRankTestCase ¶
Bases: TestCase
Taxon rank test case.
TaxonSurveyMethodTestCase ¶
Bases: TestCase
Taxon survey method count test case.
setUpTestData
classmethod
¶
SetUpTestData for Taxon survey method count test case.
Source code in django_project/species/test_species_models.py
test_create_taxon_survey_method ¶
Test create Taxon survey method count.
Source code in django_project/species/test_species_models.py
test_delete_taxon_survey_method ¶
test_update_taxon_survey_method ¶
Test update Taxon survey method count.
Source code in django_project/species/test_species_models.py
TaxonTestCase ¶
Bases: TestCase
Taxon model test case.
setUpTestData
classmethod
¶
Taxon model test data.
Source code in django_project/species/test_species_models.py
test_create_taxon_no_graph_icon ¶
Test create taxon without graph icon.
Source code in django_project/species/test_species_models.py
test_delete_taxon ¶
Test delete taxon.
Source code in django_project/species/test_species_models.py
test_get_taxon_frontpage_list ¶
Test fetch taxon list for frontpage.
Source code in django_project/species/test_species_models.py
test_get_taxon_list ¶
Taxon list API test within the organisation
Source code in django_project/species/test_species_models.py
test_get_taxon_list_empty ¶
Taxon list API test when no Annual Population has been made
Source code in django_project/species/test_species_models.py
test_get_taxon_list_for_organisations ¶
Taxon list API test for organisations.
Source code in django_project/species/test_species_models.py
test_get_taxon_provincial_data_consumer ¶
Taxon list API test when user is provincial data consumer
Source code in django_project/species/test_species_models.py
test_get_taxon_provincial_data_consumer_no_organisation ¶
Taxon list API test when user is provincial data consumer and has no active organisation.
Source code in django_project/species/test_species_models.py
test_get_taxon_trend_page ¶
Test fetch taxon detil for trend page.
Source code in django_project/species/test_species_models.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
|
test_taxon_relation_to_self ¶
Test taxon relation to self.
Source code in django_project/species/test_species_models.py
test_taxon_unique_infraspecific_epithet_constraint ¶
Test taxon unique infraspecific epithet constraint.
Source code in django_project/species/test_species_models.py
test_taxon_unique_scientific_name_constraint ¶
Test taxon unique scientific name constraint.
Source code in django_project/species/test_species_models.py
test_update_taxon ¶
Test update taxon objects.
Source code in django_project/species/test_species_models.py
TestTaxonSerializer ¶
Bases: TestCase
Test Taxon Serializer
TestUploadSpeciesApiView ¶
Bases: TestCase
Test api view species uploader
test_overwrite_annual_population ¶
Test upload species multiple times to overwrite data.
Source code in django_project/species/test_api_views.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 |
|
test_save_csv_with_no_property ¶
Test save csv with not existing property.
Source code in django_project/species/test_api_views.py
test_task_string_to_boolean ¶
test_task_string_to_number ¶
test_upload_csv_task ¶
Test upload csv task.
Source code in django_project/species/test_api_views.py
test_upload_excel_invalid_area_available ¶
Test upload species with a csv file that has invalid area available to species.
Source code in django_project/species/test_api_views.py
test_upload_excel_missing_compulsory_field ¶
Test upload species with an excel file which misses a compulsory field.
Source code in django_project/species/test_api_views.py
test_upload_session ¶
Test upload species
Source code in django_project/species/test_api_views.py
test_upload_session_incorrect ¶
Test upload species with incorrect header
Source code in django_project/species/test_api_views.py
test_upload_session_no_sheet ¶
Test upload species with no sheet in excel file.
Source code in django_project/species/test_api_views.py
test_upload_species_status ¶
Test upload species status.
Source code in django_project/species/test_api_views.py
test_upload_species_status_404 ¶
Test upload species status with 404 error.
Source code in django_project/species/test_api_views.py
test_upload_species_status_empty_file ¶
Test upload with empty file.
Source code in django_project/species/test_api_views.py
test_upload_species_with_excel_property_not_exist ¶
Test upload Excel file with a property not existing.
Source code in django_project/species/test_api_views.py
test_upload_species_with_property_taxon_not_exist ¶
Test upload species task with a property and taxon not existing.
Source code in django_project/species/test_api_views.py
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
|
test_upload_species_without_login ¶
test_upload_task_with_upload_session_not_existing ¶
Test upload task with upload session not existing.
Source code in django_project/species/test_api_views.py
test_uploader_view_with_empty_compulsory_fields ¶
Test uploader file view with an empty value in compulsory field.
Source code in django_project/species/test_api_views.py
test_uploader_view_without_file ¶
Test uploader file view with no file
Source code in django_project/species/test_api_views.py
Tasks¶
upload_species_data ¶
Task for upload species file in the backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
upload_session_id |
int
|
Id of upload session model |
required |