Skip to content

Commit

Permalink
disable rate limits
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos committed Jul 10, 2024
1 parent 1cb7933 commit 61e6730
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
30 changes: 29 additions & 1 deletion backend/project/api/serializers/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,36 @@ class Meta(ObservationMixin.Meta):
fields = ObservationMixin.Meta.fields + ("medias",)


class AreaBBoxSerializer(serializers.ModelSerializer):
north_west = serializers.ListSerializer(
source="north_west.coords",
child=serializers.FloatField(),
max_length=2,
min_length=2,
)
south_east = serializers.ListSerializer(
source="south_east.coords",
child=serializers.FloatField(),
max_length=2,
min_length=2,
)

class Meta:
model = Area
fields = ("north_west", "south_east")


class AreaSerializer(serializers.ModelSerializer):
bbox = serializers.SerializerMethodField()
bbox2 = AreaBBoxSerializer(source="*")
bbox = serializers.ListSerializer(
child=serializers.ListSerializer(
child=serializers.FloatField(),
max_length=2,
min_length=2,
),
max_length=2,
min_length=2,
)

def get_bbox(self, obj):
return [obj.north_west.coords, obj.south_east.coords]
Expand Down
2 changes: 1 addition & 1 deletion backend/project/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"rest_framework.throttling.AnonRateThrottle",
"rest_framework.throttling.UserRateThrottle",
],
"DEFAULT_THROTTLE_RATES": {"anon": "100/day", "user": "1000/day"},
# "DEFAULT_THROTTLE_RATES": {"anon": "100/day", "user": "1000/day"},
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework.authentication.BasicAuthentication",
"rest_framework_simplejwt.authentication.JWTAuthentication",
Expand Down

0 comments on commit 61e6730

Please sign in to comment.