tasddc1226 / wanted-lab Goto Github PK
View Code? Open in Web Editor NEWDjango GenericView를 활용한 다국어 지원 자동 완성 검색, 회사명 검색 기능과 생성 REST api 구현 Django 내장 pagination 적용, pytest를 활용한 테스트코드 작성
Django GenericView를 활용한 다국어 지원 자동 완성 검색, 회사명 검색 기능과 생성 REST api 구현 Django 내장 pagination 적용, pytest를 활용한 테스트코드 작성
다중 마이그레이션 테스트
초기에 company.urls.py
에 작성해두었던 endpoint에 대한 순서를 아래와 같이 하였었습니다.
urlpatterns = [
path('companies/', CompanyListCreateView.as_view(), name='companies list'),
path('companies/<str:name>/', CompanyRUDView.as_view(), name='company retrieve'),
path('companies/search/', CompanySearchView.as_view(), name='search company'),
]
위의 경로처럼 Endpoint를 설정하니.. endpoint search
에 대한 동작 자체가 수행되어지지 않았었습니다.
즉 다시말해 자동 완성 검색에 대한 요청을 보내도 위에서 두번째 Url인 search
라는 경로로 빠지게 되는 문제였습니다.
아래와 같이 순서를 변경해주어 이슈를 해결하였습니다.
urlpatterns = [
path('', CompanyListCreateView.as_view(), name='companies list'),
path('search/', CompanySearchView.as_view(), name='search company'),
path('<str:name>/', CompanyRUDView.as_view(), name='company retrieve'),
]
/api/v1/companies/search?query=없는회사
x-wanted-language
value: ko
query로 필터링을 하는데 없는 query를 날리면 전체 회사명이 출력되어지고 있음
검색 결과가 없으면 empty list를 return 하도록 변경하기
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.