`code` was ambiguous next to Python's own use of "code"; `action_code` names its actual role (a click-action lookup key). click_object_id_value pairs it consistently with action_code. Renamed on both PushMessage and NotificationLink via a data-preserving RenameField migration, threaded through the serializer, admin, bulk-push path, and docs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
29 lines
707 B
Python
29 lines
707 B
Python
from rest_framework import serializers
|
|
|
|
from .models import PushUser, PushMessage
|
|
|
|
|
|
class PushUserSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = PushUser
|
|
fields = (
|
|
"user",
|
|
"client_token",
|
|
"application_token"
|
|
)
|
|
|
|
class PushMessageSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = PushMessage
|
|
fields = (
|
|
"push_user",
|
|
"application",
|
|
"title",
|
|
"message",
|
|
"priority",
|
|
"extras",
|
|
"click_url",
|
|
"action_code",
|
|
"click_object_id_value",
|
|
)
|
|
read_only_fields = ("push_user","application")
|