Skip to content

Commit 43de852

Browse files
committed
feat(bulk-upload): add file size limit
1 parent 87197e1 commit 43de852

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

local_units/serializers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,8 @@ class Meta:
699699
def validate_file(self, file):
700700
if not file.name.endswith(".csv"):
701701
raise serializers.ValidationError(gettext("File must be a CSV file."))
702+
if file.size > 10 * 1024 * 1024:
703+
raise serializers.ValidationError(gettext("File must be less than 10 MB."))
702704
return file
703705

704706
def get_file_name(self, obj):

local_units/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ class ExternallyManagedLocalUnitViewSet(
401401
class LocalUnitBulkUploadViewSet(
402402
mixins.CreateModelMixin,
403403
mixins.ListModelMixin,
404+
mixins.RetrieveModelMixin,
404405
viewsets.GenericViewSet,
405406
):
406407
queryset = LocalUnitBulkUpload.objects.select_related("country", "local_unit_type", "triggered_by").order_by("-triggered_at")

notifications/templates/email/local_units/local_unit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h3>Dear {{full_name}}</h3>
1616

1717
{% if update_local_unit %}
1818
<td align="center" class="pb-30">
19-
The local unit "{{local_branch_name}}" in {{country}} has been updated. Reason:"{{update_reason_overview}}" and is awaiting your validation. Kindly review the information and validate or delete as necessary.
19+
The local unit "{{local_branch_name}}" in {{country}} has been updated. Reason: {{update_reason_overview}} and is awaiting your validation. Kindly review the information and validate or delete as necessary.
2020
You can view the updated local unit <a href="{{ frontend_url }}/countries/{{country_id}}/ns-overview/context-and-structure" target="_blank" class="link" style="font-family: 'Lato', Arial, sans-serif;text-decoration: underline;color: #000;">here.</a>
2121
</td>
2222
{% endif %}

0 commit comments

Comments
 (0)