backend/django 80

Django: 기존에 있는 값에 unique 필드 추가하기

기존에 값이 있는 db에 unique한 필드를 추가하고 migration을 하려고 하면 다음과 같은 내용이 나온다.Please select a fix: 1) Provide a one-off default now (will be set on all existing rows with a null value for this column) 2) Quit, and let me add a default in models.py Select an option: 1 Please enter the default value now, as valid Python The datetime and django.utils.timezone modules are available, so you can do e.g. timezone.no..

backend/django 2019.02.04

Django: show invalid message in django loginform

Inherit AuthenticationFormInherit django.contrib.auth.forms.AuthenticationForm and customize clean() method.from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth import authenticate from django import forms from my_user.models import MyUser class CustomLoginForm(AuthenticationForm): error_messages = { 'invalid_login': "아이디 또는 비밀번호를 다시 확인하세요.\n등록되지 않은 아이디이거나, 아이디 또는 비밀..

backend/django 2018.07.23