오늘 배운 것

개발서버가 고쳐졌다고 한다! 어제 작업한 다국어 기능에서 언어를 바꾸는 화면이 잘 동작하는지 확인해 보자. 

 

잘 동작한다. 다만 위에 나오는 'settingsLanguageView' 대신에 '언어 선택'이라고 나오도록 바꿔 보자. apps/_layout.tsx 파일(index.js와 같은 역할을 하는 루트 파일)에다가 다음과 같이 추가해 주었다. 

<Stack.Screen
  name="settingsLanguageView"
  options={{
  headerTitle: t('views.settingsView.language'),
  headerTitleAlign: 'center',
  }}
/>

 

그랬더니 잘 나오더라!

 

 궁금한 점

1. django mixins에 대해 궁금증이 생겼다. 발단은 팀원들과 React의 Compound Component 패턴에 대해서 얘기하면서부터였다. 가령 나는 이런 코드를 본 적이 있다. 

from rest_framework.mixins import ListModelMixin, CreateModelMixin
from rest_framework.generics import GenericAPIView


class ListCreateAPIView(GenericAPIView, ListModelMixin, CreateModelMixin):
	pass

 

여기서 GenericAPIView와 ListModelMixin, CreateModelMixin을 상속받아 APIView의 역할을 하면서도 ListView와 CreateView의 역할을 하는 View를 만들 수 있다고는 알고 있었다. 그런데 막상 Mixins가 구체적으로 왜, 어떻게 상속을 통해 GenericAPIView와 같이 동작할 수 있는지에 대해서는 구체적으로 생각하지 않은 것 같다. 다음에 이 부분에 대해서도 포스팅을 해봐야겠다. 

 

+ Recent posts