From c1974385bc90879729b5e7abd51488f1b4fc5628 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Mon, 14 Aug 2023 14:34:24 +0545 Subject: [PATCH] Fix bugs on Feedback label overwrite --- backend/core/admin.py | 15 +++++++-------- backend/core/serializers.py | 4 ++-- backend/core/views.py | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/backend/core/admin.py b/backend/core/admin.py index e6daf9dd..ccd5af55 100644 --- a/backend/core/admin.py +++ b/backend/core/admin.py @@ -7,12 +7,12 @@ @admin.register(Dataset) -class DatasetAdmin(geoadmin.GeoModelAdmin): +class DatasetAdmin(geoadmin.OSMGeoAdmin): list_display = ["name", "created_by"] @admin.register(Model) -class ModelAdmin(geoadmin.GeoModelAdmin): +class ModelAdmin(geoadmin.OSMGeoAdmin): list_display = ["get_dataset_id", "name", "status", "created_at", "created_by"] def get_dataset_id(self, obj): @@ -22,7 +22,7 @@ def get_dataset_id(self, obj): @admin.register(Training) -class TrainingAdmin(geoadmin.GeoModelAdmin): +class TrainingAdmin(geoadmin.OSMGeoAdmin): list_display = [ "get_model_id", "description", @@ -39,12 +39,11 @@ def get_model_id(self, obj): get_model_id.short_description = "Model" -# dsaf @admin.register(FeedbackAOI) -class FeedbackAOIAdmin(geoadmin.GeoModelAdmin): +class FeedbackAOIAdmin(geoadmin.OSMGeoAdmin): list_display = ["training", "user"] -@admin.register(FeedbackLabel) -class FeedbackLabelAdmin(geoadmin.GeoModelAdmin): - list_display = ["feedback_aoi", "created_at"] +@admin.register(Feedback) +class FeedbackAdmin(geoadmin.OSMGeoAdmin): + list_display = ["feedback_type", "training", "user", "created_at"] diff --git a/backend/core/serializers.py b/backend/core/serializers.py index 89066224..223413e5 100644 --- a/backend/core/serializers.py +++ b/backend/core/serializers.py @@ -109,7 +109,7 @@ class Meta: # auto_bbox = True fields = "__all__" - read_only_fields = ("created_at", "osm_id") + # read_only_fields = ("created_at", "osm_id") class FeedbackLabelSerializer(GeoFeatureModelSerializer): @@ -117,7 +117,7 @@ class Meta: model = FeedbackLabel geo_field = "geom" fields = "__all__" - read_only_fields = ("created_at", "osm_id") + # read_only_fields = ("created_at", "osm_id") class LabelFileSerializer( diff --git a/backend/core/views.py b/backend/core/views.py index b56ba774..765f1485 100644 --- a/backend/core/views.py +++ b/backend/core/views.py @@ -244,8 +244,8 @@ class LabelViewSet(viewsets.ModelViewSet): class RawdataApiFeedbackView(APIView): - authentication_classes = [OsmAuthentication] - permission_classes = [IsOsmAuthenticated] + # authentication_classes = [OsmAuthentication] + # permission_classes = [IsOsmAuthenticated] def post(self, request, feedbackaoi_id, *args, **kwargs): """Downloads available osm data as labels within given feedback aoi