Skip to content

Commit

Permalink
Merge pull request hotosm#150 from hotosm/hotfix/feedback_labels
Browse files Browse the repository at this point in the history
Hot Fix : Patch on feedback labels overwrite
  • Loading branch information
kshitijrajsharma authored Aug 14, 2023
2 parents 2a51106 + c197438 commit 3c99fa4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
15 changes: 7 additions & 8 deletions backend/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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",
Expand All @@ -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"]
4 changes: 2 additions & 2 deletions backend/core/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ class Meta:
# auto_bbox = True
fields = "__all__"

read_only_fields = ("created_at", "osm_id")
# read_only_fields = ("created_at", "osm_id")


class FeedbackLabelSerializer(GeoFeatureModelSerializer):
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(
Expand Down
4 changes: 2 additions & 2 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3c99fa4

Please sign in to comment.