diff --git a/README.md b/README.md index b2554b8f3..6b5e370d1 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,7 @@ Sea Turtles Database corporate application. - `wastd`: the core Django project directory, containing common settings, configuration and templates. - `observations`: the primary data model for the project, defining the `Encounter` and `Observation` models and subclasses. - `users`: an extension of the Django `contrib.auth.models.User` class, customised for this project. -- `wamtram`: auto-generated model classes to provide readonly ORM utility for the legacy WAMTRAM database. -- `tagging`: an "interim" application to save data from the WAMTRAM database locally, prior to a future refactor of that data model into the `observations` application. +- `wamtram2`: auto-generated model classes to provide readonly ORM utility for the legacy WAMTRAM database. The intent is for this project to replace the WAMTRAM legacy project and to act as the repository for turtle tagging data. The `wamtram` application was created to ease access to the legacy database, and diff --git a/poetry.lock b/poetry.lock index 2f548c149..9fb678a5f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -13,13 +13,13 @@ files = [ [[package]] name = "asgiref" -version = "3.7.2" +version = "3.8.1" description = "ASGI specs, helper code, and adapters" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "asgiref-3.7.2-py3-none-any.whl", hash = "sha256:89b2ef2247e3b562a16eef663bc0e2e703ec6468e2fa8a5cd61cd449786d4f6e"}, - {file = "asgiref-3.7.2.tar.gz", hash = "sha256:9e0ce3aa93a819ba5b45120216b23878cf6e8525eb3848653452b4192b92afed"}, + {file = "asgiref-3.8.1-py3-none-any.whl", hash = "sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47"}, + {file = "asgiref-3.8.1.tar.gz", hash = "sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590"}, ] [package.extras] @@ -119,34 +119,45 @@ lxml = ["lxml"] [[package]] name = "black" -version = "22.12.0" +version = "24.3.0" description = "The uncompromising code formatter." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, - {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, - {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, - {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, - {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, - {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, - {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, - {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, - {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, - {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, - {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, - {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, + {file = "black-24.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7d5e026f8da0322b5662fa7a8e752b3fa2dac1c1cbc213c3d7ff9bdd0ab12395"}, + {file = "black-24.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9f50ea1132e2189d8dff0115ab75b65590a3e97de1e143795adb4ce317934995"}, + {file = "black-24.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2af80566f43c85f5797365077fb64a393861a3730bd110971ab7a0c94e873e7"}, + {file = "black-24.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:4be5bb28e090456adfc1255e03967fb67ca846a03be7aadf6249096100ee32d0"}, + {file = "black-24.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4f1373a7808a8f135b774039f61d59e4be7eb56b2513d3d2f02a8b9365b8a8a9"}, + {file = "black-24.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:aadf7a02d947936ee418777e0247ea114f78aff0d0959461057cae8a04f20597"}, + {file = "black-24.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c02e4ea2ae09d16314d30912a58ada9a5c4fdfedf9512d23326128ac08ac3d"}, + {file = "black-24.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:bf21b7b230718a5f08bd32d5e4f1db7fc8788345c8aea1d155fc17852b3410f5"}, + {file = "black-24.3.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:2818cf72dfd5d289e48f37ccfa08b460bf469e67fb7c4abb07edc2e9f16fb63f"}, + {file = "black-24.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4acf672def7eb1725f41f38bf6bf425c8237248bb0804faa3965c036f7672d11"}, + {file = "black-24.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c7ed6668cbbfcd231fa0dc1b137d3e40c04c7f786e626b405c62bcd5db5857e4"}, + {file = "black-24.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:56f52cfbd3dabe2798d76dbdd299faa046a901041faf2cf33288bc4e6dae57b5"}, + {file = "black-24.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:79dcf34b33e38ed1b17434693763301d7ccbd1c5860674a8f871bd15139e7837"}, + {file = "black-24.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e19cb1c6365fd6dc38a6eae2dcb691d7d83935c10215aef8e6c38edee3f77abd"}, + {file = "black-24.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65b76c275e4c1c5ce6e9870911384bff5ca31ab63d19c76811cb1fb162678213"}, + {file = "black-24.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:b5991d523eee14756f3c8d5df5231550ae8993e2286b8014e2fdea7156ed0959"}, + {file = "black-24.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c45f8dff244b3c431b36e3224b6be4a127c6aca780853574c00faf99258041eb"}, + {file = "black-24.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6905238a754ceb7788a73f02b45637d820b2f5478b20fec82ea865e4f5d4d9f7"}, + {file = "black-24.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7de8d330763c66663661a1ffd432274a2f92f07feeddd89ffd085b5744f85e7"}, + {file = "black-24.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:7bb041dca0d784697af4646d3b62ba4a6b028276ae878e53f6b4f74ddd6db99f"}, + {file = "black-24.3.0-py3-none-any.whl", hash = "sha256:41622020d7120e01d377f74249e677039d20e6344ff5851de8a10f11f513bf93"}, + {file = "black-24.3.0.tar.gz", hash = "sha256:a0c9c4a0771afc6919578cec71ce82a3e31e054904e7197deacbc9382671c41f"}, ] [package.dependencies] click = ">=8.0.0" mypy-extensions = ">=0.4.3" +packaging = ">=22.0" pathspec = ">=0.9.0" platformdirs = ">=2" [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] @@ -583,13 +594,13 @@ typing-extensions = ">=3.10.0.0" [[package]] name = "django" -version = "4.2.10" +version = "4.2.11" description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design." optional = false python-versions = ">=3.8" files = [ - {file = "Django-4.2.10-py3-none-any.whl", hash = "sha256:a2d4c4d4ea0b6f0895acde632071aff6400bfc331228fc978b05452a0ff3e9f1"}, - {file = "Django-4.2.10.tar.gz", hash = "sha256:b1260ed381b10a11753c73444408e19869f3241fc45c985cd55a30177c789d13"}, + {file = "Django-4.2.11-py3-none-any.whl", hash = "sha256:ddc24a0a8280a0430baa37aff11f28574720af05888c62b7cfe71d219f4599d3"}, + {file = "Django-4.2.11.tar.gz", hash = "sha256:6e6ff3db2d8dd0c986b4eec8554c8e4f919b5c1ff62a5b4390c17aff2ed6e5c4"}, ] [package.dependencies] @@ -1561,13 +1572,13 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest- [[package]] name = "pre-commit" -version = "3.6.2" +version = "3.7.0" description = "A framework for managing and maintaining multi-language pre-commit hooks." optional = false python-versions = ">=3.9" files = [ - {file = "pre_commit-3.6.2-py2.py3-none-any.whl", hash = "sha256:ba637c2d7a670c10daedc059f5c49b5bd0aadbccfcd7ec15592cf9665117532c"}, - {file = "pre_commit-3.6.2.tar.gz", hash = "sha256:c3ef34f463045c88658c5b99f38c1e297abdcc0ff13f98d3370055fbbfabc67e"}, + {file = "pre_commit-3.7.0-py2.py3-none-any.whl", hash = "sha256:5eae9e10c2b5ac51577c3452ec0a490455c45a0533f7960f993a0d01e59decab"}, + {file = "pre_commit-3.7.0.tar.gz", hash = "sha256:e209d61b8acdcf742404408531f0c37d49d2c734fd7cff2d6076083d191cb060"}, ] [package.dependencies] @@ -1846,28 +1857,28 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "ruff" -version = "0.0.285" -description = "An extremely fast Python linter, written in Rust." +version = "0.3.4" +description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.0.285-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:72a3a0936369b986b0e959f9090206ed3c18f9e5e439ea5b8e6867c6707aded5"}, - {file = "ruff-0.0.285-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:0d9ab6ad16742eb78919e0fba09f914f042409df40ad63423c34bb20d350162a"}, - {file = "ruff-0.0.285-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c48926156288b8ac005eb1db5e77c15e8a37309ae49d9fb6771d5cf5f777590"}, - {file = "ruff-0.0.285-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1d2a60c102e7a5e147b58fc2cbea12a563c565383effc527c987ea2086a05742"}, - {file = "ruff-0.0.285-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b02aae62f922d088bb01943e1dbd861688ada13d735b78b8348a7d90121fd292"}, - {file = "ruff-0.0.285-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f572c4296d8c7ddd22c3204de4031965be524fdd1fdaaef273945932912b28c5"}, - {file = "ruff-0.0.285-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:80effdf4fe69763d69eb4ab9443e186fd09e668b59fe70ba4b49f4c077d15a1b"}, - {file = "ruff-0.0.285-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5977ce304da35c263f5e082901bd7ac0bd2be845a8fcfd1a29e4d6680cddb307"}, - {file = "ruff-0.0.285-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72a087712d474fa17b915d7cb9ef807e1256182b12ddfafb105eb00aeee48d1a"}, - {file = "ruff-0.0.285-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:7ce67736cd8dfe97162d1e7adfc2d9a1bac0efb9aaaff32e4042c7cde079f54b"}, - {file = "ruff-0.0.285-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:5473a4c6cac34f583bff08c5f63b8def5599a0ea4dc96c0302fbd2cc0b3ecbad"}, - {file = "ruff-0.0.285-py3-none-musllinux_1_2_i686.whl", hash = "sha256:e6b1c961d608d373a032f047a20bf3c55ad05f56c32e7b96dcca0830a2a72348"}, - {file = "ruff-0.0.285-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:2933cc9631f453305399c7b8fb72b113ad76b49ae1d7103cc4afd3a423bed164"}, - {file = "ruff-0.0.285-py3-none-win32.whl", hash = "sha256:770c5eb6376de024111443022cda534fb28980a9dd3b4abc83992a8770167ba6"}, - {file = "ruff-0.0.285-py3-none-win_amd64.whl", hash = "sha256:a8c6ad6b9cd77489bf6d1510950cbbe47a843aa234adff0960bae64bd06c3b6d"}, - {file = "ruff-0.0.285-py3-none-win_arm64.whl", hash = "sha256:de44fbc6c3b25fccee473ddf851416fd4e246fc6027b2197c395b1b3b3897921"}, - {file = "ruff-0.0.285.tar.gz", hash = "sha256:45866048d1dcdcc80855998cb26c4b2b05881f9e043d2e3bfe1aa36d9a2e8f28"}, + {file = "ruff-0.3.4-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:60c870a7d46efcbc8385d27ec07fe534ac32f3b251e4fc44b3cbfd9e09609ef4"}, + {file = "ruff-0.3.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:6fc14fa742e1d8f24910e1fff0bd5e26d395b0e0e04cc1b15c7c5e5fe5b4af91"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d3ee7880f653cc03749a3bfea720cf2a192e4f884925b0cf7eecce82f0ce5854"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cf133dd744f2470b347f602452a88e70dadfbe0fcfb5fd46e093d55da65f82f7"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3f3860057590e810c7ffea75669bdc6927bfd91e29b4baa9258fd48b540a4365"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:986f2377f7cf12efac1f515fc1a5b753c000ed1e0a6de96747cdf2da20a1b369"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c4fd98e85869603e65f554fdc5cddf0712e352fe6e61d29d5a6fe087ec82b76c"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:64abeed785dad51801b423fa51840b1764b35d6c461ea8caef9cf9e5e5ab34d9"}, + {file = "ruff-0.3.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df52972138318bc7546d92348a1ee58449bc3f9eaf0db278906eb511889c4b50"}, + {file = "ruff-0.3.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:98e98300056445ba2cc27d0b325fd044dc17fcc38e4e4d2c7711585bd0a958ed"}, + {file = "ruff-0.3.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:519cf6a0ebed244dce1dc8aecd3dc99add7a2ee15bb68cf19588bb5bf58e0488"}, + {file = "ruff-0.3.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:bb0acfb921030d00070539c038cd24bb1df73a2981e9f55942514af8b17be94e"}, + {file = "ruff-0.3.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:cf187a7e7098233d0d0c71175375c5162f880126c4c716fa28a8ac418dcf3378"}, + {file = "ruff-0.3.4-py3-none-win32.whl", hash = "sha256:af27ac187c0a331e8ef91d84bf1c3c6a5dea97e912a7560ac0cef25c526a4102"}, + {file = "ruff-0.3.4-py3-none-win_amd64.whl", hash = "sha256:de0d5069b165e5a32b3c6ffbb81c350b1e3d3483347196ffdf86dc0ef9e37dd6"}, + {file = "ruff-0.3.4-py3-none-win_arm64.whl", hash = "sha256:6810563cc08ad0096b57c717bd78aeac888a1bfd38654d9113cb3dc4d3f74232"}, + {file = "ruff-0.3.4.tar.gz", hash = "sha256:f0f4484c6541a99862b693e13a151435a279b271cff20e37101116a21e2a1ad1"}, ] [[package]] @@ -2336,4 +2347,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "4d0eddae2382aa535f3da6e7c7193d172a27b1c683c52e8989d408298683bda6" +content-hash = "1b1c8720e9a5ea43768962bed39362947e8aa02543f2898ec5c15606623d9a6b" diff --git a/pyproject.toml b/pyproject.toml index 166be3318..24e418fda 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.11" -django = "4.2.10" +django = "4.2.11" django-extensions = "3.2.3" psycopg2 = "2.9.9" dj-database-url = "2.1.0" @@ -46,14 +46,14 @@ django-easy-select2 = "1.5.8" sentry-sdk = {version = "1.42.0", extras = ["django"]} [tool.poetry.group.dev.dependencies] -ipython = "^8.21.0" -ipdb = "^0.13.9" -black = "^22.10.0" -ruff = "^0.0.285" +ipython = "^8.22.2" +ipdb = "^0.13.13" +black = "^24.3.0" +ruff = "^0.3.3" sphinx = "^7.0.1" vulture = "^2.7" django-debug-toolbar = "^4.2.0" -pre-commit = "^3.6.1" +pre-commit = "^3.6.2" [build-system] requires = ["poetry-core"] diff --git a/wamtram2/models.py b/wamtram2/models.py index f83321b27..f345b00d5 100644 --- a/wamtram2/models.py +++ b/wamtram2/models.py @@ -1,842 +1,2008 @@ from django.contrib.gis.db import models -from datetime import datetime + class TrtActivities(models.Model): - activity_code = models.CharField(db_column='ACTIVITY_CODE', primary_key=True, max_length=1) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. - nesting = models.CharField(db_column='NESTING', max_length=50) # Field name made lowercase. - new_code = models.CharField(db_column='New_Code', max_length=255, blank=True, null=True) # Field name made lowercase. - display_observation = models.BooleanField(db_column='Display_Observation') # Field name made lowercase. + activity_code = models.CharField( + db_column="ACTIVITY_CODE", primary_key=True, max_length=1 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. + nesting = models.CharField( + db_column="NESTING", max_length=50 + ) # Field name made lowercase. + new_code = models.CharField( + db_column="New_Code", max_length=255, blank=True, null=True + ) # Field name made lowercase. + display_observation = models.BooleanField( + db_column="Display_Observation" + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_ACTIVITIES' + db_table = "TRT_ACTIVITIES" + def __str__(self): return f"{self.description}" + class TrtBeachPositions(models.Model): - beach_position_code = models.CharField(db_column='BEACH_POSITION_CODE', primary_key=True, max_length=2) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. - new_code = models.CharField(db_column='New_Code', max_length=255, blank=True, null=True) # Field name made lowercase. + beach_position_code = models.CharField( + db_column="BEACH_POSITION_CODE", primary_key=True, max_length=2 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. + new_code = models.CharField( + db_column="New_Code", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_BEACH_POSITIONS' + db_table = "TRT_BEACH_POSITIONS" class TrtBodyParts(models.Model): - body_part = models.CharField(db_column='BODY_PART', primary_key=True, max_length=1) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. - flipper = models.BooleanField(db_column='FLIPPER') # Field name made lowercase. + body_part = models.CharField( + db_column="BODY_PART", primary_key=True, max_length=1 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. + flipper = models.BooleanField(db_column="FLIPPER") # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_BODY_PARTS' + db_table = "TRT_BODY_PARTS" + def __str__(self): return f"{self.description}" + class TrtCauseOfDeath(models.Model): - cause_of_death = models.CharField(db_column='CAUSE_OF_DEATH', primary_key=True, max_length=2) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. + cause_of_death = models.CharField( + db_column="CAUSE_OF_DEATH", primary_key=True, max_length=2 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_CAUSE_OF_DEATH' + db_table = "TRT_CAUSE_OF_DEATH" class TrtConditionCodes(models.Model): - condition_code = models.CharField(db_column='CONDITION_CODE', primary_key=True, max_length=1) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. + condition_code = models.CharField( + db_column="CONDITION_CODE", primary_key=True, max_length=1 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_CONDITION_CODES' + db_table = "TRT_CONDITION_CODES" + def __str__(self): return f"{self.description}" + class TrtDamage(models.Model): - observation = models.OneToOneField('TrtObservations', models.CASCADE, db_column='OBSERVATION_ID', primary_key=True) # Field name made lowercase. - body_part = models.ForeignKey(TrtBodyParts, models.CASCADE, db_column='BODY_PART') # Field name made lowercase. - damage_code = models.ForeignKey('TrtDamageCodes', models.CASCADE, db_column='DAMAGE_CODE') # Field name made lowercase. - damage_cause_code = models.ForeignKey('TrtDamageCauseCodes', models.SET_NULL, db_column='DAMAGE_CAUSE_CODE', blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. + observation = models.OneToOneField( + "TrtObservations", models.CASCADE, db_column="OBSERVATION_ID", primary_key=True + ) # Field name made lowercase. + body_part = models.ForeignKey( + TrtBodyParts, models.CASCADE, db_column="BODY_PART" + ) # Field name made lowercase. + damage_code = models.ForeignKey( + "TrtDamageCodes", models.CASCADE, db_column="DAMAGE_CODE" + ) # Field name made lowercase. + damage_cause_code = models.ForeignKey( + "TrtDamageCauseCodes", + models.SET_NULL, + db_column="DAMAGE_CAUSE_CODE", + blank=True, + null=True, + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DAMAGE' - unique_together = (('observation', 'body_part', 'body_part'),) + db_table = "TRT_DAMAGE" + unique_together = (("observation", "body_part", "body_part"),) class TrtDamageCause(models.Model): - observation_id = models.IntegerField(db_column='OBSERVATION_ID') # Field name made lowercase. - body_part = models.CharField(db_column='BODY_PART', max_length=1) # Field name made lowercase. - damage_code = models.CharField(db_column='DAMAGE_CODE', max_length=1) # Field name made lowercase. - damage_cause_code = models.CharField(db_column='DAMAGE_CAUSE_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. + observation_id = models.IntegerField( + db_column="OBSERVATION_ID" + ) # Field name made lowercase. + body_part = models.CharField( + db_column="BODY_PART", max_length=1 + ) # Field name made lowercase. + damage_code = models.CharField( + db_column="DAMAGE_CODE", max_length=1 + ) # Field name made lowercase. + damage_cause_code = models.CharField( + db_column="DAMAGE_CAUSE_CODE", max_length=2, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DAMAGE_CAUSE' + db_table = "TRT_DAMAGE_CAUSE" class TrtDamageCauseCodes(models.Model): - damage_cause_code = models.CharField(db_column='DAMAGE_CAUSE_CODE', primary_key=True, max_length=2) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. + damage_cause_code = models.CharField( + db_column="DAMAGE_CAUSE_CODE", primary_key=True, max_length=2 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DAMAGE_CAUSE_CODES' + db_table = "TRT_DAMAGE_CAUSE_CODES" + def __str__(self): return f"{self.description}" + class TrtDamageCodes(models.Model): - damage_code = models.CharField(db_column='DAMAGE_CODE', primary_key=True, max_length=1) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. - flipper = models.BooleanField(db_column='FLIPPER') # Field name made lowercase. + damage_code = models.CharField( + db_column="DAMAGE_CODE", primary_key=True, max_length=1 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. + flipper = models.BooleanField(db_column="FLIPPER") # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DAMAGE_CODES' + db_table = "TRT_DAMAGE_CODES" + def __str__(self): return f"{self.description}" + class TrtDataChanged(models.Model): """ Used to store data entries while they are being edited and validated. When processed using the sql stored procedure, the data is copied to the database """ - trt_data_changed_id = models.AutoField(db_column='TRT_DATA_CHANGED_ID', primary_key=True) # Field name made lowercase. - datachanged_date = models.DateTimeField(db_column='DATACHANGED_DATE', blank=True, null=True) # Field name made lowercase. - datachangedby = models.CharField(db_column='DATACHANGEDBY', max_length=255, blank=True, null=True) # Field name made lowercase. - comment = models.CharField(db_column='COMMENT', max_length=255, blank=True, null=True) # Field name made lowercase. + + trt_data_changed_id = models.AutoField( + db_column="TRT_DATA_CHANGED_ID", primary_key=True + ) # Field name made lowercase. + datachanged_date = models.DateTimeField( + db_column="DATACHANGED_DATE", blank=True, null=True + ) # Field name made lowercase. + datachangedby = models.CharField( + db_column="DATACHANGEDBY", max_length=255, blank=True, null=True + ) # Field name made lowercase. + comment = models.CharField( + db_column="COMMENT", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DATA_CHANGED' + db_table = "TRT_DATA_CHANGED" + -from django.db.models import DEFERRED class TrtDataEntry(models.Model): SEX_CHOICES = [ - ("M","Male"), - ("F","Female"), - ("I","Indeterminate"), + ("M", "Male"), + ("F", "Female"), + ("I", "Indeterminate"), ] - data_entry_id = models.AutoField(db_column='DATA_ENTRY_ID', primary_key=True) # Field name made lowercase. - entry_batch = models.ForeignKey('TrtEntryBatches', models.CASCADE, db_column='ENTRY_BATCH_ID') # Field name made lowercase. - user_entry_id = models.IntegerField(db_column='USER_ENTRY_ID', blank=True,null=True) # Field name made lowercase. - turtle_id = models.ForeignKey('TrtTurtles', models.SET_NULL, db_column='TURTLE_ID', blank=True, null=True) #fake foreign key #models.IntegerField(db_column='TURTLE_ID', blank=True, null=True) # Field name made lowercase. - observation_id = models.ForeignKey('TrtObservations', models.SET_NULL, db_column='OBSERVATION_ID', blank=True, null=True) #fake foreign key #models.IntegerField(db_column='OBSERVATION_ID', blank=True, null=True) # Field name made lowercase. - do_not_process = models.BooleanField(db_column='DO_NOT_PROCESS') # Field name made lowercase. - recapture_left_tag_id = models.ForeignKey('TrtTags',models.SET_NULL, db_column='RECAPTURE_LEFT_TAG_ID', blank=True, null=True,related_name='recapturelefttag') #fake foreign key #models.CharField(db_column='RECAPTURE_LEFT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. - recapture_left_tag_id_2 = models.ForeignKey('TrtTags',models.SET_NULL, db_column='RECAPTURE_LEFT_TAG_ID_2', blank=True, null=True,related_name='recapturelefttag2') #fake foreign key #models.CharField(db_column='RECAPTURE_LEFT_TAG_ID_2', max_length=10, blank=True, null=True) # Field name made lowercase. - recapture_right_tag_id = models.ForeignKey('TrtTags',models.SET_NULL, db_column='RECAPTURE_RIGHT_TAG_ID', blank=True, null=True,related_name='recapturerighttag') #fake foreign key #models.CharField(db_column='RECAPTURE_RIGHT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. - recapture_right_tag_id_2 = models.ForeignKey('TrtTags',models.SET_NULL, db_column='RECAPTURE_RIGHT_TAG_ID_2', blank=True, null=True,related_name='recapturerighttag2') #fake foreign key #models.CharField(db_column='RECAPTURE_RIGHT_TAG_ID_2', max_length=10, blank=True, null=True) # Field name made lowercase. - recapture_pittag_id = models.ForeignKey('TrtPitTags',models.SET_NULL, db_column='RECAPTURE_PIT_TAG_ID', blank=True, null=True,related_name='recapturepittag') #fake foreign key for left pit tag #models.CharField(db_column='recapture_pittag_id', max_length=50, blank=True, null=True) # Field name made lowercase. - other_left_tag = models.CharField(db_column='OTHER_LEFT_TAG', max_length=2, blank=True, null=True) # Field name made lowercase. - other_right_tag = models.CharField(db_column='OTHER_RIGHT_TAG', max_length=2, blank=True, null=True) # Field name made lowercase. - new_left_tag_id = models.ForeignKey('TrtTags',models.SET_NULL, db_column='NEW_LEFT_TAG_ID', blank=True, null=True,related_name='lefttag') #fake foreign key #models.CharField(db_column='NEW_LEFT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. - new_left_tag_id_2 = models.ForeignKey('TrtTags',models.SET_NULL, db_column='NEW_LEFT_TAG_ID_2', blank=True, null=True,related_name="lefttag2") #fake foreign key #models.CharField(db_column='NEW_LEFT_TAG_ID_2', max_length=10, blank=True, null=True) # Field name made lowercase. - new_right_tag_id = models.ForeignKey('TrtTags',models.SET_NULL, db_column='NEW_RIGHT_TAG_ID', blank=True, null=True,related_name="righttag") #fake foreign key #models.CharField(db_column='NEW_RIGHT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. - new_right_tag_id_2 = models.ForeignKey('TrtTags',models.SET_NULL, db_column='NEW_RIGHT_TAG_ID_2', blank=True, null=True, related_name="righttag2") #fake foreign key #models.CharField(db_column='NEW_RIGHT_TAG_ID_2', max_length=10, blank=True, null=True) # Field name made lowercase. - new_pittag_id = models.ForeignKey('TrtPitTags',models.SET_NULL, db_column='NEW_PIT_TAG_ID', blank=True, null=True) #fake foreign key for left pit tag #models.CharField(db_column='NEW_pittag_id', max_length=50, blank=True, null=True) # Field name made lowercase. - alive = models.ForeignKey('TrtYesNo',models.SET_NULL, db_column='ALIVE', blank=True, null=True,related_name="nesting") #fake foreign key #models.CharField(db_column='ALIVE', max_length=1, blank=True, null=True) # Field name made lowercase. - place_code = models.ForeignKey('TrtPlaces',models.SET_NULL, db_column='PLACE_CODE', blank=True, null=True) #fake foreign key $models.CharField(db_column='PLACE_CODE', max_length=4, blank=True, null=True) # Field name made lowercase. - observation_date = models.DateTimeField(db_column='OBSERVATION_DATE', blank=True, null=True) # Field name made lowercase. - observation_time = models.DateTimeField(db_column='OBSERVATION_TIME', blank=True, null=True) # Field name made lowercase. - nesting = models.ForeignKey('TrtYesNo',models.SET_NULL, db_column='NESTING', blank=True, null=True) #fake foreign key #models.CharField(db_column='NESTING', max_length=1, blank=True, null=True) # Field name made lowercase. - species_code = models.ForeignKey('TrtSpecies',models.SET_NULL, db_column='SPECIES_CODE', blank=True, null=True) #fake foreign key #models.CharField(db_column='SPECIES_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. - identification_confidence = models.CharField(db_column='IDENTIFICATION_CONFIDENCE', max_length=1, blank=True, null=True) # Field name made lowercase. - sex = models.CharField(db_column='SEX', max_length=1, blank=True, null=True,choices=SEX_CHOICES) # Field name made lowercase. - curved_carapace_length = models.IntegerField(db_column='CURVED_CARAPACE_LENGTH', blank=True, null=True) # Field name made lowercase. - curved_carapace_width = models.IntegerField(db_column='CURVED_CARAPACE_WIDTH', blank=True, null=True) # Field name made lowercase. - activity_code = models.ForeignKey('TrtActivities',models.SET_NULL, db_column='ACTIVITY_CODE', blank=True, null=True) #fake foreign key #models.CharField(db_column='ACTIVITY_CODE', max_length=1, blank=True, null=True) # Field name made lowercase. - beach_position_code = models.CharField(db_column='BEACH_POSITION_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. - damage_carapace = models.ForeignKey('TrtDamageCodes',models.SET_NULL, db_column='DAMAGE_CARAPACE', blank=True, null=True, related_name="carapace") #fake foreign key #models.CharField(db_column='DAMAGE_CARAPACE', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_lff = models.ForeignKey('TrtDamageCodes',models.SET_NULL, db_column='DAMAGE_LFF', blank=True, null=True, related_name="lff") #fake foreign key #models.CharField(db_column='DAMAGE_LFF', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_rff = models.ForeignKey('TrtDamageCodes',models.SET_NULL, db_column='DAMAGE_RFF', blank=True, null=True, related_name="rff") #fake foreign key #models.CharField(db_column='DAMAGE_RFF', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_lhf = models.ForeignKey('TrtDamageCodes',models.SET_NULL, db_column='DAMAGE_LHF', blank=True, null=True, related_name="lhf") #fake foreign key #models.CharField(db_column='DAMAGE_LHF', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_rhf = models.ForeignKey('TrtDamageCodes',models.SET_NULL, db_column='DAMAGE_RHF', blank=True, null=True, related_name="rhf") #fake foreign key #models.CharField(db_column='DAMAGE_RHF', max_length=1, blank=True, null=True) # Field name made lowercase. - body_part_1 = models.ForeignKey('TrtBodyParts',models.SET_NULL, db_column='BODY_PART_1', blank=True, null=True, related_name="bp1") #fake foreign key #models.CharField(db_column='BODY_PART_1', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_code_1 = models.ForeignKey('TrtDamageCodes',models.SET_NULL, db_column='DAMAGE_CODE_1', blank=True, null=True, related_name="dc1") #fake foreign key #models.CharField(db_column='DAMAGE_CODE_1', max_length=1, blank=True, null=True) # Field name made lowercase. - body_part_2 = models.ForeignKey('TrtBodyParts',models.SET_NULL, db_column='BODY_PART_2', blank=True, null=True, related_name="bp2") #fake foreign key #models.CharField(db_column='BODY_PART_2', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_code_2 = models.ForeignKey('TrtDamageCodes',models.SET_NULL, db_column='DAMAGE_CODE_2', blank=True, null=True, related_name="dc2") #fake foreign key #models.CharField(db_column='DAMAGE_CODE_2', max_length=1, blank=True, null=True) # Field name made lowercase. - egg_count = models.IntegerField(db_column='EGG_COUNT', blank=True, null=True) # Field name made lowercase. - egg_count_method = models.CharField(db_column='EGG_COUNT_METHOD', max_length=3, blank=True, null=True) # Field name made lowercase. - clutch_completed = models.CharField(db_column='CLUTCH_COMPLETED', max_length=1, blank=True, null=True) # Field name made lowercase. - measured_by = models.CharField(db_column='MEASURED_BY', max_length=50, blank=True, null=True) # Field name made lowercase. Used by old MSAccess frontend - measured_by_id = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='MEASURED_BY_ID', blank=True, null=True,related_name='measuredby') - recorded_by = models.CharField(db_column='RECORDED_BY', max_length=50, blank=True, null=True) # Field name made lowercase.Used by old MSAccess frontend - recorded_by_id = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='RECORDED_BY_ID', blank=True, null=True, related_name='recordedby') - tagged_by = models.CharField(db_column='TAGGED_BY', max_length=50, blank=True, null=True) # Field name made lowercase.Used by old MSAccess frontend - tagged_by_id = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='TAGGED_BY_ID', blank=True, null=True,related_name='taggedby') - entered_by = models.CharField(db_column='ENTERED_BY', max_length=50, blank=True, null=True) # Field name made lowercase.Used by old MSAccess frontend - entered_by_id = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='ENTERED_BY_ID', blank=True, null=True, related_name='enteredby') - measured_recorded_by = models.CharField(db_column='MEASURED_RECORDED_BY', max_length=50, blank=True, null=True) # Field name made lowercase. - measured_recorded_by_id = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='MEASURED_RECORDED_BY_ID', blank=True, null=True, related_name='measuredrecordedby') - measurement_type_1 = models.ForeignKey('TrtMeasurementTypes',models.SET_NULL, db_column='MEASUREMENT_TYPE_1', blank=True, null=True,related_name="measuretype1") #fake foreign key #models.CharField(db_column='MEASUREMENT_TYPE_1', max_length=10, blank=True, null=True) # Field name made lowercase. - measurement_value_1 = models.FloatField(db_column='MEASUREMENT_VALUE_1', blank=True, null=True) # Field name made lowercase. - measurement_type_2 = models.ForeignKey('TrtMeasurementTypes',models.SET_NULL, db_column='MEASUREMENT_TYPE_2', blank=True, null=True,related_name="measuretype2") #fake foreign key #models.CharField(db_column='MEASUREMENT_TYPE_2', max_length=10, blank=True, null=True) # Field name made lowercase. - measurement_value_2 = models.FloatField(db_column='MEASUREMENT_VALUE_2', blank=True, null=True) # Field name made lowercase. - datum_code = models.CharField(db_column='DATUM_CODE', max_length=5, blank=True, null=True) # Field name made lowercase. - zone = models.IntegerField(db_column='ZONE', blank=True, null=True) # Field name made lowercase. - easting = models.FloatField(db_column='EASTING', blank=True, null=True) # Field name made lowercase. - northing = models.FloatField(db_column='NORTHING', blank=True, null=True) # Field name made lowercase. - latitude = models.FloatField(db_column='LATITUDE', blank=True, null=True) # Field name made lowercase. - longitude = models.FloatField(db_column='LONGITUDE', blank=True, null=True) # Field name made lowercase. - latitude_degrees = models.IntegerField(db_column='LATITUDE_DEGREES', blank=True, null=True) # Field name made lowercase. - latitude_minutes = models.FloatField(db_column='LATITUDE_MINUTES', blank=True, null=True) # Field name made lowercase. - latitude_seconds = models.FloatField(db_column='LATITUDE_SECONDS', blank=True, null=True) # Field name made lowercase. - longitude_degrees = models.IntegerField(db_column='LONGITUDE_DEGREES', blank=True, null=True) # Field name made lowercase. - longitude_minutes = models.FloatField(db_column='LONGITUDE_MINUTES', blank=True, null=True) # Field name made lowercase. - longitude_seconds = models.FloatField(db_column='LONGITUDE_SECONDS', blank=True, null=True) # Field name made lowercase. - identification_type = models.CharField(db_column='IDENTIFICATION_TYPE', max_length=10, blank=True, null=True) # Field name made lowercase. - identifier = models.CharField(db_column='IDENTIFIER', max_length=20, blank=True, null=True) # Field name made lowercase. - comment_fromrecordedtagstable = models.CharField(db_column='COMMENT_FROMRECORDEDTAGSTABLE', max_length=255, blank=True, null=True) # Field name made lowercase. - scars_left = models.BooleanField(db_column='SCARS_LEFT') # Field name made lowercase. - scars_right = models.BooleanField(db_column='SCARS_RIGHT') # Field name made lowercase. - other_tags = models.CharField(db_column='OTHER_TAGS', max_length=255, blank=True, null=True) # Field name made lowercase. - other_tags_identification_type = models.CharField(db_column='OTHER_TAGS_IDENTIFICATION_TYPE', max_length=10, blank=True, null=True) # Field name made lowercase. - scars_left_scale_1 = models.BooleanField(db_column='SCARS_LEFT_SCALE_1') # Field name made lowercase. - scars_left_scale_2 = models.BooleanField(db_column='SCARS_LEFT_SCALE_2') # Field name made lowercase. - scars_left_scale_3 = models.BooleanField(db_column='SCARS_LEFT_SCALE_3') # Field name made lowercase. - scars_right_scale_1 = models.BooleanField(db_column='SCARS_RIGHT_SCALE_1') # Field name made lowercase. - scars_right_scale_2 = models.BooleanField(db_column='SCARS_RIGHT_SCALE_2') # Field name made lowercase. - scars_right_scale_3 = models.BooleanField(db_column='SCARS_RIGHT_SCALE_3') # Field name made lowercase. - cc_length_not_measured = models.BooleanField(db_column='CC_LENGTH_NOT_MEASURED') # Field name made lowercase. - cc_notch_length_not_measured = models.BooleanField(db_column='CC_NOTCH_LENGTH_NOT_MEASURED') # Field name made lowercase. - cc_width_not_measured = models.BooleanField(db_column='CC_WIDTH_NOT_MEASURED') # Field name made lowercase. - tagscarnotchecked = models.BooleanField(db_column='TAGSCARNOTCHECKED') # Field name made lowercase. - didnotcheckforinjury = models.BooleanField(db_column='DIDNOTCHECKFORINJURY') # Field name made lowercase. - comments = models.TextField(db_column='COMMENTS', blank=True, null=True) # Field name made lowercase. - error_number = models.IntegerField(db_column='ERROR_NUMBER', blank=True, null=True) # Field name made lowercase. - error_message = models.CharField(db_column='ERROR_MESSAGE', max_length=255, blank=True, null=True) # Field name made lowercase. - recapture_left_tag_id_3 = models.ForeignKey('TrtTags',models.SET_NULL, db_column='RECAPTURE_LEFT_TAG_ID_3', blank=True, null=True,related_name='recapturelefttag3') #fake foreign key #models.CharField(db_column='RECAPTURE_LEFT_TAG_ID_3', max_length=10, blank=True, null=True) # Field name made lowercase. - recapture_right_tag_id_3 = models.ForeignKey('TrtTags',models.SET_NULL, db_column='RECAPTURE_RIGHT_TAG_ID_3', blank=True, null=True,related_name='recapturerighttag3') #fake foreign key #models.CharField(db_column='RECAPTURE_RIGHT_TAG_ID_3', max_length=10, blank=True, null=True) # Field name made lowercase. - body_part_3 = models.CharField(db_column='BODY_PART_3', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_code_3 = models.CharField(db_column='DAMAGE_CODE_3', max_length=1, blank=True, null=True) # Field name made lowercase. - tissue_type_1 = models.ForeignKey('TrtTissueTypes',models.SET_NULL, db_column='TISSUE_TYPE_1', blank=True, null=True,related_name='tt1') #fake foreign key #models.CharField(db_column='TISSUE_TYPE_1', max_length=5, blank=True, null=True) # Field name made lowercase. - sample_label_1 = models.CharField(db_column='SAMPLE_LABEL_1', max_length=50, blank=True, null=True) # Field name made lowercase. - tissue_type_2 = models.ForeignKey('TrtTissueTypes',models.SET_NULL, db_column='TISSUE_TYPE_2', blank=True, null=True,related_name='tt2') #fake foreign key #models.CharField(db_column='TISSUE_TYPE_2', max_length=5, blank=True, null=True) # Field name made lowercase. - sample_label_2 = models.CharField(db_column='SAMPLE_LABEL_2', max_length=50, blank=True, null=True) # Field name made lowercase. - turtle_comments = models.CharField(db_column='TURTLE_COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. - recapture_pittag_id_2 = models.ForeignKey('TrtPitTags',models.SET_NULL, db_column='RECAPTURE_PIT_TAG_ID_2', blank=True, null=True,related_name='recapturepittag2') #fake foreign key for right pit tag #models.CharField(db_column='recapture_pittag_id_2', max_length=50, blank=True, null=True) # Field name made lowercase. - new_pittag_id_2 = models.ForeignKey('TrtPitTags',models.SET_NULL, db_column='NEW_PIT_TAG_ID_2', blank=True, null=True, related_name='newpittag2') #fake foreign key for right pit tag #models.CharField(db_column='NEW_PIT_TAG_ID_2', max_length=50, blank=True, null=True) # Field name made lowercase. + data_entry_id = models.AutoField( + db_column="DATA_ENTRY_ID", primary_key=True + ) # Field name made lowercase. + entry_batch = models.ForeignKey( + "TrtEntryBatches", models.CASCADE, db_column="ENTRY_BATCH_ID" + ) # Field name made lowercase. + user_entry_id = models.IntegerField( + db_column="USER_ENTRY_ID", blank=True, null=True + ) # Field name made lowercase. + turtle_id = models.ForeignKey( + "TrtTurtles", models.SET_NULL, db_column="TURTLE_ID", blank=True, null=True + ) # fake foreign key #models.IntegerField(db_column='TURTLE_ID', blank=True, null=True) # Field name made lowercase. + observation_id = models.ForeignKey( + "TrtObservations", + models.SET_NULL, + db_column="OBSERVATION_ID", + blank=True, + null=True, + ) # fake foreign key #models.IntegerField(db_column='OBSERVATION_ID', blank=True, null=True) # Field name made lowercase. + do_not_process = models.BooleanField( + db_column="DO_NOT_PROCESS" + ) # Field name made lowercase. + recapture_left_tag_id = models.ForeignKey( + "TrtTags", + models.SET_NULL, + db_column="RECAPTURE_LEFT_TAG_ID", + blank=True, + null=True, + related_name="recapturelefttag", + ) # fake foreign key #models.CharField(db_column='RECAPTURE_LEFT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. + recapture_left_tag_id_2 = models.ForeignKey( + "TrtTags", + models.SET_NULL, + db_column="RECAPTURE_LEFT_TAG_ID_2", + blank=True, + null=True, + related_name="recapturelefttag2", + ) # fake foreign key #models.CharField(db_column='RECAPTURE_LEFT_TAG_ID_2', max_length=10, blank=True, null=True) # Field name made lowercase. + recapture_right_tag_id = models.ForeignKey( + "TrtTags", + models.SET_NULL, + db_column="RECAPTURE_RIGHT_TAG_ID", + blank=True, + null=True, + related_name="recapturerighttag", + ) # fake foreign key #models.CharField(db_column='RECAPTURE_RIGHT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. + recapture_right_tag_id_2 = models.ForeignKey( + "TrtTags", + models.SET_NULL, + db_column="RECAPTURE_RIGHT_TAG_ID_2", + blank=True, + null=True, + related_name="recapturerighttag2", + ) # fake foreign key #models.CharField(db_column='RECAPTURE_RIGHT_TAG_ID_2', max_length=10, blank=True, null=True) # Field name made lowercase. + recapture_pittag_id = models.ForeignKey( + "TrtPitTags", + models.SET_NULL, + db_column="RECAPTURE_PIT_TAG_ID", + blank=True, + null=True, + related_name="recapturepittag", + ) # fake foreign key for left pit tag #models.CharField(db_column='recapture_pittag_id', max_length=50, blank=True, null=True) # Field name made lowercase. + other_left_tag = models.CharField( + db_column="OTHER_LEFT_TAG", max_length=2, blank=True, null=True + ) # Field name made lowercase. + other_right_tag = models.CharField( + db_column="OTHER_RIGHT_TAG", max_length=2, blank=True, null=True + ) # Field name made lowercase. + new_left_tag_id = models.ForeignKey( + "TrtTags", + models.SET_NULL, + db_column="NEW_LEFT_TAG_ID", + blank=True, + null=True, + related_name="lefttag", + ) # fake foreign key #models.CharField(db_column='NEW_LEFT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. + new_left_tag_id_2 = models.ForeignKey( + "TrtTags", + models.SET_NULL, + db_column="NEW_LEFT_TAG_ID_2", + blank=True, + null=True, + related_name="lefttag2", + ) # fake foreign key #models.CharField(db_column='NEW_LEFT_TAG_ID_2', max_length=10, blank=True, null=True) # Field name made lowercase. + new_right_tag_id = models.ForeignKey( + "TrtTags", + models.SET_NULL, + db_column="NEW_RIGHT_TAG_ID", + blank=True, + null=True, + related_name="righttag", + ) # fake foreign key #models.CharField(db_column='NEW_RIGHT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. + new_right_tag_id_2 = models.ForeignKey( + "TrtTags", + models.SET_NULL, + db_column="NEW_RIGHT_TAG_ID_2", + blank=True, + null=True, + related_name="righttag2", + ) # fake foreign key #models.CharField(db_column='NEW_RIGHT_TAG_ID_2', max_length=10, blank=True, null=True) # Field name made lowercase. + new_pittag_id = models.ForeignKey( + "TrtPitTags", models.SET_NULL, db_column="NEW_PIT_TAG_ID", blank=True, null=True + ) # fake foreign key for left pit tag #models.CharField(db_column='NEW_pittag_id', max_length=50, blank=True, null=True) # Field name made lowercase. + alive = models.ForeignKey( + "TrtYesNo", + models.SET_NULL, + db_column="ALIVE", + blank=True, + null=True, + related_name="nesting", + ) # fake foreign key #models.CharField(db_column='ALIVE', max_length=1, blank=True, null=True) # Field name made lowercase. + place_code = models.ForeignKey( + "TrtPlaces", models.SET_NULL, db_column="PLACE_CODE", blank=True, null=True + ) # fake foreign key $models.CharField(db_column='PLACE_CODE', max_length=4, blank=True, null=True) # Field name made lowercase. + observation_date = models.DateTimeField( + db_column="OBSERVATION_DATE", blank=True, null=True + ) # Field name made lowercase. + observation_time = models.DateTimeField( + db_column="OBSERVATION_TIME", blank=True, null=True + ) # Field name made lowercase. + nesting = models.ForeignKey( + "TrtYesNo", models.SET_NULL, db_column="NESTING", blank=True, null=True + ) # fake foreign key #models.CharField(db_column='NESTING', max_length=1, blank=True, null=True) # Field name made lowercase. + species_code = models.ForeignKey( + "TrtSpecies", models.SET_NULL, db_column="SPECIES_CODE", blank=True, null=True + ) # fake foreign key #models.CharField(db_column='SPECIES_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. + identification_confidence = models.CharField( + db_column="IDENTIFICATION_CONFIDENCE", max_length=1, blank=True, null=True + ) # Field name made lowercase. + sex = models.CharField( + db_column="SEX", max_length=1, blank=True, null=True, choices=SEX_CHOICES + ) # Field name made lowercase. + curved_carapace_length = models.IntegerField( + db_column="CURVED_CARAPACE_LENGTH", blank=True, null=True + ) # Field name made lowercase. + curved_carapace_width = models.IntegerField( + db_column="CURVED_CARAPACE_WIDTH", blank=True, null=True + ) # Field name made lowercase. + activity_code = models.ForeignKey( + "TrtActivities", + models.SET_NULL, + db_column="ACTIVITY_CODE", + blank=True, + null=True, + ) # fake foreign key #models.CharField(db_column='ACTIVITY_CODE', max_length=1, blank=True, null=True) # Field name made lowercase. + beach_position_code = models.CharField( + db_column="BEACH_POSITION_CODE", max_length=2, blank=True, null=True + ) # Field name made lowercase. + damage_carapace = models.ForeignKey( + "TrtDamageCodes", + models.SET_NULL, + db_column="DAMAGE_CARAPACE", + blank=True, + null=True, + related_name="carapace", + ) # fake foreign key #models.CharField(db_column='DAMAGE_CARAPACE', max_length=1, blank=True, null=True) # Field name made lowercase. + damage_lff = models.ForeignKey( + "TrtDamageCodes", + models.SET_NULL, + db_column="DAMAGE_LFF", + blank=True, + null=True, + related_name="lff", + ) # fake foreign key #models.CharField(db_column='DAMAGE_LFF', max_length=1, blank=True, null=True) # Field name made lowercase. + damage_rff = models.ForeignKey( + "TrtDamageCodes", + models.SET_NULL, + db_column="DAMAGE_RFF", + blank=True, + null=True, + related_name="rff", + ) # fake foreign key #models.CharField(db_column='DAMAGE_RFF', max_length=1, blank=True, null=True) # Field name made lowercase. + damage_lhf = models.ForeignKey( + "TrtDamageCodes", + models.SET_NULL, + db_column="DAMAGE_LHF", + blank=True, + null=True, + related_name="lhf", + ) # fake foreign key #models.CharField(db_column='DAMAGE_LHF', max_length=1, blank=True, null=True) # Field name made lowercase. + damage_rhf = models.ForeignKey( + "TrtDamageCodes", + models.SET_NULL, + db_column="DAMAGE_RHF", + blank=True, + null=True, + related_name="rhf", + ) # fake foreign key #models.CharField(db_column='DAMAGE_RHF', max_length=1, blank=True, null=True) # Field name made lowercase. + body_part_1 = models.ForeignKey( + "TrtBodyParts", + models.SET_NULL, + db_column="BODY_PART_1", + blank=True, + null=True, + related_name="bp1", + ) # fake foreign key #models.CharField(db_column='BODY_PART_1', max_length=1, blank=True, null=True) # Field name made lowercase. + damage_code_1 = models.ForeignKey( + "TrtDamageCodes", + models.SET_NULL, + db_column="DAMAGE_CODE_1", + blank=True, + null=True, + related_name="dc1", + ) # fake foreign key #models.CharField(db_column='DAMAGE_CODE_1', max_length=1, blank=True, null=True) # Field name made lowercase. + body_part_2 = models.ForeignKey( + "TrtBodyParts", + models.SET_NULL, + db_column="BODY_PART_2", + blank=True, + null=True, + related_name="bp2", + ) # fake foreign key #models.CharField(db_column='BODY_PART_2', max_length=1, blank=True, null=True) # Field name made lowercase. + damage_code_2 = models.ForeignKey( + "TrtDamageCodes", + models.SET_NULL, + db_column="DAMAGE_CODE_2", + blank=True, + null=True, + related_name="dc2", + ) # fake foreign key #models.CharField(db_column='DAMAGE_CODE_2', max_length=1, blank=True, null=True) # Field name made lowercase. + egg_count = models.IntegerField( + db_column="EGG_COUNT", blank=True, null=True + ) # Field name made lowercase. + egg_count_method = models.CharField( + db_column="EGG_COUNT_METHOD", max_length=3, blank=True, null=True + ) # Field name made lowercase. + clutch_completed = models.CharField( + db_column="CLUTCH_COMPLETED", max_length=1, blank=True, null=True + ) # Field name made lowercase. + measured_by = models.CharField( + db_column="MEASURED_BY", max_length=50, blank=True, null=True + ) # Field name made lowercase. Used by old MSAccess frontend + measured_by_id = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="MEASURED_BY_ID", + blank=True, + null=True, + related_name="measuredby", + ) + recorded_by = models.CharField( + db_column="RECORDED_BY", max_length=50, blank=True, null=True + ) # Field name made lowercase.Used by old MSAccess frontend + recorded_by_id = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="RECORDED_BY_ID", + blank=True, + null=True, + related_name="recordedby", + ) + tagged_by = models.CharField( + db_column="TAGGED_BY", max_length=50, blank=True, null=True + ) # Field name made lowercase.Used by old MSAccess frontend + tagged_by_id = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="TAGGED_BY_ID", + blank=True, + null=True, + related_name="taggedby", + ) + entered_by = models.CharField( + db_column="ENTERED_BY", max_length=50, blank=True, null=True + ) # Field name made lowercase.Used by old MSAccess frontend + entered_by_id = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="ENTERED_BY_ID", + blank=True, + null=True, + related_name="enteredby", + ) + measured_recorded_by = models.CharField( + db_column="MEASURED_RECORDED_BY", max_length=50, blank=True, null=True + ) # Field name made lowercase. + measured_recorded_by_id = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="MEASURED_RECORDED_BY_ID", + blank=True, + null=True, + related_name="measuredrecordedby", + ) + measurement_type_1 = models.ForeignKey( + "TrtMeasurementTypes", + models.SET_NULL, + db_column="MEASUREMENT_TYPE_1", + blank=True, + null=True, + related_name="measuretype1", + ) # fake foreign key #models.CharField(db_column='MEASUREMENT_TYPE_1', max_length=10, blank=True, null=True) # Field name made lowercase. + measurement_value_1 = models.FloatField( + db_column="MEASUREMENT_VALUE_1", blank=True, null=True + ) # Field name made lowercase. + measurement_type_2 = models.ForeignKey( + "TrtMeasurementTypes", + models.SET_NULL, + db_column="MEASUREMENT_TYPE_2", + blank=True, + null=True, + related_name="measuretype2", + ) # fake foreign key #models.CharField(db_column='MEASUREMENT_TYPE_2', max_length=10, blank=True, null=True) # Field name made lowercase. + measurement_value_2 = models.FloatField( + db_column="MEASUREMENT_VALUE_2", blank=True, null=True + ) # Field name made lowercase. + datum_code = models.CharField( + db_column="DATUM_CODE", max_length=5, blank=True, null=True + ) # Field name made lowercase. + zone = models.IntegerField( + db_column="ZONE", blank=True, null=True + ) # Field name made lowercase. + easting = models.FloatField( + db_column="EASTING", blank=True, null=True + ) # Field name made lowercase. + northing = models.FloatField( + db_column="NORTHING", blank=True, null=True + ) # Field name made lowercase. + latitude = models.FloatField( + db_column="LATITUDE", blank=True, null=True + ) # Field name made lowercase. + longitude = models.FloatField( + db_column="LONGITUDE", blank=True, null=True + ) # Field name made lowercase. + latitude_degrees = models.IntegerField( + db_column="LATITUDE_DEGREES", blank=True, null=True + ) # Field name made lowercase. + latitude_minutes = models.FloatField( + db_column="LATITUDE_MINUTES", blank=True, null=True + ) # Field name made lowercase. + latitude_seconds = models.FloatField( + db_column="LATITUDE_SECONDS", blank=True, null=True + ) # Field name made lowercase. + longitude_degrees = models.IntegerField( + db_column="LONGITUDE_DEGREES", blank=True, null=True + ) # Field name made lowercase. + longitude_minutes = models.FloatField( + db_column="LONGITUDE_MINUTES", blank=True, null=True + ) # Field name made lowercase. + longitude_seconds = models.FloatField( + db_column="LONGITUDE_SECONDS", blank=True, null=True + ) # Field name made lowercase. + identification_type = models.CharField( + db_column="IDENTIFICATION_TYPE", max_length=10, blank=True, null=True + ) # Field name made lowercase. + identifier = models.CharField( + db_column="IDENTIFIER", max_length=20, blank=True, null=True + ) # Field name made lowercase. + comment_fromrecordedtagstable = models.CharField( + db_column="COMMENT_FROMRECORDEDTAGSTABLE", max_length=255, blank=True, null=True + ) # Field name made lowercase. + scars_left = models.BooleanField( + db_column="SCARS_LEFT" + ) # Field name made lowercase. + scars_right = models.BooleanField( + db_column="SCARS_RIGHT" + ) # Field name made lowercase. + other_tags = models.CharField( + db_column="OTHER_TAGS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + other_tags_identification_type = models.CharField( + db_column="OTHER_TAGS_IDENTIFICATION_TYPE", max_length=10, blank=True, null=True + ) # Field name made lowercase. + scars_left_scale_1 = models.BooleanField( + db_column="SCARS_LEFT_SCALE_1" + ) # Field name made lowercase. + scars_left_scale_2 = models.BooleanField( + db_column="SCARS_LEFT_SCALE_2" + ) # Field name made lowercase. + scars_left_scale_3 = models.BooleanField( + db_column="SCARS_LEFT_SCALE_3" + ) # Field name made lowercase. + scars_right_scale_1 = models.BooleanField( + db_column="SCARS_RIGHT_SCALE_1" + ) # Field name made lowercase. + scars_right_scale_2 = models.BooleanField( + db_column="SCARS_RIGHT_SCALE_2" + ) # Field name made lowercase. + scars_right_scale_3 = models.BooleanField( + db_column="SCARS_RIGHT_SCALE_3" + ) # Field name made lowercase. + cc_length_not_measured = models.BooleanField( + db_column="CC_LENGTH_NOT_MEASURED" + ) # Field name made lowercase. + cc_notch_length_not_measured = models.BooleanField( + db_column="CC_NOTCH_LENGTH_NOT_MEASURED" + ) # Field name made lowercase. + cc_width_not_measured = models.BooleanField( + db_column="CC_WIDTH_NOT_MEASURED" + ) # Field name made lowercase. + tagscarnotchecked = models.BooleanField( + db_column="TAGSCARNOTCHECKED" + ) # Field name made lowercase. + didnotcheckforinjury = models.BooleanField( + db_column="DIDNOTCHECKFORINJURY" + ) # Field name made lowercase. + comments = models.TextField( + db_column="COMMENTS", blank=True, null=True + ) # Field name made lowercase. + error_number = models.IntegerField( + db_column="ERROR_NUMBER", blank=True, null=True + ) # Field name made lowercase. + error_message = models.CharField( + db_column="ERROR_MESSAGE", max_length=255, blank=True, null=True + ) # Field name made lowercase. + recapture_left_tag_id_3 = models.ForeignKey( + "TrtTags", + models.SET_NULL, + db_column="RECAPTURE_LEFT_TAG_ID_3", + blank=True, + null=True, + related_name="recapturelefttag3", + ) # fake foreign key #models.CharField(db_column='RECAPTURE_LEFT_TAG_ID_3', max_length=10, blank=True, null=True) # Field name made lowercase. + recapture_right_tag_id_3 = models.ForeignKey( + "TrtTags", + models.SET_NULL, + db_column="RECAPTURE_RIGHT_TAG_ID_3", + blank=True, + null=True, + related_name="recapturerighttag3", + ) # fake foreign key #models.CharField(db_column='RECAPTURE_RIGHT_TAG_ID_3', max_length=10, blank=True, null=True) # Field name made lowercase. + body_part_3 = models.CharField( + db_column="BODY_PART_3", max_length=1, blank=True, null=True + ) # Field name made lowercase. + damage_code_3 = models.CharField( + db_column="DAMAGE_CODE_3", max_length=1, blank=True, null=True + ) # Field name made lowercase. + tissue_type_1 = models.ForeignKey( + "TrtTissueTypes", + models.SET_NULL, + db_column="TISSUE_TYPE_1", + blank=True, + null=True, + related_name="tt1", + ) # fake foreign key #models.CharField(db_column='TISSUE_TYPE_1', max_length=5, blank=True, null=True) # Field name made lowercase. + sample_label_1 = models.CharField( + db_column="SAMPLE_LABEL_1", max_length=50, blank=True, null=True + ) # Field name made lowercase. + tissue_type_2 = models.ForeignKey( + "TrtTissueTypes", + models.SET_NULL, + db_column="TISSUE_TYPE_2", + blank=True, + null=True, + related_name="tt2", + ) # fake foreign key #models.CharField(db_column='TISSUE_TYPE_2', max_length=5, blank=True, null=True) # Field name made lowercase. + sample_label_2 = models.CharField( + db_column="SAMPLE_LABEL_2", max_length=50, blank=True, null=True + ) # Field name made lowercase. + turtle_comments = models.CharField( + db_column="TURTLE_COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + recapture_pittag_id_2 = models.ForeignKey( + "TrtPitTags", + models.SET_NULL, + db_column="RECAPTURE_PIT_TAG_ID_2", + blank=True, + null=True, + related_name="recapturepittag2", + ) # fake foreign key for right pit tag #models.CharField(db_column='recapture_pittag_id_2', max_length=50, blank=True, null=True) # Field name made lowercase. + new_pittag_id_2 = models.ForeignKey( + "TrtPitTags", + models.SET_NULL, + db_column="NEW_PIT_TAG_ID_2", + blank=True, + null=True, + related_name="newpittag2", + ) # fake foreign key for right pit tag #models.CharField(db_column='NEW_PIT_TAG_ID_2', max_length=50, blank=True, null=True) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DATA_ENTRY' - unique_together = (('entry_batch', 'user_entry_id'),) - ordering = ['-data_entry_id'] - + db_table = "TRT_DATA_ENTRY" + unique_together = (("entry_batch", "user_entry_id"),) + ordering = ["-data_entry_id"] def __str__(self): return f"{self.data_entry_id}" - class TrtDataEntryExceptions(models.Model): - entry_batch_id = models.IntegerField(db_column='ENTRY_BATCH_ID', primary_key=True) # Field name made lowercase. - data_entry_id = models.IntegerField(db_column='DATA_ENTRY_ID') # Field name made lowercase. - turtle_id = models.IntegerField(db_column='TURTLE_ID', blank=True, null=True) # Field name made lowercase. - observation_id = models.IntegerField(db_column='OBSERVATION_ID', blank=True, null=True) # Field name made lowercase. - recapture_left_tag_id = models.CharField(db_column='RECAPTURE_LEFT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. - recapture_right_tag_id = models.CharField(db_column='RECAPTURE_RIGHT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. - recapture_left_tag_id_2 = models.CharField(db_column='RECAPTURE_LEFT_TAG_ID_2', max_length=10, blank=True, null=True) # Field name made lowercase. - recapture_right_tag_id_2 = models.CharField(db_column='RECAPTURE_RIGHT_TAG_ID_2', max_length=10, blank=True, null=True) # Field name made lowercase. - other_left_tag = models.CharField(db_column='OTHER_LEFT_TAG', max_length=2, blank=True, null=True) # Field name made lowercase. - other_right_tag = models.CharField(db_column='OTHER_RIGHT_TAG', max_length=2, blank=True, null=True) # Field name made lowercase. - new_left_tag_id = models.CharField(db_column='NEW_LEFT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. - new_right_tag_id = models.CharField(db_column='NEW_RIGHT_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. - alive = models.CharField(db_column='ALIVE', max_length=1, blank=True, null=True) # Field name made lowercase. - place_code = models.CharField(db_column='PLACE_CODE', max_length=4, blank=True, null=True) # Field name made lowercase. - observation_date = models.DateTimeField(db_column='OBSERVATION_DATE', blank=True, null=True) # Field name made lowercase. - observation_time = models.DateTimeField(db_column='OBSERVATION_TIME', blank=True, null=True) # Field name made lowercase. - nesting = models.CharField(db_column='NESTING', max_length=1, blank=True, null=True) # Field name made lowercase. - species_code = models.CharField(db_column='SPECIES_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. - identification_confidence = models.CharField(db_column='IDENTIFICATION_CONFIDENCE', max_length=1, blank=True, null=True) # Field name made lowercase. - sex = models.CharField(db_column='SEX', max_length=1, blank=True, null=True) # Field name made lowercase. - curved_carapace_length = models.IntegerField(db_column='CURVED_CARAPACE_LENGTH', blank=True, null=True) # Field name made lowercase. - curved_carapace_width = models.IntegerField(db_column='CURVED_CARAPACE_WIDTH', blank=True, null=True) # Field name made lowercase. - activity_code = models.CharField(db_column='ACTIVITY_CODE', max_length=1, blank=True, null=True) # Field name made lowercase. - beach_position_code = models.CharField(db_column='BEACH_POSITION_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. - damage_carapace = models.CharField(db_column='DAMAGE_CARAPACE', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_lff = models.CharField(db_column='DAMAGE_LFF', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_rff = models.CharField(db_column='DAMAGE_RFF', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_lhf = models.CharField(db_column='DAMAGE_LHF', max_length=1, blank=True, null=True) # Field name made lowercase. - damage_rhf = models.CharField(db_column='DAMAGE_RHF', max_length=1, blank=True, null=True) # Field name made lowercase. - clutch_completed = models.CharField(db_column='CLUTCH_COMPLETED', max_length=1, blank=True, null=True) # Field name made lowercase. - egg_count = models.IntegerField(db_column='EGG_COUNT', blank=True, null=True) # Field name made lowercase. - egg_count_method = models.CharField(db_column='EGG_COUNT_METHOD', max_length=3, blank=True, null=True) # Field name made lowercase. - measured_by = models.CharField(db_column='MEASURED_BY', max_length=50, blank=True, null=True) # Field name made lowercase. - recorded_by = models.CharField(db_column='RECORDED_BY', max_length=50, blank=True, null=True) # Field name made lowercase. - tagged_by = models.CharField(db_column='TAGGED_BY', max_length=50, blank=True, null=True) # Field name made lowercase. - measurement_type_1 = models.CharField(db_column='MEASUREMENT_TYPE_1', max_length=10, blank=True, null=True) # Field name made lowercase. - measurement_value_1 = models.FloatField(db_column='MEASUREMENT_VALUE_1', blank=True, null=True) # Field name made lowercase. - measurement_type_2 = models.CharField(db_column='MEASUREMENT_TYPE_2', max_length=10, blank=True, null=True) # Field name made lowercase. - measurement_value_2 = models.FloatField(db_column='MEASUREMENT_VALUE_2', blank=True, null=True) # Field name made lowercase. - datum_code = models.CharField(db_column='DATUM_CODE', max_length=5, blank=True, null=True) # Field name made lowercase. - latitude = models.FloatField(db_column='LATITUDE', blank=True, null=True) # Field name made lowercase. - longitude = models.FloatField(db_column='LONGITUDE', blank=True, null=True) # Field name made lowercase. - latitude_degrees = models.IntegerField(db_column='LATITUDE_DEGREES', blank=True, null=True) # Field name made lowercase. - latitude_minutes = models.FloatField(db_column='LATITUDE_MINUTES', blank=True, null=True) # Field name made lowercase. - latitude_seconds = models.FloatField(db_column='LATITUDE_SECONDS', blank=True, null=True) # Field name made lowercase. - longitude_degrees = models.IntegerField(db_column='LONGITUDE_DEGREES', blank=True, null=True) # Field name made lowercase. - longitude_minutes = models.FloatField(db_column='LONGITUDE_MINUTES', blank=True, null=True) # Field name made lowercase. - longitude_seconds = models.FloatField(db_column='LONGITUDE_SECONDS', blank=True, null=True) # Field name made lowercase. - zone = models.IntegerField(db_column='ZONE', blank=True, null=True) # Field name made lowercase. - easting = models.FloatField(db_column='EASTING', blank=True, null=True) # Field name made lowercase. - northing = models.FloatField(db_column='NORTHING', blank=True, null=True) # Field name made lowercase. - identification_type = models.CharField(db_column='IDENTIFICATION_TYPE', max_length=10, blank=True, null=True) # Field name made lowercase. - identifier = models.CharField(db_column='IDENTIFIER', max_length=20, blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. + entry_batch_id = models.IntegerField( + db_column="ENTRY_BATCH_ID", primary_key=True + ) # Field name made lowercase. + data_entry_id = models.IntegerField( + db_column="DATA_ENTRY_ID" + ) # Field name made lowercase. + turtle_id = models.IntegerField( + db_column="TURTLE_ID", blank=True, null=True + ) # Field name made lowercase. + observation_id = models.IntegerField( + db_column="OBSERVATION_ID", blank=True, null=True + ) # Field name made lowercase. + recapture_left_tag_id = models.CharField( + db_column="RECAPTURE_LEFT_TAG_ID", max_length=10, blank=True, null=True + ) # Field name made lowercase. + recapture_right_tag_id = models.CharField( + db_column="RECAPTURE_RIGHT_TAG_ID", max_length=10, blank=True, null=True + ) # Field name made lowercase. + recapture_left_tag_id_2 = models.CharField( + db_column="RECAPTURE_LEFT_TAG_ID_2", max_length=10, blank=True, null=True + ) # Field name made lowercase. + recapture_right_tag_id_2 = models.CharField( + db_column="RECAPTURE_RIGHT_TAG_ID_2", max_length=10, blank=True, null=True + ) # Field name made lowercase. + other_left_tag = models.CharField( + db_column="OTHER_LEFT_TAG", max_length=2, blank=True, null=True + ) # Field name made lowercase. + other_right_tag = models.CharField( + db_column="OTHER_RIGHT_TAG", max_length=2, blank=True, null=True + ) # Field name made lowercase. + new_left_tag_id = models.CharField( + db_column="NEW_LEFT_TAG_ID", max_length=10, blank=True, null=True + ) # Field name made lowercase. + new_right_tag_id = models.CharField( + db_column="NEW_RIGHT_TAG_ID", max_length=10, blank=True, null=True + ) # Field name made lowercase. + alive = models.CharField( + db_column="ALIVE", max_length=1, blank=True, null=True + ) # Field name made lowercase. + place_code = models.CharField( + db_column="PLACE_CODE", max_length=4, blank=True, null=True + ) # Field name made lowercase. + observation_date = models.DateTimeField( + db_column="OBSERVATION_DATE", blank=True, null=True + ) # Field name made lowercase. + observation_time = models.DateTimeField( + db_column="OBSERVATION_TIME", blank=True, null=True + ) # Field name made lowercase. + nesting = models.CharField( + db_column="NESTING", max_length=1, blank=True, null=True + ) # Field name made lowercase. + species_code = models.CharField( + db_column="SPECIES_CODE", max_length=2, blank=True, null=True + ) # Field name made lowercase. + identification_confidence = models.CharField( + db_column="IDENTIFICATION_CONFIDENCE", max_length=1, blank=True, null=True + ) # Field name made lowercase. + sex = models.CharField( + db_column="SEX", max_length=1, blank=True, null=True + ) # Field name made lowercase. + curved_carapace_length = models.IntegerField( + db_column="CURVED_CARAPACE_LENGTH", blank=True, null=True + ) # Field name made lowercase. + curved_carapace_width = models.IntegerField( + db_column="CURVED_CARAPACE_WIDTH", blank=True, null=True + ) # Field name made lowercase. + activity_code = models.CharField( + db_column="ACTIVITY_CODE", max_length=1, blank=True, null=True + ) # Field name made lowercase. + beach_position_code = models.CharField( + db_column="BEACH_POSITION_CODE", max_length=2, blank=True, null=True + ) # Field name made lowercase. + damage_carapace = models.CharField( + db_column="DAMAGE_CARAPACE", max_length=1, blank=True, null=True + ) # Field name made lowercase. + damage_lff = models.CharField( + db_column="DAMAGE_LFF", max_length=1, blank=True, null=True + ) # Field name made lowercase. + damage_rff = models.CharField( + db_column="DAMAGE_RFF", max_length=1, blank=True, null=True + ) # Field name made lowercase. + damage_lhf = models.CharField( + db_column="DAMAGE_LHF", max_length=1, blank=True, null=True + ) # Field name made lowercase. + damage_rhf = models.CharField( + db_column="DAMAGE_RHF", max_length=1, blank=True, null=True + ) # Field name made lowercase. + clutch_completed = models.CharField( + db_column="CLUTCH_COMPLETED", max_length=1, blank=True, null=True + ) # Field name made lowercase. + egg_count = models.IntegerField( + db_column="EGG_COUNT", blank=True, null=True + ) # Field name made lowercase. + egg_count_method = models.CharField( + db_column="EGG_COUNT_METHOD", max_length=3, blank=True, null=True + ) # Field name made lowercase. + measured_by = models.CharField( + db_column="MEASURED_BY", max_length=50, blank=True, null=True + ) # Field name made lowercase. + recorded_by = models.CharField( + db_column="RECORDED_BY", max_length=50, blank=True, null=True + ) # Field name made lowercase. + tagged_by = models.CharField( + db_column="TAGGED_BY", max_length=50, blank=True, null=True + ) # Field name made lowercase. + measurement_type_1 = models.CharField( + db_column="MEASUREMENT_TYPE_1", max_length=10, blank=True, null=True + ) # Field name made lowercase. + measurement_value_1 = models.FloatField( + db_column="MEASUREMENT_VALUE_1", blank=True, null=True + ) # Field name made lowercase. + measurement_type_2 = models.CharField( + db_column="MEASUREMENT_TYPE_2", max_length=10, blank=True, null=True + ) # Field name made lowercase. + measurement_value_2 = models.FloatField( + db_column="MEASUREMENT_VALUE_2", blank=True, null=True + ) # Field name made lowercase. + datum_code = models.CharField( + db_column="DATUM_CODE", max_length=5, blank=True, null=True + ) # Field name made lowercase. + latitude = models.FloatField( + db_column="LATITUDE", blank=True, null=True + ) # Field name made lowercase. + longitude = models.FloatField( + db_column="LONGITUDE", blank=True, null=True + ) # Field name made lowercase. + latitude_degrees = models.IntegerField( + db_column="LATITUDE_DEGREES", blank=True, null=True + ) # Field name made lowercase. + latitude_minutes = models.FloatField( + db_column="LATITUDE_MINUTES", blank=True, null=True + ) # Field name made lowercase. + latitude_seconds = models.FloatField( + db_column="LATITUDE_SECONDS", blank=True, null=True + ) # Field name made lowercase. + longitude_degrees = models.IntegerField( + db_column="LONGITUDE_DEGREES", blank=True, null=True + ) # Field name made lowercase. + longitude_minutes = models.FloatField( + db_column="LONGITUDE_MINUTES", blank=True, null=True + ) # Field name made lowercase. + longitude_seconds = models.FloatField( + db_column="LONGITUDE_SECONDS", blank=True, null=True + ) # Field name made lowercase. + zone = models.IntegerField( + db_column="ZONE", blank=True, null=True + ) # Field name made lowercase. + easting = models.FloatField( + db_column="EASTING", blank=True, null=True + ) # Field name made lowercase. + northing = models.FloatField( + db_column="NORTHING", blank=True, null=True + ) # Field name made lowercase. + identification_type = models.CharField( + db_column="IDENTIFICATION_TYPE", max_length=10, blank=True, null=True + ) # Field name made lowercase. + identifier = models.CharField( + db_column="IDENTIFIER", max_length=20, blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DATA_ENTRY_EXCEPTIONS' - unique_together = (('entry_batch_id', 'data_entry_id'),) + db_table = "TRT_DATA_ENTRY_EXCEPTIONS" + unique_together = (("entry_batch_id", "data_entry_id"),) class TrtDataEntryPersons(models.Model): - data_entry_person_id = models.AutoField(db_column='DATA_ENTRY_PERSON_ID', primary_key=True) # Field name made lowercase. - entry_batch = models.ForeignKey('TrtEntryBatches', models.CASCADE, db_column='ENTRY_BATCH_ID') # Field name made lowercase. - person_name = models.CharField(db_column='PERSON_NAME', max_length=100) # Field name made lowercase. - person_id = models.IntegerField(db_column='PERSON_ID', blank=True, null=True) # Field name made lowercase. + data_entry_person_id = models.AutoField( + db_column="DATA_ENTRY_PERSON_ID", primary_key=True + ) # Field name made lowercase. + entry_batch = models.ForeignKey( + "TrtEntryBatches", models.CASCADE, db_column="ENTRY_BATCH_ID" + ) # Field name made lowercase. + person_name = models.CharField( + db_column="PERSON_NAME", max_length=100 + ) # Field name made lowercase. + person_id = models.IntegerField( + db_column="PERSON_ID", blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DATA_ENTRY_PERSONS' - unique_together = (('entry_batch', 'person_name'),) + db_table = "TRT_DATA_ENTRY_PERSONS" + unique_together = (("entry_batch", "person_name"),) + # def __str__(self): # return f"{self.person_name}" class TrtDatumCodes(models.Model): - datum_code = models.CharField(db_column='DATUM_CODE', primary_key=True, max_length=5) # Field name made lowercase. - datum_description = models.CharField(db_column='DATUM_DESCRIPTION', max_length=50, blank=True, null=True) # Field name made lowercase. - semi_major_axis = models.FloatField(db_column='SEMI_MAJOR_AXIS', blank=True, null=True) # Field name made lowercase. - inverse_flattening = models.FloatField(db_column='INVERSE_FLATTENING', blank=True, null=True) # Field name made lowercase. + datum_code = models.CharField( + db_column="DATUM_CODE", primary_key=True, max_length=5 + ) # Field name made lowercase. + datum_description = models.CharField( + db_column="DATUM_DESCRIPTION", max_length=50, blank=True, null=True + ) # Field name made lowercase. + semi_major_axis = models.FloatField( + db_column="SEMI_MAJOR_AXIS", blank=True, null=True + ) # Field name made lowercase. + inverse_flattening = models.FloatField( + db_column="INVERSE_FLATTENING", blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DATUM_CODES' + db_table = "TRT_DATUM_CODES" class TrtDefault(models.Model): - id = models.CharField(db_column='ID', primary_key=True, max_length=10) # Field name made lowercase. - dataentry_exportpath = models.CharField(db_column='DataEntry_ExportPath', max_length=200) # Field name made lowercase. - dataentry_sourcedatabase = models.CharField(db_column='DataEntry_SourceDatabase', max_length=200, blank=True, null=True) # Field name made lowercase. + id = models.CharField( + db_column="ID", primary_key=True, max_length=10 + ) # Field name made lowercase. + dataentry_exportpath = models.CharField( + db_column="DataEntry_ExportPath", max_length=200 + ) # Field name made lowercase. + dataentry_sourcedatabase = models.CharField( + db_column="DataEntry_SourceDatabase", max_length=200, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DEFAULT' + db_table = "TRT_DEFAULT" class TrtDocuments(models.Model): - document_id = models.AutoField(db_column='DOCUMENT_ID', primary_key=True) # Field name made lowercase. - document_type = models.CharField(db_column='DOCUMENT_TYPE', max_length=10) # Field name made lowercase. - filename = models.CharField(db_column='FILENAME', max_length=255, blank=True, null=True) # Field name made lowercase. - turtle_id = models.IntegerField(db_column='TURTLE_ID', blank=True, null=True) # Field name made lowercase. - person_id = models.IntegerField(db_column='PERSON_ID', blank=True, null=True) # Field name made lowercase. - species_code = models.CharField(db_column='SPECIES_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. - title = models.CharField(db_column='TITLE', max_length=255, blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. + document_id = models.AutoField( + db_column="DOCUMENT_ID", primary_key=True + ) # Field name made lowercase. + document_type = models.CharField( + db_column="DOCUMENT_TYPE", max_length=10 + ) # Field name made lowercase. + filename = models.CharField( + db_column="FILENAME", max_length=255, blank=True, null=True + ) # Field name made lowercase. + turtle_id = models.IntegerField( + db_column="TURTLE_ID", blank=True, null=True + ) # Field name made lowercase. + person_id = models.IntegerField( + db_column="PERSON_ID", blank=True, null=True + ) # Field name made lowercase. + species_code = models.CharField( + db_column="SPECIES_CODE", max_length=2, blank=True, null=True + ) # Field name made lowercase. + title = models.CharField( + db_column="TITLE", max_length=255, blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DOCUMENTS' + db_table = "TRT_DOCUMENTS" class TrtDocumentTypes(models.Model): - document_type = models.CharField(db_column='DOCUMENT_TYPE', primary_key=True, max_length=10) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. + document_type = models.CharField( + db_column="DOCUMENT_TYPE", primary_key=True, max_length=10 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_DOCUMENT_TYPES' + db_table = "TRT_DOCUMENT_TYPES" class TrtEggCountMethods(models.Model): - egg_count_method = models.CharField(db_column='EGG_COUNT_METHOD', primary_key=True, max_length=3) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. + egg_count_method = models.CharField( + db_column="EGG_COUNT_METHOD", primary_key=True, max_length=3 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_EGG_COUNT_METHODS' + db_table = "TRT_EGG_COUNT_METHODS" class TrtEntryBatches(models.Model): - entry_batch_id = models.AutoField(db_column='ENTRY_BATCH_ID', primary_key=True) # Field name made lowercase. - entry_date = models.DateTimeField(db_column='ENTRY_DATE', blank=True, null=True) # Field name made lowercase. - entered_person_id = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='ENTERED_PERSON_ID', blank=True, null=True) #fake foreign key #models.IntegerField(db_column='ENTERED_PERSON_ID', blank=True, null=True) # Field name made lowercase. - filename = models.CharField(db_column='FILENAME', max_length=255, blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. - pr_date_convention = models.BooleanField(db_column='PR_DATE_CONVENTION') # Field name made lowercase. + entry_batch_id = models.AutoField( + db_column="ENTRY_BATCH_ID", primary_key=True + ) # Field name made lowercase. + entry_date = models.DateTimeField( + db_column="ENTRY_DATE", blank=True, null=True + ) # Field name made lowercase. + entered_person_id = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="ENTERED_PERSON_ID", + blank=True, + null=True, + ) # fake foreign key #models.IntegerField(db_column='ENTERED_PERSON_ID', blank=True, null=True) # Field name made lowercase. + filename = models.CharField( + db_column="FILENAME", max_length=255, blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + pr_date_convention = models.BooleanField( + db_column="PR_DATE_CONVENTION" + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_ENTRY_BATCHES' + db_table = "TRT_ENTRY_BATCHES" verbose_name = "Entry Batch" verbose_name_plural = "Entry Batches" - ordering=['entry_batch_id'] + ordering = ["entry_batch_id"] def __str__(self): return f"{self.entry_batch_id}" + class TrtIdentification(models.Model): - turtle = models.OneToOneField('TrtTurtles', models.CASCADE, db_column='TURTLE_ID', primary_key=True) # Field name made lowercase. - identification_type = models.ForeignKey('TrtIdentificationTypes', models.CASCADE, db_column='IDENTIFICATION_TYPE',related_name='identification_type2') # Field name made lowercase. - identifier = models.CharField(db_column='IDENTIFIER', max_length=20) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. + turtle = models.OneToOneField( + "TrtTurtles", models.CASCADE, db_column="TURTLE_ID", primary_key=True + ) # Field name made lowercase. + identification_type = models.ForeignKey( + "TrtIdentificationTypes", + models.CASCADE, + db_column="IDENTIFICATION_TYPE", + related_name="identification_type2", + ) # Field name made lowercase. + identifier = models.CharField( + db_column="IDENTIFIER", max_length=20 + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_IDENTIFICATION' - unique_together = (('turtle', 'identification_type', 'identifier'),) + db_table = "TRT_IDENTIFICATION" + unique_together = (("turtle", "identification_type", "identifier"),) class TrtIdentificationTypes(models.Model): - identification_type = models.CharField(db_column='IDENTIFICATION_TYPE', primary_key=True, max_length=10) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. + identification_type = models.CharField( + db_column="IDENTIFICATION_TYPE", primary_key=True, max_length=10 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_IDENTIFICATION_TYPES' + db_table = "TRT_IDENTIFICATION_TYPES" class TrtLocations(models.Model): - location_code = models.CharField(db_column='LOCATION_CODE', primary_key=True, max_length=2) # Field name made lowercase. - location_name = models.CharField(db_column='LOCATION_NAME', max_length=50) # Field name made lowercase. + location_code = models.CharField( + db_column="LOCATION_CODE", primary_key=True, max_length=2 + ) # Field name made lowercase. + location_name = models.CharField( + db_column="LOCATION_NAME", max_length=50 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_LOCATIONS' + db_table = "TRT_LOCATIONS" + def __str__(self): return f"{self.location_name}" + class TrtMeasurements(models.Model): - id = models.AutoField(db_column='ID',primary_key=True) - observation = models.ForeignKey('TrtObservations', on_delete=models.CASCADE) # Field name made lowercase. - measurement_type = models.ForeignKey('TrtMeasurementTypes', models.CASCADE, db_column='MEASUREMENT_TYPE') # Field name made lowercase. - measurement_value = models.FloatField(db_column='MEASUREMENT_VALUE') # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. + id = models.AutoField(db_column="ID", primary_key=True) + observation = models.ForeignKey( + "TrtObservations", on_delete=models.CASCADE + ) # Field name made lowercase. + measurement_type = models.ForeignKey( + "TrtMeasurementTypes", models.CASCADE, db_column="MEASUREMENT_TYPE" + ) # Field name made lowercase. + measurement_value = models.FloatField( + db_column="MEASUREMENT_VALUE" + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_MEASUREMENTS' - unique_together = (('observation', 'measurement_type'),) + db_table = "TRT_MEASUREMENTS" + unique_together = (("observation", "measurement_type"),) class TrtMeasurementTypes(models.Model): - measurement_type = models.CharField(db_column='MEASUREMENT_TYPE', primary_key=True, max_length=10) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=100) # Field name made lowercase. - measurement_units = models.CharField(db_column='MEASUREMENT_UNITS', max_length=10, blank=True, null=True) # Field name made lowercase. - minimum_value = models.FloatField(db_column='MINIMUM_VALUE', blank=True, null=True) # Field name made lowercase. - maximum_value = models.FloatField(db_column='MAXIMUM_VALUE', blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. + measurement_type = models.CharField( + db_column="MEASUREMENT_TYPE", primary_key=True, max_length=10 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=100 + ) # Field name made lowercase. + measurement_units = models.CharField( + db_column="MEASUREMENT_UNITS", max_length=10, blank=True, null=True + ) # Field name made lowercase. + minimum_value = models.FloatField( + db_column="MINIMUM_VALUE", blank=True, null=True + ) # Field name made lowercase. + maximum_value = models.FloatField( + db_column="MAXIMUM_VALUE", blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_MEASUREMENT_TYPES' + db_table = "TRT_MEASUREMENT_TYPES" + def __str__(self): return f"{self.description}" + class TrtNesting(models.Model): - place_code = models.CharField(db_column='PLACE_CODE', primary_key=True, max_length=4) # Field name made lowercase. - species_code = models.CharField(db_column='SPECIES_CODE', max_length=2) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. + place_code = models.CharField( + db_column="PLACE_CODE", primary_key=True, max_length=4 + ) # Field name made lowercase. + species_code = models.CharField( + db_column="SPECIES_CODE", max_length=2 + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_NESTING' - unique_together = (('place_code', 'species_code'),) + db_table = "TRT_NESTING" + unique_together = (("place_code", "species_code"),) class TrtNestingSeason(models.Model): - nesting_seasonid = models.AutoField(db_column='NESTING_SEASONID', primary_key=True) # Field name made lowercase. - nesting_season = models.CharField(db_column='NESTING_SEASON', max_length=20) # Field name made lowercase. - startdate = models.DateTimeField(db_column='STARTDATE') # Field name made lowercase. - enddate = models.DateTimeField(db_column='ENDDATE') # Field name made lowercase. + nesting_seasonid = models.AutoField( + db_column="NESTING_SEASONID", primary_key=True + ) # Field name made lowercase. + nesting_season = models.CharField( + db_column="NESTING_SEASON", max_length=20 + ) # Field name made lowercase. + startdate = models.DateTimeField( + db_column="STARTDATE" + ) # Field name made lowercase. + enddate = models.DateTimeField(db_column="ENDDATE") # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_NESTING_SEASON' + db_table = "TRT_NESTING_SEASON" class TrtObservations(models.Model): - observation_id = models.AutoField(db_column='OBSERVATION_ID', primary_key=True) # Field name made lowercase. - turtle = models.ForeignKey('TrtTurtles', models.CASCADE, db_column='TURTLE_ID') # Field name made lowercase. - observation_date = models.DateTimeField(db_column='OBSERVATION_DATE') # Field name made lowercase. - observation_time = models.DateTimeField(db_column='OBSERVATION_TIME', blank=True, null=True) # Field name made lowercase. - observation_date_old = models.DateTimeField(db_column='OBSERVATION_DATE_OLD', blank=True, null=True) # Field name made lowercase. - alive = models.ForeignKey('TrtYesNo',models.SET_NULL, db_column='ALIVE', blank=True, null=True) #fake foreign key #models.CharField(db_column='ALIVE', max_length=1, blank=True, null=True) # Field name made lowercase. - measurer_person = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='MEASURER_PERSON_ID', blank=True, null=True,related_name='measurer_person') # Field name made lowercase. - measurer_reporter_person = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='MEASURER_REPORTER_PERSON_ID', blank=True, null=True,related_name='measurer_reporter_person') # Field name made lowercase. - tagger_person = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='TAGGER_PERSON_ID', blank=True, null=True,related_name='tagger_person') # Field name made lowercase. - reporter_person = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='REPORTER_PERSON_ID', blank=True, null=True) # Field name made lowercase. - place_code = models.ForeignKey('TrtPlaces', models.SET_NULL, db_column='PLACE_CODE', blank=True, null=True) # Field name made lowercase. - place_description = models.CharField(db_column='PLACE_DESCRIPTION', max_length=300, blank=True, null=True) # Field name made lowercase. - datum_code = models.ForeignKey(TrtDatumCodes, models.SET_NULL, db_column='DATUM_CODE', blank=True, null=True) # Field name made lowercase. - latitude = models.FloatField(db_column='LATITUDE', blank=True, null=True) # Field name made lowercase. - longitude = models.FloatField(db_column='LONGITUDE', blank=True, null=True) # Field name made lowercase. - latitude_degrees = models.IntegerField(db_column='LATITUDE_DEGREES', blank=True, null=True) # Field name made lowercase. - latitude_minutes = models.FloatField(db_column='LATITUDE_MINUTES', blank=True, null=True) # Field name made lowercase. - latitude_seconds = models.FloatField(db_column='LATITUDE_SECONDS', blank=True, null=True) # Field name made lowercase. - longitude_degrees = models.IntegerField(db_column='LONGITUDE_DEGREES', blank=True, null=True) # Field name made lowercase. - longitude_minutes = models.FloatField(db_column='LONGITUDE_MINUTES', blank=True, null=True) # Field name made lowercase. - longitude_seconds = models.FloatField(db_column='LONGITUDE_SECONDS', blank=True, null=True) # Field name made lowercase. - zone = models.IntegerField(db_column='ZONE', blank=True, null=True) # Field name made lowercase. - easting = models.FloatField(db_column='EASTING', blank=True, null=True) # Field name made lowercase. - northing = models.FloatField(db_column='NORTHING', blank=True, null=True) # Field name made lowercase. - activity_code = models.ForeignKey(TrtActivities, models.SET_NULL, db_column='ACTIVITY_CODE', blank=True, null=True) # Field name made lowercase. - beach_position_code = models.ForeignKey(TrtBeachPositions, models.SET_NULL, db_column='BEACH_POSITION_CODE', blank=True, null=True) # Field name made lowercase. - condition_code = models.ForeignKey(TrtConditionCodes, models.SET_NULL, db_column='CONDITION_CODE', blank=True, null=True) # Field name made lowercase. - nesting = models.ForeignKey('TrtYesNo',models.SET_NULL, db_column='NESTING', blank=True, null=True, related_name="nestingobs") #fake foreign key #models.CharField(db_column='NESTING', max_length=1, blank=True, null=True) # Field name made lowercase. - clutch_completed = models.CharField(db_column='CLUTCH_COMPLETED', max_length=1, blank=True, null=True) # Field name made lowercase. - number_of_eggs = models.SmallIntegerField(db_column='NUMBER_OF_EGGS', blank=True, null=True) # Field name made lowercase. - egg_count_method = models.ForeignKey(TrtEggCountMethods, models.SET_NULL, db_column='EGG_COUNT_METHOD', blank=True, null=True) # Field name made lowercase. - measurements = models.CharField(db_column='MEASUREMENTS', max_length=1) # Field name made lowercase. - action_taken = models.CharField(db_column='ACTION_TAKEN', max_length=255, blank=True, null=True) # Field name made lowercase. - comments = models.TextField(db_column='COMMENTS', blank=True, null=True) # Field name made lowercase. - entered_by = models.CharField(db_column='ENTERED_BY', max_length=50, blank=True, null=True) # Field name made lowercase. - date_entered = models.DateTimeField(db_column='DATE_ENTERED', blank=True, null=True) # Field name made lowercase. - original_observation_id = models.IntegerField(db_column='ORIGINAL_OBSERVATION_ID', blank=True, null=True) # Field name made lowercase. - entry_batch = models.ForeignKey(TrtEntryBatches, models.SET_NULL, db_column='ENTRY_BATCH_ID', blank=True, null=True) # Field name made lowercase. - comment_fromrecordedtagstable = models.TextField(db_column='COMMENT_FROMRECORDEDTAGSTABLE', blank=True, null=True) # Field name made lowercase. - scars_left = models.BooleanField(db_column='SCARS_LEFT') # Field name made lowercase. - scars_right = models.BooleanField(db_column='SCARS_RIGHT') # Field name made lowercase. - other_tags = models.CharField(db_column='OTHER_TAGS', max_length=255, blank=True, null=True) # Field name made lowercase. - other_tags_identification_type = models.ForeignKey(TrtIdentificationTypes, models.SET_NULL, db_column='OTHER_TAGS_IDENTIFICATION_TYPE', blank=True, null=True) # Field name made lowercase. - transferid = models.IntegerField(db_column='TransferID', blank=True, null=True) # Field name made lowercase. - mund = models.BooleanField(db_column='Mund') # Field name made lowercase. - entered_by_person = models.ForeignKey('TrtPersons', models.SET_NULL, db_column='ENTERED_BY_PERSON_ID', blank=True, null=True,related_name='entered_by_person') # Field name made lowercase. - scars_left_scale_1 = models.BooleanField(db_column='SCARS_LEFT_SCALE_1') # Field name made lowercase. - scars_left_scale_2 = models.BooleanField(db_column='SCARS_LEFT_SCALE_2') # Field name made lowercase. - scars_left_scale_3 = models.BooleanField(db_column='SCARS_LEFT_SCALE_3') # Field name made lowercase. - scars_right_scale_1 = models.BooleanField(db_column='SCARS_RIGHT_SCALE_1') # Field name made lowercase. - scars_right_scale_2 = models.BooleanField(db_column='SCARS_RIGHT_SCALE_2') # Field name made lowercase. - scars_right_scale_3 = models.BooleanField(db_column='SCARS_RIGHT_SCALE_3') # Field name made lowercase. - cc_length_not_measured = models.BooleanField(db_column='CC_LENGTH_Not_Measured') # Field name made lowercase. - cc_notch_length_not_measured = models.BooleanField(db_column='CC_NOTCH_LENGTH_Not_Measured') # Field name made lowercase. - cc_width_not_measured = models.BooleanField(db_column='CC_WIDTH_Not_Measured') # Field name made lowercase. - tagscarnotchecked = models.BooleanField(db_column='TagScarNotChecked') # Field name made lowercase. - didnotcheckforinjury = models.BooleanField(db_column='DidNotCheckForInjury') # Field name made lowercase. - date_convention = models.CharField(db_column='DATE_CONVENTION', max_length=1) # Field name made lowercase. - observation_status = models.CharField(db_column='OBSERVATION_STATUS', max_length=50, blank=True, null=True) # Field name made lowercase. - corrected_date = models.DateTimeField(db_column='CORRECTED_DATE', blank=True, null=True) # Field name made lowercase. + observation_id = models.AutoField( + db_column="OBSERVATION_ID", primary_key=True + ) # Field name made lowercase. + turtle = models.ForeignKey( + "TrtTurtles", models.CASCADE, db_column="TURTLE_ID" + ) # Field name made lowercase. + observation_date = models.DateTimeField( + db_column="OBSERVATION_DATE" + ) # Field name made lowercase. + observation_time = models.DateTimeField( + db_column="OBSERVATION_TIME", blank=True, null=True + ) # Field name made lowercase. + observation_date_old = models.DateTimeField( + db_column="OBSERVATION_DATE_OLD", blank=True, null=True + ) # Field name made lowercase. + alive = models.ForeignKey( + "TrtYesNo", models.SET_NULL, db_column="ALIVE", blank=True, null=True + ) # fake foreign key #models.CharField(db_column='ALIVE', max_length=1, blank=True, null=True) # Field name made lowercase. + measurer_person = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="MEASURER_PERSON_ID", + blank=True, + null=True, + related_name="measurer_person", + ) # Field name made lowercase. + measurer_reporter_person = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="MEASURER_REPORTER_PERSON_ID", + blank=True, + null=True, + related_name="measurer_reporter_person", + ) # Field name made lowercase. + tagger_person = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="TAGGER_PERSON_ID", + blank=True, + null=True, + related_name="tagger_person", + ) # Field name made lowercase. + reporter_person = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="REPORTER_PERSON_ID", + blank=True, + null=True, + ) # Field name made lowercase. + place_code = models.ForeignKey( + "TrtPlaces", models.SET_NULL, db_column="PLACE_CODE", blank=True, null=True + ) # Field name made lowercase. + place_description = models.CharField( + db_column="PLACE_DESCRIPTION", max_length=300, blank=True, null=True + ) # Field name made lowercase. + datum_code = models.ForeignKey( + TrtDatumCodes, models.SET_NULL, db_column="DATUM_CODE", blank=True, null=True + ) # Field name made lowercase. + latitude = models.FloatField( + db_column="LATITUDE", blank=True, null=True + ) # Field name made lowercase. + longitude = models.FloatField( + db_column="LONGITUDE", blank=True, null=True + ) # Field name made lowercase. + latitude_degrees = models.IntegerField( + db_column="LATITUDE_DEGREES", blank=True, null=True + ) # Field name made lowercase. + latitude_minutes = models.FloatField( + db_column="LATITUDE_MINUTES", blank=True, null=True + ) # Field name made lowercase. + latitude_seconds = models.FloatField( + db_column="LATITUDE_SECONDS", blank=True, null=True + ) # Field name made lowercase. + longitude_degrees = models.IntegerField( + db_column="LONGITUDE_DEGREES", blank=True, null=True + ) # Field name made lowercase. + longitude_minutes = models.FloatField( + db_column="LONGITUDE_MINUTES", blank=True, null=True + ) # Field name made lowercase. + longitude_seconds = models.FloatField( + db_column="LONGITUDE_SECONDS", blank=True, null=True + ) # Field name made lowercase. + zone = models.IntegerField( + db_column="ZONE", blank=True, null=True + ) # Field name made lowercase. + easting = models.FloatField( + db_column="EASTING", blank=True, null=True + ) # Field name made lowercase. + northing = models.FloatField( + db_column="NORTHING", blank=True, null=True + ) # Field name made lowercase. + activity_code = models.ForeignKey( + TrtActivities, models.SET_NULL, db_column="ACTIVITY_CODE", blank=True, null=True + ) # Field name made lowercase. + beach_position_code = models.ForeignKey( + TrtBeachPositions, + models.SET_NULL, + db_column="BEACH_POSITION_CODE", + blank=True, + null=True, + ) # Field name made lowercase. + condition_code = models.ForeignKey( + TrtConditionCodes, + models.SET_NULL, + db_column="CONDITION_CODE", + blank=True, + null=True, + ) # Field name made lowercase. + nesting = models.ForeignKey( + "TrtYesNo", + models.SET_NULL, + db_column="NESTING", + blank=True, + null=True, + related_name="nestingobs", + ) # fake foreign key #models.CharField(db_column='NESTING', max_length=1, blank=True, null=True) # Field name made lowercase. + clutch_completed = models.CharField( + db_column="CLUTCH_COMPLETED", max_length=1, blank=True, null=True + ) # Field name made lowercase. + number_of_eggs = models.SmallIntegerField( + db_column="NUMBER_OF_EGGS", blank=True, null=True + ) # Field name made lowercase. + egg_count_method = models.ForeignKey( + TrtEggCountMethods, + models.SET_NULL, + db_column="EGG_COUNT_METHOD", + blank=True, + null=True, + ) # Field name made lowercase. + measurements = models.CharField( + db_column="MEASUREMENTS", max_length=1 + ) # Field name made lowercase. + action_taken = models.CharField( + db_column="ACTION_TAKEN", max_length=255, blank=True, null=True + ) # Field name made lowercase. + comments = models.TextField( + db_column="COMMENTS", blank=True, null=True + ) # Field name made lowercase. + entered_by = models.CharField( + db_column="ENTERED_BY", max_length=50, blank=True, null=True + ) # Field name made lowercase. + date_entered = models.DateTimeField( + db_column="DATE_ENTERED", blank=True, null=True + ) # Field name made lowercase. + original_observation_id = models.IntegerField( + db_column="ORIGINAL_OBSERVATION_ID", blank=True, null=True + ) # Field name made lowercase. + entry_batch = models.ForeignKey( + TrtEntryBatches, + models.SET_NULL, + db_column="ENTRY_BATCH_ID", + blank=True, + null=True, + ) # Field name made lowercase. + comment_fromrecordedtagstable = models.TextField( + db_column="COMMENT_FROMRECORDEDTAGSTABLE", blank=True, null=True + ) # Field name made lowercase. + scars_left = models.BooleanField( + db_column="SCARS_LEFT" + ) # Field name made lowercase. + scars_right = models.BooleanField( + db_column="SCARS_RIGHT" + ) # Field name made lowercase. + other_tags = models.CharField( + db_column="OTHER_TAGS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + other_tags_identification_type = models.ForeignKey( + TrtIdentificationTypes, + models.SET_NULL, + db_column="OTHER_TAGS_IDENTIFICATION_TYPE", + blank=True, + null=True, + ) # Field name made lowercase. + transferid = models.IntegerField( + db_column="TransferID", blank=True, null=True + ) # Field name made lowercase. + mund = models.BooleanField(db_column="Mund") # Field name made lowercase. + entered_by_person = models.ForeignKey( + "TrtPersons", + models.SET_NULL, + db_column="ENTERED_BY_PERSON_ID", + blank=True, + null=True, + related_name="entered_by_person", + ) # Field name made lowercase. + scars_left_scale_1 = models.BooleanField( + db_column="SCARS_LEFT_SCALE_1" + ) # Field name made lowercase. + scars_left_scale_2 = models.BooleanField( + db_column="SCARS_LEFT_SCALE_2" + ) # Field name made lowercase. + scars_left_scale_3 = models.BooleanField( + db_column="SCARS_LEFT_SCALE_3" + ) # Field name made lowercase. + scars_right_scale_1 = models.BooleanField( + db_column="SCARS_RIGHT_SCALE_1" + ) # Field name made lowercase. + scars_right_scale_2 = models.BooleanField( + db_column="SCARS_RIGHT_SCALE_2" + ) # Field name made lowercase. + scars_right_scale_3 = models.BooleanField( + db_column="SCARS_RIGHT_SCALE_3" + ) # Field name made lowercase. + cc_length_not_measured = models.BooleanField( + db_column="CC_LENGTH_Not_Measured" + ) # Field name made lowercase. + cc_notch_length_not_measured = models.BooleanField( + db_column="CC_NOTCH_LENGTH_Not_Measured" + ) # Field name made lowercase. + cc_width_not_measured = models.BooleanField( + db_column="CC_WIDTH_Not_Measured" + ) # Field name made lowercase. + tagscarnotchecked = models.BooleanField( + db_column="TagScarNotChecked" + ) # Field name made lowercase. + didnotcheckforinjury = models.BooleanField( + db_column="DidNotCheckForInjury" + ) # Field name made lowercase. + date_convention = models.CharField( + db_column="DATE_CONVENTION", max_length=1 + ) # Field name made lowercase. + observation_status = models.CharField( + db_column="OBSERVATION_STATUS", max_length=50, blank=True, null=True + ) # Field name made lowercase. + corrected_date = models.DateTimeField( + db_column="CORRECTED_DATE", blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_OBSERVATIONS' - unique_together = (('observation_id', 'turtle'),) + db_table = "TRT_OBSERVATIONS" + unique_together = (("observation_id", "turtle"),) verbose_name = "Observation" def __str__(self): return f"{self.observation_date}" + class TrtPersons(models.Model): - person_id = models.AutoField(db_column='PERSON_ID', primary_key=True) # Field name made lowercase. - first_name = models.CharField(db_column='FIRST_NAME', max_length=50) # Field name made lowercase. - middle_name = models.CharField(db_column='MIDDLE_NAME', max_length=50, blank=True, null=True) # Field name made lowercase. - surname = models.CharField(db_column='SURNAME', max_length=50, blank=True, null=True) # Field name made lowercase. - specialty = models.CharField(db_column='SPECIALTY', max_length=255, blank=True, null=True) # Field name made lowercase. - address_line_1 = models.CharField(db_column='ADDRESS_LINE_1', max_length=255, blank=True, null=True) # Field name made lowercase. - address_line_2 = models.CharField(db_column='ADDRESS_LINE_2', max_length=255, blank=True, null=True) # Field name made lowercase. - town = models.CharField(db_column='TOWN', max_length=50, blank=True, null=True) # Field name made lowercase. - state = models.CharField(db_column='STATE', max_length=10, blank=True, null=True) # Field name made lowercase. - post_code = models.CharField(db_column='POST_CODE', max_length=10, blank=True, null=True) # Field name made lowercase. - country = models.CharField(db_column='COUNTRY', max_length=50, blank=True, null=True) # Field name made lowercase. - telephone = models.CharField(db_column='TELEPHONE', max_length=20, blank=True, null=True) # Field name made lowercase. - fax = models.CharField(db_column='FAX', max_length=20, blank=True, null=True) # Field name made lowercase. - mobile = models.CharField(db_column='MOBILE', max_length=20, blank=True, null=True) # Field name made lowercase. - email = models.CharField(db_column='EMAIL', max_length=150, blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=400, blank=True, null=True) # Field name made lowercase. - transfer = models.CharField(db_column='Transfer', max_length=50, blank=True, null=True) # Field name made lowercase. - recorder = models.BooleanField(db_column='Recorder') # Field name made lowercase. + person_id = models.AutoField( + db_column="PERSON_ID", primary_key=True + ) # Field name made lowercase. + first_name = models.CharField( + db_column="FIRST_NAME", max_length=50 + ) # Field name made lowercase. + middle_name = models.CharField( + db_column="MIDDLE_NAME", max_length=50, blank=True, null=True + ) # Field name made lowercase. + surname = models.CharField( + db_column="SURNAME", max_length=50, blank=True, null=True + ) # Field name made lowercase. + specialty = models.CharField( + db_column="SPECIALTY", max_length=255, blank=True, null=True + ) # Field name made lowercase. + address_line_1 = models.CharField( + db_column="ADDRESS_LINE_1", max_length=255, blank=True, null=True + ) # Field name made lowercase. + address_line_2 = models.CharField( + db_column="ADDRESS_LINE_2", max_length=255, blank=True, null=True + ) # Field name made lowercase. + town = models.CharField( + db_column="TOWN", max_length=50, blank=True, null=True + ) # Field name made lowercase. + state = models.CharField( + db_column="STATE", max_length=10, blank=True, null=True + ) # Field name made lowercase. + post_code = models.CharField( + db_column="POST_CODE", max_length=10, blank=True, null=True + ) # Field name made lowercase. + country = models.CharField( + db_column="COUNTRY", max_length=50, blank=True, null=True + ) # Field name made lowercase. + telephone = models.CharField( + db_column="TELEPHONE", max_length=20, blank=True, null=True + ) # Field name made lowercase. + fax = models.CharField( + db_column="FAX", max_length=20, blank=True, null=True + ) # Field name made lowercase. + mobile = models.CharField( + db_column="MOBILE", max_length=20, blank=True, null=True + ) # Field name made lowercase. + email = models.CharField( + db_column="EMAIL", max_length=150, blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=400, blank=True, null=True + ) # Field name made lowercase. + transfer = models.CharField( + db_column="Transfer", max_length=50, blank=True, null=True + ) # Field name made lowercase. + recorder = models.BooleanField(db_column="Recorder") # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_PERSONS' - ordering = ['first_name','surname'] + db_table = "TRT_PERSONS" + ordering = ["first_name", "surname"] verbose_name = "Person" verbose_name_plural = "People" + def __str__(self): return f"{self.first_name} {self.surname}" - + class TrtPitTags(models.Model): - pittag_id = models.CharField(db_column='PIT_TAG_ID', primary_key=True, max_length=50) # Field name made lowercase. - issue_location = models.CharField(db_column='ISSUE_LOCATION', max_length=50, blank=True, null=True) # Field name made lowercase. - custodian_person_id = models.IntegerField(db_column='CUSTODIAN_PERSON_ID', blank=True, null=True) # Field name made lowercase. - turtle = models.ForeignKey('TrtTurtles', models.SET_NULL, db_column='TURTLE_ID', blank=True, null=True) # Field name made lowercase. - pit_tag_status = models.ForeignKey('TrtPitTagStatus', models.SET_NULL, db_column='PIT_TAG_STATUS', blank=True, null=True) # Field name made lowercase. - return_date = models.DateTimeField(db_column='RETURN_DATE', blank=True, null=True) # Field name made lowercase. - return_condition = models.CharField(db_column='RETURN_CONDITION', max_length=50, blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. - field_person_id = models.IntegerField(db_column='FIELD_PERSON_ID', blank=True, null=True) # Field name made lowercase. - tag_order_id = models.IntegerField(db_column='TAG_ORDER_ID', blank=True, null=True) # Field name made lowercase. - batch_number = models.CharField(db_column='BATCH_NUMBER', max_length=50, blank=True, null=True) # Field name made lowercase. - box_number = models.CharField(db_column='BOX_NUMBER', max_length=50, blank=True, null=True) # Field name made lowercase. + pittag_id = models.CharField( + db_column="PIT_TAG_ID", primary_key=True, max_length=50 + ) # Field name made lowercase. + issue_location = models.CharField( + db_column="ISSUE_LOCATION", max_length=50, blank=True, null=True + ) # Field name made lowercase. + custodian_person_id = models.IntegerField( + db_column="CUSTODIAN_PERSON_ID", blank=True, null=True + ) # Field name made lowercase. + turtle = models.ForeignKey( + "TrtTurtles", models.SET_NULL, db_column="TURTLE_ID", blank=True, null=True + ) # Field name made lowercase. + pit_tag_status = models.ForeignKey( + "TrtPitTagStatus", + models.SET_NULL, + db_column="PIT_TAG_STATUS", + blank=True, + null=True, + ) # Field name made lowercase. + return_date = models.DateTimeField( + db_column="RETURN_DATE", blank=True, null=True + ) # Field name made lowercase. + return_condition = models.CharField( + db_column="RETURN_CONDITION", max_length=50, blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + field_person_id = models.IntegerField( + db_column="FIELD_PERSON_ID", blank=True, null=True + ) # Field name made lowercase. + tag_order_id = models.IntegerField( + db_column="TAG_ORDER_ID", blank=True, null=True + ) # Field name made lowercase. + batch_number = models.CharField( + db_column="BATCH_NUMBER", max_length=50, blank=True, null=True + ) # Field name made lowercase. + box_number = models.CharField( + db_column="BOX_NUMBER", max_length=50, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_PIT_TAGS' - unique_together = (('pittag_id', 'turtle'),) + db_table = "TRT_PIT_TAGS" + unique_together = (("pittag_id", "turtle"),) verbose_name = "Pit tag" - ordering = ['pittag_id'] + ordering = ["pittag_id"] + def __str__(self): return f"{self.pittag_id}" class TrtPitTagStates(models.Model): - pit_tag_state = models.CharField(db_column='PIT_TAG_STATE', primary_key=True, max_length=10) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. - pit_tag_status = models.ForeignKey('TrtPitTagStatus', models.CASCADE, db_column='PIT_TAG_STATUS') # Field name made lowercase. - existing_tag_list = models.BooleanField(db_column='EXISTING_TAG_LIST') # Field name made lowercase. - new_tag_list = models.BooleanField(db_column='NEW_TAG_LIST') # Field name made lowercase. + pit_tag_state = models.CharField( + db_column="PIT_TAG_STATE", primary_key=True, max_length=10 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. + pit_tag_status = models.ForeignKey( + "TrtPitTagStatus", models.CASCADE, db_column="PIT_TAG_STATUS" + ) # Field name made lowercase. + existing_tag_list = models.BooleanField( + db_column="EXISTING_TAG_LIST" + ) # Field name made lowercase. + new_tag_list = models.BooleanField( + db_column="NEW_TAG_LIST" + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_PIT_TAG_STATES' + db_table = "TRT_PIT_TAG_STATES" class TrtPitTagStatus(models.Model): - pit_tag_status = models.CharField(db_column='PIT_TAG_STATUS', primary_key=True, max_length=10) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. + pit_tag_status = models.CharField( + db_column="PIT_TAG_STATUS", primary_key=True, max_length=10 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_PIT_TAG_STATUS' + db_table = "TRT_PIT_TAG_STATUS" + def __str__(self): return f"{self.description}" + class TrtPlaces(models.Model): - place_code = models.CharField(db_column='PLACE_CODE', primary_key=True, max_length=4) # Field name made lowercase. - place_name = models.CharField(db_column='PLACE_NAME', max_length=50, blank=True, null=True) # Field name made lowercase. - location_code = models.ForeignKey('TrtLocations',models.DO_NOTHING, db_column='LOCATION_CODE') #fake foreign key #models.CharField(db_column='LOCATION_CODE', max_length=2) # Field name made lowercase. - rookery = models.CharField(db_column='ROOKERY', max_length=1, blank=True, null=True) # Field name made lowercase. - beach_approach = models.CharField(db_column='BEACH_APPROACH', max_length=50, blank=True, null=True) # Field name made lowercase. - aspect = models.CharField(db_column='ASPECT', max_length=3, blank=True, null=True) # Field name made lowercase. - datum_code = models.CharField(db_column='DATUM_CODE', max_length=5, blank=True, null=True) # Field name made lowercase. - latitude = models.FloatField(db_column='LATITUDE', blank=True, null=True) # Field name made lowercase. - longitude = models.FloatField(db_column='LONGITUDE', blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. + place_code = models.CharField( + db_column="PLACE_CODE", primary_key=True, max_length=4 + ) # Field name made lowercase. + place_name = models.CharField( + db_column="PLACE_NAME", max_length=50, blank=True, null=True + ) # Field name made lowercase. + location_code = models.ForeignKey( + "TrtLocations", models.DO_NOTHING, db_column="LOCATION_CODE" + ) # fake foreign key #models.CharField(db_column='LOCATION_CODE', max_length=2) # Field name made lowercase. + rookery = models.CharField( + db_column="ROOKERY", max_length=1, blank=True, null=True + ) # Field name made lowercase. + beach_approach = models.CharField( + db_column="BEACH_APPROACH", max_length=50, blank=True, null=True + ) # Field name made lowercase. + aspect = models.CharField( + db_column="ASPECT", max_length=3, blank=True, null=True + ) # Field name made lowercase. + datum_code = models.CharField( + db_column="DATUM_CODE", max_length=5, blank=True, null=True + ) # Field name made lowercase. + latitude = models.FloatField( + db_column="LATITUDE", blank=True, null=True + ) # Field name made lowercase. + longitude = models.FloatField( + db_column="LONGITUDE", blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_PLACES' - ordering = ['place_name'] + db_table = "TRT_PLACES" + ordering = ["place_name"] + def __str__(self): return f"{self.location_code} - {self.place_name}" + class TrtRecordedIdentification(models.Model): - recorded_identification_id = models.AutoField(db_column='RECORDED_IDENTIFICATION_ID', primary_key=True) # Field name made lowercase. - observation_id = models.IntegerField(db_column='OBSERVATION_ID') # Field name made lowercase. - turtle = models.ForeignKey(TrtIdentification, models.CASCADE, db_column='TURTLE_ID',related_name='turtle2') # Field name made lowercase. - identification_type = models.ForeignKey(TrtIdentification, models.CASCADE, db_column='IDENTIFICATION_TYPE') # Field name made lowercase. - identifier = models.ForeignKey(TrtIdentification, models.CASCADE, db_column='IDENTIFIER',related_name='identifier2') # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. + recorded_identification_id = models.AutoField( + db_column="RECORDED_IDENTIFICATION_ID", primary_key=True + ) # Field name made lowercase. + observation_id = models.IntegerField( + db_column="OBSERVATION_ID" + ) # Field name made lowercase. + turtle = models.ForeignKey( + TrtIdentification, models.CASCADE, db_column="TURTLE_ID", related_name="turtle2" + ) # Field name made lowercase. + identification_type = models.ForeignKey( + TrtIdentification, models.CASCADE, db_column="IDENTIFICATION_TYPE" + ) # Field name made lowercase. + identifier = models.ForeignKey( + TrtIdentification, + models.CASCADE, + db_column="IDENTIFIER", + related_name="identifier2", + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_RECORDED_IDENTIFICATION' + db_table = "TRT_RECORDED_IDENTIFICATION" class TrtRecordedPitTags(models.Model): - recorded_pittag_id = models.AutoField(db_column='RECORDED_PIT_TAG_ID', primary_key=True) # Field name made lowercase. - observation_id = models.ForeignKey('TrtObservations',models.CASCADE, db_column='OBSERVATION_ID', blank=True, null=True) #fake foreign key #models.IntegerField(db_column='OBSERVATION_ID') # Field name made lowercase. - pittag_id = models.ForeignKey('TrtPitTags',models.CASCADE, db_column='PIT_TAG_ID', blank=True, null=True) #fake foreign key #models.CharField(db_column='pittag_id', max_length=50) # Field name made lowercase. - pit_tag_state = models.ForeignKey(TrtPitTagStates, models.DO_NOTHING, db_column='PIT_TAG_STATE') # Field name made lowercase. - pit_tag_position = models.CharField(db_column='PIT_TAG_POSITION', max_length=10, blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. - turtle_id = models.IntegerField(db_column='TURTLE_ID') # Field name made lowercase. - checked = models.BooleanField(db_column='Checked') # Field name made lowercase. + recorded_pittag_id = models.AutoField( + db_column="RECORDED_PIT_TAG_ID", primary_key=True + ) # Field name made lowercase. + observation_id = models.ForeignKey( + "TrtObservations", + models.CASCADE, + db_column="OBSERVATION_ID", + blank=True, + null=True, + ) # fake foreign key #models.IntegerField(db_column='OBSERVATION_ID') # Field name made lowercase. + pittag_id = models.ForeignKey( + "TrtPitTags", models.CASCADE, db_column="PIT_TAG_ID", blank=True, null=True + ) # fake foreign key #models.CharField(db_column='pittag_id', max_length=50) # Field name made lowercase. + pit_tag_state = models.ForeignKey( + TrtPitTagStates, models.DO_NOTHING, db_column="PIT_TAG_STATE" + ) # Field name made lowercase. + pit_tag_position = models.CharField( + db_column="PIT_TAG_POSITION", max_length=10, blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + turtle_id = models.IntegerField(db_column="TURTLE_ID") # Field name made lowercase. + checked = models.BooleanField(db_column="Checked") # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_RECORDED_PIT_TAGS' + db_table = "TRT_RECORDED_PIT_TAGS" class TrtRecordedTags(models.Model): - recorded_tag_id = models.AutoField(db_column='RECORDED_TAG_ID', primary_key=True) # Field name made lowercase. - observation_id = models.ForeignKey('TrtObservations',models.CASCADE, db_column='OBSERVATION_ID', blank=True, null=True) #fake foreign key #models.IntegerField(db_column='OBSERVATION_ID') # Field name made lowercase. - tag_id = models.ForeignKey('TrtTags',models.CASCADE, db_column='TAG_ID', blank=True, null=True) #fake foreign key #models.CharField(db_column='TAG_ID', max_length=10) # Field name made lowercase. - other_tag_id = models.CharField(db_column='OTHER_TAG_ID', max_length=10, blank=True, null=True) # Field name made lowercase. - side = models.CharField(db_column='SIDE', max_length=1, blank=True, null=True) # Field name made lowercase. - tag_state = models.CharField(db_column='TAG_STATE', max_length=10, blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. - tag_position = models.SmallIntegerField(db_column='TAG_POSITION', blank=True, null=True) # Field name made lowercase. - barnacles = models.BooleanField(db_column='BARNACLES') # Field name made lowercase. - turtle_id = models.IntegerField(db_column='TURTLE_ID') # Field name made lowercase. + recorded_tag_id = models.AutoField( + db_column="RECORDED_TAG_ID", primary_key=True + ) # Field name made lowercase. + observation_id = models.ForeignKey( + "TrtObservations", + models.CASCADE, + db_column="OBSERVATION_ID", + blank=True, + null=True, + ) # fake foreign key #models.IntegerField(db_column='OBSERVATION_ID') # Field name made lowercase. + tag_id = models.ForeignKey( + "TrtTags", models.CASCADE, db_column="TAG_ID", blank=True, null=True + ) # fake foreign key #models.CharField(db_column='TAG_ID', max_length=10) # Field name made lowercase. + other_tag_id = models.CharField( + db_column="OTHER_TAG_ID", max_length=10, blank=True, null=True + ) # Field name made lowercase. + side = models.CharField( + db_column="SIDE", max_length=1, blank=True, null=True + ) # Field name made lowercase. + tag_state = models.CharField( + db_column="TAG_STATE", max_length=10, blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + tag_position = models.SmallIntegerField( + db_column="TAG_POSITION", blank=True, null=True + ) # Field name made lowercase. + barnacles = models.BooleanField(db_column="BARNACLES") # Field name made lowercase. + turtle_id = models.IntegerField(db_column="TURTLE_ID") # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_RECORDED_TAGS' + db_table = "TRT_RECORDED_TAGS" class TrtSamples(models.Model): - sample_id = models.AutoField(db_column='SAMPLE_ID', primary_key=True) # Field name made lowercase. - turtle = models.ForeignKey('TrtTurtles', models.CASCADE, db_column='TURTLE_ID') # Field name made lowercase. - sample_date = models.DateTimeField(db_column='SAMPLE_DATE', blank=True, null=True) # Field name made lowercase. - tissue_type = models.ForeignKey('TrtTissueTypes', models.CASCADE, db_column='TISSUE_TYPE') # Field name made lowercase. - arsenic = models.FloatField(db_column='ARSENIC', blank=True, null=True) # Field name made lowercase. - selenium = models.FloatField(db_column='SELENIUM', blank=True, null=True) # Field name made lowercase. - zinc = models.FloatField(db_column='ZINC', blank=True, null=True) # Field name made lowercase. - cadmium = models.FloatField(db_column='CADMIUM', blank=True, null=True) # Field name made lowercase. - copper = models.FloatField(db_column='COPPER', blank=True, null=True) # Field name made lowercase. - lead = models.FloatField(db_column='LEAD', blank=True, null=True) # Field name made lowercase. - mercury = models.FloatField(db_column='MERCURY', blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. - observation_id = models.IntegerField(db_column='OBSERVATION_ID', blank=True, null=True) # Field name made lowercase. - sample_label = models.CharField(db_column='SAMPLE_LABEL', max_length=50, blank=True, null=True) # Field name made lowercase. + sample_id = models.AutoField( + db_column="SAMPLE_ID", primary_key=True + ) # Field name made lowercase. + turtle = models.ForeignKey( + "TrtTurtles", models.CASCADE, db_column="TURTLE_ID" + ) # Field name made lowercase. + sample_date = models.DateTimeField( + db_column="SAMPLE_DATE", blank=True, null=True + ) # Field name made lowercase. + tissue_type = models.ForeignKey( + "TrtTissueTypes", models.CASCADE, db_column="TISSUE_TYPE" + ) # Field name made lowercase. + arsenic = models.FloatField( + db_column="ARSENIC", blank=True, null=True + ) # Field name made lowercase. + selenium = models.FloatField( + db_column="SELENIUM", blank=True, null=True + ) # Field name made lowercase. + zinc = models.FloatField( + db_column="ZINC", blank=True, null=True + ) # Field name made lowercase. + cadmium = models.FloatField( + db_column="CADMIUM", blank=True, null=True + ) # Field name made lowercase. + copper = models.FloatField( + db_column="COPPER", blank=True, null=True + ) # Field name made lowercase. + lead = models.FloatField( + db_column="LEAD", blank=True, null=True + ) # Field name made lowercase. + mercury = models.FloatField( + db_column="MERCURY", blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + observation_id = models.IntegerField( + db_column="OBSERVATION_ID", blank=True, null=True + ) # Field name made lowercase. + sample_label = models.CharField( + db_column="SAMPLE_LABEL", max_length=50, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_SAMPLES' + db_table = "TRT_SAMPLES" class TrtSighting(models.Model): - sightingid = models.AutoField(db_column='SIGHTINGID', primary_key=True) # Field name made lowercase. - observation_time = models.DateTimeField(db_column='OBSERVATION_TIME', blank=True, null=True) # Field name made lowercase. - observation_date = models.DateTimeField(db_column='OBSERVATION_DATE', blank=True, null=True) # Field name made lowercase. - alive = models.CharField(db_column='ALIVE', max_length=1, blank=True, null=True) # Field name made lowercase. - species_code = models.CharField(db_column='SPECIES_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. - sex = models.CharField(db_column='SEX', max_length=1, blank=True, null=True) # Field name made lowercase. - location_code = models.CharField(db_column='LOCATION_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. - turtle_status = models.CharField(db_column='TURTLE_STATUS', max_length=1, blank=True, null=True) # Field name made lowercase. - place_code = models.CharField(db_column='PLACE_CODE', max_length=4, blank=True, null=True) # Field name made lowercase. - activity_code = models.CharField(db_column='ACTIVITY_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. - beach_position_code = models.CharField(db_column='BEACH_POSITION_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. - datum_code = models.CharField(db_column='DATUM_CODE', max_length=5, blank=True, null=True) # Field name made lowercase. - latitude = models.CharField(db_column='LATITUDE', max_length=7, blank=True, null=True) # Field name made lowercase. - longitude = models.FloatField(db_column='LONGITUDE', blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. - entered_by_person_id = models.IntegerField(db_column='ENTERED_BY_PERSON_ID', blank=True, null=True) # Field name made lowercase. + sightingid = models.AutoField( + db_column="SIGHTINGID", primary_key=True + ) # Field name made lowercase. + observation_time = models.DateTimeField( + db_column="OBSERVATION_TIME", blank=True, null=True + ) # Field name made lowercase. + observation_date = models.DateTimeField( + db_column="OBSERVATION_DATE", blank=True, null=True + ) # Field name made lowercase. + alive = models.CharField( + db_column="ALIVE", max_length=1, blank=True, null=True + ) # Field name made lowercase. + species_code = models.CharField( + db_column="SPECIES_CODE", max_length=2, blank=True, null=True + ) # Field name made lowercase. + sex = models.CharField( + db_column="SEX", max_length=1, blank=True, null=True + ) # Field name made lowercase. + location_code = models.CharField( + db_column="LOCATION_CODE", max_length=2, blank=True, null=True + ) # Field name made lowercase. + turtle_status = models.CharField( + db_column="TURTLE_STATUS", max_length=1, blank=True, null=True + ) # Field name made lowercase. + place_code = models.CharField( + db_column="PLACE_CODE", max_length=4, blank=True, null=True + ) # Field name made lowercase. + activity_code = models.CharField( + db_column="ACTIVITY_CODE", max_length=2, blank=True, null=True + ) # Field name made lowercase. + beach_position_code = models.CharField( + db_column="BEACH_POSITION_CODE", max_length=2, blank=True, null=True + ) # Field name made lowercase. + datum_code = models.CharField( + db_column="DATUM_CODE", max_length=5, blank=True, null=True + ) # Field name made lowercase. + latitude = models.CharField( + db_column="LATITUDE", max_length=7, blank=True, null=True + ) # Field name made lowercase. + longitude = models.FloatField( + db_column="LONGITUDE", blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + entered_by_person_id = models.IntegerField( + db_column="ENTERED_BY_PERSON_ID", blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_SIGHTING' + db_table = "TRT_SIGHTING" class TrtSpecies(models.Model): - species_code = models.CharField(db_column='SPECIES_CODE', primary_key=True, max_length=2) # Field name made lowercase. - scientific_name = models.CharField(db_column='SCIENTIFIC_NAME', max_length=50, blank=True, null=True) # Field name made lowercase. - common_name = models.CharField(db_column='COMMON_NAME', max_length=50, blank=True, null=True) # Field name made lowercase. - old_species_code = models.CharField(db_column='OLD_SPECIES_CODE', max_length=2, blank=True, null=True) # Field name made lowercase. - hide_dataentry = models.BooleanField(db_column='Hide_DataEntry') # Field name made lowercase. + species_code = models.CharField( + db_column="SPECIES_CODE", primary_key=True, max_length=2 + ) # Field name made lowercase. + scientific_name = models.CharField( + db_column="SCIENTIFIC_NAME", max_length=50, blank=True, null=True + ) # Field name made lowercase. + common_name = models.CharField( + db_column="COMMON_NAME", max_length=50, blank=True, null=True + ) # Field name made lowercase. + old_species_code = models.CharField( + db_column="OLD_SPECIES_CODE", max_length=2, blank=True, null=True + ) # Field name made lowercase. + hide_dataentry = models.BooleanField( + db_column="Hide_DataEntry" + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_SPECIES' + db_table = "TRT_SPECIES" def __str__(self): return f"{self.common_name}" + class TrtTags(models.Model): - tag_id = models.CharField(db_column='TAG_ID', primary_key=True, max_length=10) # Field name made lowercase. - tag_order_id = models.IntegerField(db_column='TAG_ORDER_ID', blank=True, null=True) # Field name made lowercase. - issue_location = models.CharField(db_column='ISSUE_LOCATION', max_length=50, blank=True, null=True) # Field name made lowercase. - custodian_person_id = models.IntegerField(db_column='CUSTODIAN_PERSON_ID', blank=True, null=True) # Field name made lowercase. - turtle = models.ForeignKey('TrtTurtles', models.SET_NULL, db_column='TURTLE_ID', blank=True, null=True) # Field name made lowercase. - side = models.CharField(db_column='SIDE', max_length=1, blank=True, null=True) # Field name made lowercase. - tag_status = models.ForeignKey('TrtTagStatus', models.SET_NULL, db_column='TAG_STATUS', blank=True, null=True) # Field name made lowercase. - return_date = models.DateTimeField(db_column='RETURN_DATE', blank=True, null=True) # Field name made lowercase. - return_condition = models.CharField(db_column='RETURN_CONDITION', max_length=50, blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. - field_person_id = models.IntegerField(db_column='FIELD_PERSON_ID', blank=True, null=True) # Field name made lowercase. + tag_id = models.CharField( + db_column="TAG_ID", primary_key=True, max_length=10 + ) # Field name made lowercase. + tag_order_id = models.IntegerField( + db_column="TAG_ORDER_ID", blank=True, null=True + ) # Field name made lowercase. + issue_location = models.CharField( + db_column="ISSUE_LOCATION", max_length=50, blank=True, null=True + ) # Field name made lowercase. + custodian_person_id = models.IntegerField( + db_column="CUSTODIAN_PERSON_ID", blank=True, null=True + ) # Field name made lowercase. + turtle = models.ForeignKey( + "TrtTurtles", models.SET_NULL, db_column="TURTLE_ID", blank=True, null=True + ) # Field name made lowercase. + side = models.CharField( + db_column="SIDE", max_length=1, blank=True, null=True + ) # Field name made lowercase. + tag_status = models.ForeignKey( + "TrtTagStatus", models.SET_NULL, db_column="TAG_STATUS", blank=True, null=True + ) # Field name made lowercase. + return_date = models.DateTimeField( + db_column="RETURN_DATE", blank=True, null=True + ) # Field name made lowercase. + return_condition = models.CharField( + db_column="RETURN_CONDITION", max_length=50, blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + field_person_id = models.IntegerField( + db_column="FIELD_PERSON_ID", blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_TAGS' - unique_together = (('tag_id', 'turtle'),) + db_table = "TRT_TAGS" + unique_together = (("tag_id", "turtle"),) verbose_name = "Flipper tag" - ordering = ["tag_id",] + ordering = [ + "tag_id", + ] def __str__(self): return f"{self.tag_id}" + class TrtTagOrders(models.Model): - tag_order_id = models.AutoField(db_column='TAG_ORDER_ID', primary_key=True) # Field name made lowercase. - order_date = models.DateTimeField(db_column='ORDER_DATE', blank=True, null=True) # Field name made lowercase. - order_number = models.CharField(db_column='ORDER_NUMBER', max_length=20) # Field name made lowercase. - tag_prefix = models.CharField(db_column='TAG_PREFIX', max_length=10, blank=True, null=True) # Field name made lowercase. - start_tag_number = models.IntegerField(db_column='START_TAG_NUMBER', blank=True, null=True) # Field name made lowercase. - end_tag_number = models.IntegerField(db_column='END_TAG_NUMBER', blank=True, null=True) # Field name made lowercase. - total_tags = models.SmallIntegerField(db_column='TOTAL_TAGS', blank=True, null=True) # Field name made lowercase. - date_received = models.DateTimeField(db_column='DATE_RECEIVED', blank=True, null=True) # Field name made lowercase. - paid_by = models.CharField(db_column='PAID_BY', max_length=255, blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. + tag_order_id = models.AutoField( + db_column="TAG_ORDER_ID", primary_key=True + ) # Field name made lowercase. + order_date = models.DateTimeField( + db_column="ORDER_DATE", blank=True, null=True + ) # Field name made lowercase. + order_number = models.CharField( + db_column="ORDER_NUMBER", max_length=20 + ) # Field name made lowercase. + tag_prefix = models.CharField( + db_column="TAG_PREFIX", max_length=10, blank=True, null=True + ) # Field name made lowercase. + start_tag_number = models.IntegerField( + db_column="START_TAG_NUMBER", blank=True, null=True + ) # Field name made lowercase. + end_tag_number = models.IntegerField( + db_column="END_TAG_NUMBER", blank=True, null=True + ) # Field name made lowercase. + total_tags = models.SmallIntegerField( + db_column="TOTAL_TAGS", blank=True, null=True + ) # Field name made lowercase. + date_received = models.DateTimeField( + db_column="DATE_RECEIVED", blank=True, null=True + ) # Field name made lowercase. + paid_by = models.CharField( + db_column="PAID_BY", max_length=255, blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_TAG_ORDERS' + db_table = "TRT_TAG_ORDERS" verbose_name = "Tag Order" # Singular name for one object verbose_name_plural = "Tag Orders" - + def __str__(self): return f"{self.tag_order_id}" class TrtTagStates(models.Model): - tag_state = models.CharField(db_column='TAG_STATE', primary_key=True, max_length=10) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. - tag_status = models.CharField(db_column='TAG_STATUS', max_length=10, blank=True, null=True) # Field name made lowercase. - existing_tag_list = models.BooleanField(db_column='EXISTING_TAG_LIST') # Field name made lowercase. - new_tag_list = models.BooleanField(db_column='NEW_TAG_LIST') # Field name made lowercase. + tag_state = models.CharField( + db_column="TAG_STATE", primary_key=True, max_length=10 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. + tag_status = models.CharField( + db_column="TAG_STATUS", max_length=10, blank=True, null=True + ) # Field name made lowercase. + existing_tag_list = models.BooleanField( + db_column="EXISTING_TAG_LIST" + ) # Field name made lowercase. + new_tag_list = models.BooleanField( + db_column="NEW_TAG_LIST" + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_TAG_STATES' + db_table = "TRT_TAG_STATES" + def __str__(self): return f"{self.description}" + class TrtTagStatus(models.Model): - tag_status = models.CharField(db_column='TAG_STATUS', primary_key=True, max_length=10) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. + tag_status = models.CharField( + db_column="TAG_STATUS", primary_key=True, max_length=10 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_TAG_STATUS' + db_table = "TRT_TAG_STATUS" + def __str__(self): return f"{self.description}" + class TrtTissueTypes(models.Model): - tissue_type = models.CharField(db_column='TISSUE_TYPE', primary_key=True, max_length=5) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=50) # Field name made lowercase. + tissue_type = models.CharField( + db_column="TISSUE_TYPE", primary_key=True, max_length=5 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=50 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_TISSUE_TYPES' + db_table = "TRT_TISSUE_TYPES" class TrtTurtles(models.Model): - turtle_id = models.AutoField(db_column='TURTLE_ID', primary_key=True) #models.IntegerField(db_column='TURTLE_ID', primary_key=True) # Field name made lowercase. - species_code = models.ForeignKey(TrtSpecies, models.DO_NOTHING, db_column='SPECIES_CODE') # Field name made lowercase. - identification_confidence = models.CharField(db_column='IDENTIFICATION_CONFIDENCE', max_length=1, blank=True, null=True) # Field name made lowercase. - sex = models.CharField(db_column='SEX', max_length=1) # Field name made lowercase. - turtle_status = models.ForeignKey('TrtTurtleStatus', models.SET_NULL, db_column='TURTLE_STATUS', blank=True, null=True) # Field name made lowercase. - location_code = models.ForeignKey(TrtLocations, models.SET_NULL, db_column='LOCATION_CODE', blank=True, null=True) # Field name made lowercase. - cause_of_death = models.ForeignKey(TrtCauseOfDeath, models.SET_NULL, db_column='CAUSE_OF_DEATH', blank=True, null=True) # Field name made lowercase. - re_entered_population = models.CharField(db_column='RE_ENTERED_POPULATION', max_length=1, blank=True, null=True) # Field name made lowercase. - comments = models.CharField(db_column='COMMENTS', max_length=255, blank=True, null=True) # Field name made lowercase. - entered_by = models.CharField(db_column='ENTERED_BY', max_length=50, blank=True, null=True) # Field name made lowercase. - date_entered = models.DateTimeField(db_column='DATE_ENTERED', blank=True, null=True) # Field name made lowercase. - original_turtle_id = models.IntegerField(db_column='ORIGINAL_TURTLE_ID', blank=True, null=True) # Field name made lowercase. - entry_batch_id = models.IntegerField(db_column='ENTRY_BATCH_ID', blank=True, null=True) # Field name made lowercase. - tag = models.CharField(db_column='Tag', max_length=255, blank=True, null=True) # Field name made lowercase. - mund_id = models.CharField(db_column='Mund_ID', max_length=255, blank=True, null=True) # Field name made lowercase. - turtle_name = models.CharField(db_column='TURTLE_NAME', max_length=50, blank=True, null=True) # Field name made lowercase. + turtle_id = models.AutoField( + db_column="TURTLE_ID", primary_key=True + ) # models.IntegerField(db_column='TURTLE_ID', primary_key=True) # Field name made lowercase. + species_code = models.ForeignKey( + TrtSpecies, models.DO_NOTHING, db_column="SPECIES_CODE" + ) # Field name made lowercase. + identification_confidence = models.CharField( + db_column="IDENTIFICATION_CONFIDENCE", max_length=1, blank=True, null=True + ) # Field name made lowercase. + sex = models.CharField(db_column="SEX", max_length=1) # Field name made lowercase. + turtle_status = models.ForeignKey( + "TrtTurtleStatus", + models.SET_NULL, + db_column="TURTLE_STATUS", + blank=True, + null=True, + ) # Field name made lowercase. + location_code = models.ForeignKey( + TrtLocations, models.SET_NULL, db_column="LOCATION_CODE", blank=True, null=True + ) # Field name made lowercase. + cause_of_death = models.ForeignKey( + TrtCauseOfDeath, + models.SET_NULL, + db_column="CAUSE_OF_DEATH", + blank=True, + null=True, + ) # Field name made lowercase. + re_entered_population = models.CharField( + db_column="RE_ENTERED_POPULATION", max_length=1, blank=True, null=True + ) # Field name made lowercase. + comments = models.CharField( + db_column="COMMENTS", max_length=255, blank=True, null=True + ) # Field name made lowercase. + entered_by = models.CharField( + db_column="ENTERED_BY", max_length=50, blank=True, null=True + ) # Field name made lowercase. + date_entered = models.DateTimeField( + db_column="DATE_ENTERED", blank=True, null=True + ) # Field name made lowercase. + original_turtle_id = models.IntegerField( + db_column="ORIGINAL_TURTLE_ID", blank=True, null=True + ) # Field name made lowercase. + entry_batch_id = models.IntegerField( + db_column="ENTRY_BATCH_ID", blank=True, null=True + ) # Field name made lowercase. + tag = models.CharField( + db_column="Tag", max_length=255, blank=True, null=True + ) # Field name made lowercase. + mund_id = models.CharField( + db_column="Mund_ID", max_length=255, blank=True, null=True + ) # Field name made lowercase. + turtle_name = models.CharField( + db_column="TURTLE_NAME", max_length=50, blank=True, null=True + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_TURTLES' + db_table = "TRT_TURTLES" verbose_name = "Turtle" - ordering=['turtle_id'] + ordering = ["turtle_id"] def __str__(self): return f"{self.turtle_id}" - + def get_tags_description(self): - """Returns a comma-separated list of tag serial numbers for this turtle. - """ + """Returns a comma-separated list of tag serial numbers for this turtle.""" tags = [] for tag in self.trttags_set.all(): tags.append(str(tag)) @@ -844,25 +2010,37 @@ def get_tags_description(self): tags.append(str(tag)) return ", ".join(tags) + class TrtTurtleStatus(models.Model): - turtle_status = models.CharField(db_column='TURTLE_STATUS', primary_key=True, max_length=1) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=100) # Field name made lowercase. - new_tag_list = models.BooleanField(db_column='NEW_TAG_LIST') # Field name made lowercase. + turtle_status = models.CharField( + db_column="TURTLE_STATUS", primary_key=True, max_length=1 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=100 + ) # Field name made lowercase. + new_tag_list = models.BooleanField( + db_column="NEW_TAG_LIST" + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_TURTLE_STATUS' + db_table = "TRT_TURTLE_STATUS" + def __str__(self): return f"{self.description}" class TrtYesNo(models.Model): - code = models.CharField(db_column='CODE', primary_key=True, max_length=1) # Field name made lowercase. - description = models.CharField(db_column='DESCRIPTION', max_length=10) # Field name made lowercase. + code = models.CharField( + db_column="CODE", primary_key=True, max_length=1 + ) # Field name made lowercase. + description = models.CharField( + db_column="DESCRIPTION", max_length=10 + ) # Field name made lowercase. class Meta: managed = False - db_table = 'TRT_YES_NO' + db_table = "TRT_YES_NO" def __str__(self): return f"{self.description}" diff --git a/wastd/settings.py b/wastd/settings.py index 4ad45ec19..c48076702 100644 --- a/wastd/settings.py +++ b/wastd/settings.py @@ -75,7 +75,6 @@ "easy_select2", "djgeojson", "import_export", - #'rest_framework', # Local apps "users", "observations", diff --git a/wastd/urls.py b/wastd/urls.py index 4ed5d18f9..a8dbeb9e9 100644 --- a/wastd/urls.py +++ b/wastd/urls.py @@ -17,7 +17,7 @@ path("logout/", LogoutView.as_view(template_name="logged_out.html"), name="logout"), path("grappelli/", include("grappelli.urls")), #path("grappelli-docs/", include('grappelli.urls_docs')), - path('_nested_admin/', include('nested_admin.urls')), + path('_nested_admin/', include('nested_admin.urls')), path("admin/", admin.site.urls), #path("ajax_select/", include("ajax_select.urls")), path("select2/", include("django_select2.urls")),