Skip to content

Commit

Permalink
update translations
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos committed Jul 8, 2024
1 parent 261a070 commit 1c778f6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
12 changes: 9 additions & 3 deletions backend/project/api/serializers/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
from rest_framework_gis import serializers as gis_serializers
from sorl.thumbnail import get_thumbnail

from project.observations.models import Area, Media, Observation, ObservationCategory
from project.observations.models import (
Area,
Media,
MediaType,
Observation,
ObservationCategory,
)


class ObservationCategorySerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -34,7 +40,7 @@ class ThumbnailSerializer(serializers.Serializer):
def get_thumbnail_by_size(
self, obj, height=100, width=100, format="JPEG", quality=70
):
if obj.media_type == Media.MediaType.IMAGE:
if obj.media_type == MediaType.IMAGE:
return self.context["request"].build_absolute_uri(
get_thumbnail(
obj.media_file, f"{width}x{height}", format=format, quality=quality
Expand Down Expand Up @@ -102,4 +108,4 @@ def get_bbox(self, obj):

class Meta:
model = Area
fields = ("id", "name", "bbox")
fields = ("id", "name", "description", "bbox")
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.6 on 2024-07-08 07:34

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("observations", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name="observation",
name="comments",
field=models.TextField(blank=True, default=""),
),
]
2 changes: 1 addition & 1 deletion backend/project/observations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Observation(TimeStampMixin):
observer = models.ForeignKey(
"accounts.User", on_delete=models.SET_NULL, null=True, blank=True
)
comments = models.TextField()
comments = models.TextField(blank=True, default="")
event_date = models.DateField(default=timezone_today, db_index=True)
source = models.ForeignKey(Source, on_delete=models.SET_NULL, blank=True, null=True)
category = models.ForeignKey(ObservationCategory, on_delete=models.PROTECT)
Expand Down

0 comments on commit 1c778f6

Please sign in to comment.