Skip to content

Commit

Permalink
Merge pull request #530 from dbca-wa/wamtram2
Browse files Browse the repository at this point in the history
Wamtram2
  • Loading branch information
ehallein authored Jan 8, 2024
2 parents 7876733 + 5513d97 commit fe5697f
Show file tree
Hide file tree
Showing 59 changed files with 4,908 additions and 3,036 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL org.opencontainers.image.source https://github.com/dbca-wa/wastd

RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y libmagic-dev gcc binutils gdal-bin proj-bin python3-dev libpq-dev gzip curl gnupg2
&& apt-get install -y memcached libmagic-dev gcc binutils gdal-bin proj-bin python3-dev libpq-dev gzip curl gnupg2

# Install the Microsoft ODBC driver for SQL Server.
# Reference: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16#debian18
Expand All @@ -31,16 +31,16 @@ RUN poetry config virtualenvs.create false \

# Install the project.
FROM python_libs_wastd
COPY gunicorn.py manage.py ./
COPY gunicorn.py manage.py run.sh ./
RUN chmod +x run.sh
COPY observations ./observations
COPY users ./users
COPY wastd ./wastd
COPY wamtram ./wamtram
COPY turtle_tags ./turtle_tags
COPY wamtram2 ./wamtram2
COPY marine_mammal_incidents ./marine_mammal_incidents
RUN python manage.py collectstatic --noinput

# Run the application as the www-data user.
USER www-data
EXPOSE 8080
CMD ["gunicorn", "wastd.wsgi", "--config", "gunicorn.py"]
ENTRYPOINT [ "sh","run.sh" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 4.2.8 on 2023-12-14 03:55

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
("contenttypes", "0002_remove_content_type_name"),
("observations", "0012_alter_encounter_encounter_type"),
]

operations = [
migrations.AlterField(
model_name="encounter",
name="polymorphic_ctype",
field=models.ForeignKey(
editable=False,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="polymorphic_%(app_label)s.%(class)s_set+",
to="contenttypes.contenttype",
),
),
migrations.AlterField(
model_name="observation",
name="polymorphic_ctype",
field=models.ForeignKey(
editable=False,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="polymorphic_%(app_label)s.%(class)s_set+",
to="contenttypes.contenttype",
),
),
]
22 changes: 11 additions & 11 deletions observations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from django.contrib.gis.db import models
from django.template import loader
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.safestring import mark_safe
from django_fsm import FSMField, transition
from django_fsm_log.decorators import fsm_log_by, fsm_log_description
Expand Down Expand Up @@ -814,7 +814,7 @@ def __str__(self):
def filepath(self):
"""The path to attached file."""
try:
fpath = force_text(self.attachment.file)
fpath = force_str(self.attachment.file)
except BaseException:
fpath = None
return fpath
Expand Down Expand Up @@ -1271,8 +1271,8 @@ def short_name(self):
"-".join(
[
self.when.astimezone(tz.tzlocal()).strftime("%Y-%m-%d %H:%M %Z"),
force_text(round(self.longitude, 4)).replace(".", "-"),
force_text(round(self.latitude, 4)).replace(".", "-"),
force_str(round(self.longitude, 4)).replace(".", "-"),
force_str(round(self.latitude, 4)).replace(".", "-"),
]
)
)
Expand Down Expand Up @@ -1686,8 +1686,8 @@ def short_name(self):
"""
nameparts = [
self.when.astimezone(tz.tzlocal()).strftime("%Y-%m-%d %H:%M %Z"),
force_text(round(self.longitude, 4)).replace(".", "-"),
force_text(round(self.latitude, 4)).replace(".", "-"),
force_str(round(self.longitude, 4)).replace(".", "-"),
force_str(round(self.latitude, 4)).replace(".", "-"),
self.health,
self.maturity,
self.sex,
Expand Down Expand Up @@ -1868,8 +1868,8 @@ def short_name(self):
"""
nameparts = [
self.when.astimezone(tz.tzlocal()).strftime("%Y-%m-%d %H:%M %Z"),
force_text(round(self.longitude, 4)).replace(".", "-"),
force_text(round(self.latitude, 4)).replace(".", "-"),
force_str(round(self.longitude, 4)).replace(".", "-"),
force_str(round(self.latitude, 4)).replace(".", "-"),
self.nest_age,
self.species,
]
Expand Down Expand Up @@ -2025,7 +2025,7 @@ def __str__(self):
def filepath(self):
"""The path to attached file."""
try:
fpath = force_text(self.attachment.file)
fpath = force_str(self.attachment.file)
except BaseException:
fpath = None
return fpath
Expand Down Expand Up @@ -3117,8 +3117,8 @@ def short_name(self):
"""
nameparts = [
self.when.astimezone(tz.tzlocal()).strftime("%Y-%m-%d %H:%M %Z"),
force_text(round(self.longitude, 4)).replace(".", "-"),
force_text(round(self.latitude, 4)).replace(".", "-"),
force_str(round(self.longitude, 4)).replace(".", "-"),
force_str(round(self.latitude, 4)).replace(".", "-"),
]
if self.name is not None:
nameparts.append(self.name)
Expand Down
6 changes: 3 additions & 3 deletions observations/odk.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,9 @@ def import_site_visit_end(form_id="site_visit_end", duration_hr=8, auth_headers=
msg.send(fail_silently=True)

#send an email with errors if needed
if emailText != None:
msg = EmailMultiAlternatives("Wastd import Errors", emailText, settings.DEFAULT_FROM_EMAIL, settings.ADMIN_EMAILS)
msg.send(fail_silently=True)
# if emailText != None:
# msg = EmailMultiAlternatives("Wastd import Errors", emailText, settings.DEFAULT_FROM_EMAIL, settings.ADMIN_EMAILS)
# msg.send(fail_silently=True)


def import_marine_wildlife_incident(form_id="marine_wildlife_incident", auth_headers=None):
Expand Down
Loading

0 comments on commit fe5697f

Please sign in to comment.