mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-24 09:14:46 +01:00
bdfe09a06b
* add property type and format and set them for * add a failing test * with passing tests on the ee property definition model * Add a migration to set as a DateTime * Clarify in failing test that it's only list lookup failing * add empty property definition fields to assertions * fix merge error * clarify tests * add more supported types
30 lines
1000 B
Python
30 lines
1000 B
Python
from rest_framework import serializers
|
|
|
|
from ee.models.property_definition import EnterprisePropertyDefinition
|
|
from posthog.api.shared import UserBasicSerializer
|
|
|
|
|
|
class EnterprisePropertyDefinitionSerializer(serializers.ModelSerializer):
|
|
updated_by = UserBasicSerializer(read_only=True)
|
|
|
|
class Meta:
|
|
model = EnterprisePropertyDefinition
|
|
fields = (
|
|
"id",
|
|
"name",
|
|
"description",
|
|
"tags",
|
|
"is_numerical",
|
|
"updated_at",
|
|
"updated_by",
|
|
"query_usage_30_day",
|
|
"is_event_property",
|
|
"property_type",
|
|
"property_type_format",
|
|
)
|
|
read_only_fields = ["id", "name", "is_numerical", "query_usage_30_day", "is_event_property"]
|
|
|
|
def update(self, event_definition: EnterprisePropertyDefinition, validated_data):
|
|
validated_data["updated_by"] = self.context["request"].user
|
|
return super().update(event_definition, validated_data)
|