Use singular form for Tag API class names

This commit is contained in:
Christopher C. Wells 2022-04-03 17:06:02 -07:00
parent 1398239ecf
commit 908d7df5e4
3 changed files with 4 additions and 4 deletions

View File

@ -202,7 +202,7 @@ class BMISerializer(CoreModelSerializer):
fields = ("id", "child", "bmi", "date", "notes") fields = ("id", "child", "bmi", "date", "notes")
class TagsSerializer(serializers.HyperlinkedModelSerializer): class TagSerializer(serializers.HyperlinkedModelSerializer):
class Meta: class Meta:
model = models.Tag model = models.Tag
fields = ("slug", "name", "color", "last_used") fields = ("slug", "name", "color", "last_used")

View File

@ -18,7 +18,7 @@ router.register(r"weight", views.WeightViewSet)
router.register(r"height", views.HeightViewSet) router.register(r"height", views.HeightViewSet)
router.register(r"head-circumference", views.HeadCircumferenceViewSet) router.register(r"head-circumference", views.HeadCircumferenceViewSet)
router.register(r"bmi", views.BMIViewSet) router.register(r"bmi", views.BMIViewSet)
router.register(r"tags", views.TagsViewSet) router.register(r"tags", views.TagViewSet)
app_name = "api" app_name = "api"

View File

@ -94,8 +94,8 @@ class BMIViewSet(viewsets.ModelViewSet):
filterset_fields = ("child", "date") filterset_fields = ("child", "date")
class TagsViewSet(viewsets.ModelViewSet): class TagViewSet(viewsets.ModelViewSet):
queryset = models.Tag.objects.all() queryset = models.Tag.objects.all()
serializer_class = serializers.TagsSerializer serializer_class = serializers.TagSerializer
lookup_field = "slug" lookup_field = "slug"
filterset_fields = ("last_used", "name") filterset_fields = ("last_used", "name")