전체 글

전체 글

    [Django] 장고 커스텀 유저 만들기#2 forms.py admin.py , custom User, 장고 User 바꾸기

    [Django] 장고 커스텀 유저 만들기#2 forms.py admin.py , custom User, 장고 User 바꾸기

    [Django] 장고 커스텀 유저 만들기#1 models.py , custom User, 장고 User 바꾸기 DRF를 이용해서 로그인 api를 구현하기 위해서 어제 많은 자료들을 찾아 봤다. DRF자체적으로 세션,토큰, 또 simple jwt를 이용하게 되면 JWT까지 쉽게 구현 가능하다고 한다. 그래서 고민고민하면서 devforyou.tistory.com #1에 이어서 진행하도록 하겠다. # forms.py를 만들어 주자! from django import forms from django.contrib.auth.forms import ReadOnlyPasswordHashField from .models import User # email, name, nickname, phoneNumber, dateO..

    [Django] 장고 커스텀 유저 만들기#1 models.py , custom User, 장고 User 바꾸기

    [Django] 장고 커스텀 유저 만들기#1 models.py , custom User, 장고 User 바꾸기

    DRF를 이용해서 로그인 api를 구현하기 위해서 어제 많은 자료들을 찾아 봤다. DRF자체적으로 세션,토큰, 또 simple jwt를 이용하게 되면 JWT까지 쉽게 구현 가능하다고 한다. 그래서 고민고민하면서 구현해보고자 했다. 그런데 해당기능들은 장고 자체에 내장된 auth기능을 활용하는거 같았는데 auth는 장고의 내장 User모델을 사용한다. User모델은 장고가 이미 정해놨다. 어떤 서비스를 만들어 유저를 관리한다고 하면 그 유저에 대한 정보를 담는 것 가지각색이다. 그래서 User를 내 입맛에 맞게 바꾸는걸 먼저 해야했다. 한번 알아두면 두고두고 보면서 활용하면 좋을거 같아서 기록하도록 하겠다. 참고한 자료는 여러 공식문서와 블로그인데 마지막에 링크로 첨부하도록 하겠다. # AbstractUs..

    [Django] django-rest-framework 공식문서 튜토리얼 따라하기#5

    [Django] django-rest-framework 공식문서 튜토리얼 따라하기#5

    5 - Relationships and hyperlinked APIs - Django REST framework At the moment relationships within our API are represented by using primary keys. In this part of the tutorial we'll improve the cohesion and discoverability of our API, by instead using hyperlinking for relationships. Right now we have endpoints for 'snip www.django-rest-framework.org # users와 snippets를 한번에 볼 수 있는 view 만들기 from rest..

    [Django] django-rest-framework 공식문서 튜토리얼 따라하기#4, 로그인과 auth인증

    [Django] django-rest-framework 공식문서 튜토리얼 따라하기#4, 로그인과 auth인증

    4 - Authentication and permissions - Django REST framework Currently our API doesn't have any restrictions on who can edit or delete code snippets. We'd like to have some more advanced behavior in order to make sure that: Code snippets are always associated with a creator. Only authenticated users may create snipp www.django-rest-framework.org 장고 튜툐리얼#4 포스팅이다. 인증 및 권한을 다루는데 게시물을 작성할때 유저체크를 하고, 유..

    [Django] django-rest-framework 공식문서 튜토리얼 따라하기#3, 장고 Class view, mixins, generic view

    [Django] django-rest-framework 공식문서 튜토리얼 따라하기#3, 장고 Class view, mixins, generic view

    3 - Class based views - Django REST framework We can also write our API views using class-based views, rather than function based views. As we'll see this is a powerful pattern that allows us to reuse common functionality, and helps us keep our code DRY. We'll start by rewriting the root view as a cla www.django-rest-framework.org 함수형이 익수해졌기 때문에, 굳이 class형으로 view를 짜야할까라는 의구심이 가득했었다. 그러나 해당 튜토리얼을..