-
[Python] query를 list로 받아보자 request.GET.getlist()Python/Django 2021. 12. 15. 16:04
# 요청 url의 뒷부분 = amenities=3&amenities=4&amenities=5&facilities=1&facilities=2 s_amenities = request.GET.getlist("amenities", None) s_facilities = request.GET.getlist("facilities", None) print(s_amenities, s_facilities) => ['3', '4', '5'] ['1', '2']
'Python > Django' 카테고리의 다른 글
[Python] Django reverser(), reverser_lazy() 사용하기 (0) 2021.12.16 [Python] CSRF token (0) 2021.12.16 [Python] Autocomplete for both Django-template and HTML (0) 2021.12.15 [Python] CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False. (0) 2021.12.14 [Python] TypeError: 'ManyRelatedManager' object is not iterable (0) 2021.12.14