본문 바로가기

TIL

TIL 080223

Q: DRF Q기능을 통해서 쿼리하는 것은 어떤 장점이 있습니까?

A: 

What’s the benefit of using a Q object?

Using Q objects we can make complex queries with less and simple code.

 

https://micropyramid.com/blog/querying-with-django-q-objects

 

Querying with Django Q objects - MicroPyramid

Querying with Django Q objects to make complex queries with simple and less code

micropyramid.com

https://velog.io/@stresszero/Django-Q-%EA%B0%9D%EC%B2%B4-%EC%A0%95%EB%A6%AC

 

Django Q 객체 정리

장고의 Q객체란 장고에서 제공하는 기능으로 SQL로는 WHERE AND, OR, NOT 조건을 추가해주는 것이다. Q객체를 활용하면 복잡한 필터링을 편하게 실행할 수 있다. 일반적으로 filter()에 가장 많이 활용되

velog.io

https://forum.djangoproject.com/t/whare-are-the-benefits-of-using-q-objects/7160

 

Whare are the benefits of using Q objects?

If you want to do an AND (&) or OR (|) query you can do it in different ways. OR EXAMPLE queryset_1 | queryset_2 filter(Q(<condition_1>)|Q(<condition_2>) Example 1 queryset = User.objects.filter( first_name__startswith='R') | User.objects.filter( last_name

forum.djangoproject.com

https://velog.io/@jxxwon/Django-Q-%EA%B0%9D%EC%B2%B4

 

Django Q 객체

장고 Q객체

velog.io

 

 

 

Q: Serializer에서 어떻게 객체를 validate하게 됩니까?

A: 

 

https://blog.devjunction.in/how-to-perform-data-validation-in-django-rest-framework

 

How to perform data validation in Django Rest Framework?

We can apply data validation through various ways, in this blog we will have a look at three ways we can apply data validation in a Django Rest Fraemwork.

blog.devjunction.in

https://www.django-rest-framework.org/api-guide/serializers/

 

Serializers - Django REST framework

 

www.django-rest-framework.org

https://seoyoung2.github.io/django/2020/08/16/Serializer.html

 

[DRF] Serializer를 통한 유효성 검사 및 저장 - LunaLunaఇ

Serializer Serializer의 생성자 Serializer는 Django Form과 컨셉/사용법이 유사하다. 하지만 생성자를 지정할 때, 인자 구성이 조금 다르다. Django Form의 생성자는 첫번째 인자로 data를 받으며 ModelForm에서는

seoyoung2.github.io

https://www.django-rest-framework.org/api-guide/validators/#validation-in-rest-framework

 

Validators - Django REST framework

 

www.django-rest-framework.org

 

'TIL' 카테고리의 다른 글

TIL 080423  (0) 2023.08.04
TIL 080323  (0) 2023.08.03
TIL 080123  (0) 2023.08.01
TIL 073123  (0) 2023.07.31
TIL 072823  (0) 2023.07.28