분류 전체보기 477

장고 DRF #5 | Django REST framework Relationships & Hyperlinked APIs

5 - Relationships and hyperlinked APIs - Django REST framework (django-rest-framework.org) 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 endpoin..

장고 DRF #2 | Django REST framework Requests and Responses

Django REST framework Requests and Responses Request objects request.POST handles from data. request.data handles arbitrary data Response objects return Response(data) renders to content type Status codes HTTP 상태 코드를 숫자로 표현하기보다는 HTTP_400_BAD_REQUEST 식별자를 사용하는 편이 좋다. Wrapping API views REST 프레임워크에서 API뷰를 작성하는 두 개의 래퍼가 있다. @api_view 함수 기반 뷰로 작업하기 위한 데코레이터 APIView 클래스 기반 뷰로 작업하기 위한 클래스 래퍼는 입력이 잘못되었..

Django API #2 | A simple API with pure Django

Building APIs with Django and Django Rest Framework (readthedocs.org) The endpoints and the URLS 만들고자 하는 API는 다음과 같다. GET /polls/ Poll의 리스트를 가지고오는 API GET /polls// 지정한 id의 Poll을 가지고오는 API connecting urls to the views polls 앱에 views.py 파일로 polls_list 뷰와 polls_detail 뷰를 만들어준다. from django.shortcuts import render # Create your views here. def polls_list(request): pass def polls_detail(request, pk):..

W3Schools 자바 | #2 OOP(Classes, Attributes, Methods)

Java OOP (Object-Oriented Programming) (w3schools.com) Java OOP (Object-Oriented Programming) W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more. www.w3schools.com Java OOP Java OOP OOP란? Object Oriented Programming 객체 지향 프로그래밍의 약자다. 절차 지향 프로그래밍이 프로시저,..

장고 | 장고 공식 문서 내용 정리 #1-8 Getting started : writing your first Django app, part 7

첫 장고 앱 만들기 #7 admin 양식 커스텀하기 from django.contrib import admin from .models import Question, Choice # Register your models here. class QuestionAdmin(admin.ModelAdmin): fields=['pub_date', 'question_text'] admin.site.register(QuestionAdmin) admin.site.register(Choice) admin에서 모델을 보여주는 방식을 바꾸어주었다. from django.contrib import admin from .models import Question, Choice # Register your models here. cla..

Django API #1 | Setup, Models and Admin

Building APIs with Django and Django Rest Framework (readthedocs.org) Building APIs with Django and Django Rest Framework #2 Setup, Models and Admin 시작하기에 앞서 파이썬 가상환경을 활성화시켜주자. $ python3 -m venv pollsapi $ cd pollsapi/bin $ source activate Creating a project 앞선 튜토리얼에서 진행했던 것처럼 pollsapi 프로젝트를 시작해준다. $ django-admin startproject pollsapi Database setup 그냥 SQlite database를 사용할 것이다. DATABASES = { 'de..

Django API | #0 Introductions

Building APIs with Django and Django Rest Framework (readthedocs.org) 공식 문서를 읽다가 튜토리얼 부분을 넘어가니 양이 너무 방대해서 길을 잃었다. 특히 궁금한 API 부분에 집중한 책이나 자료를 찾다가 위 책을 발견했다. Building APIs with Django and Django Rest Framework! 분량이 적당하고 수준이 딱 맞을 것 같아 공부를 시작한다. 이 책을 다 공부한 뒤에는 Django for APIs 를 읽고, 그 다음에 블로그를 만드는 개인 프로젝트를 시작해보려 한다 Building APIs with Django and Django REST Framework #1 Introductions Who is this book ..