This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### 로 시작하는 부분을 본인이 수정해서 사용. | |
| 당신은 이제 스타트업 전문가입니다. 특히 스타트업에 도움이 되는 책들은 모두 섭렵하고 실제로 성공적인 스타트업을 운영한 성공한 사업가 입니다. | |
| 이제 당신의 역할에 충실하여 대답해주세요. | |
| 저는 아이디어와 관계 없이 제품을 만드는 순서를 다음과 같이 정의했습니다. | |
| 1. 아이디어 도출 및 문제 정의 / 결과물: 문제 정의서, 주요 기능 리스트 | |
| 2. 제품 기획 / 결과물: 요구사항 명세서 | |
| 3. 디자인 / 결과물: UI/UX 디자인 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @property | |
| def validated_data(self): | |
| if not hasattr(self, '_validated_data'): | |
| msg = 'You must call `.is_valid()` before accessing `.validated_data`.' | |
| raise AssertionError(msg) | |
| return self._validated_data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseSerializer(Field): | |
| def __init__(self, instance=None, data=empty, **kwargs): | |
| self.instance = instance | |
| if data is not empty: | |
| self.initial_data = data | |
| self.partial = kwargs.pop('partial', False) | |
| self._context = kwargs.pop('context', {}) | |
| kwargs.pop('many', None) | |
| super().__init__(**kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| serializer = CommentSerializer(data=comment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseSerializer(Field): | |
| """ | |
| The BaseSerializer class provides a minimal class which may be used | |
| for writing custom serializer implementations. | |
| Note that we strongly restrict the ordering of operations/properties | |
| that may be used on the serializer in order to enforce correct usage. | |
| BaseSerializer 클래스는 커스텀시리얼라이저 구현 작성에 사용할 수 있는 최소한의 클래스를 제공합니다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class GroupAPIView(GenericAPIView): | |
| serializer_class = GroupReadSerializer | |
| def get(self, request: Request): | |
| ... | |
| serializer = self.get_read_serializer(group) | |
| return Response(serializer.data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class GroupAPIView(GenericAPIView): | |
| serializer_class = GroupReadSerializer | |
| def get(self, request: Request): | |
| ... | |
| serializer = self.get_read_serializer(data=group) | |
| return Response(serializer.data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class GroupAPIView(GenericAPIView): | |
| read_serializer_class = GroupReadSerializer | |
| def get(self, request: Request): | |
| ... | |
| serializer = self.get_read_serializer(data=group) | |
| if not serializer.is_valid(raise_exception=False): | |
| raise ValidationError(MetaType.parse_error) | |
| return Response(serializer.data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| serializer = CommentSerializer(comment) | |
| serializer.data | |
| # {'email': 'leila@example.com', 'content': 'foo bar', 'created': '2016-01-27T15:17:10.375877'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from rest_framework import serializers | |
| class CommentSerializer(serializers.Serializer): | |
| email = serializers.EmailField() | |
| content = serializers.CharField(max_length=200) | |
| created = serializers.DateTimeField() |
NewerOlder