方式一,直接判断 方式二,从源码入手 如果要验证username是否在数据库中存在,先查看源码,由于数据验证是从 obj.is_valid()方法开始验证,所以进入这个方法 依次查看 回到form类 必须要抛出ValidationError异常,导入这个异常 ...
分类:
数据库 时间:
2019-02-26 19:44:59
阅读次数:
202
ARTS第十周 ARTS是什么? Algorithm :每周至少做一个leetcode的算法题; Review :阅读并点评至少一篇英文技术文章; Tip/Techni :学习至少一个技术技巧; Share :分享一篇有观点和思考的技术文章。 Algorithm 题目: "20. Valid Par ...
分类:
其他好文 时间:
2019-02-24 23:03:41
阅读次数:
185
Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Input: "aba" Output: True Exa ...
分类:
其他好文 时间:
2019-02-24 18:46:38
阅读次数:
178
view中使用is_valid()方法: 局部钩子和全局钩子函数代码 通过is_valid()方法找到源码中的run_validation 最后执行self.to_internal_value(data) 流程总结: is_valid self.run_validation (执行Serialize ...
分类:
其他好文 时间:
2019-02-24 16:16:55
阅读次数:
212
题目描述: Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input:s = "anagram", t = "nagaram" Output: true Ex ...
分类:
其他好文 时间:
2019-02-22 21:08:03
阅读次数:
159
193. Valid Phone Numbers 193. Valid Phone Numbers Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bas ...
分类:
其他好文 时间:
2019-02-22 01:07:44
阅读次数:
213
37. Sudoku Solver Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Empt ...
分类:
Web程序 时间:
2019-02-21 21:37:51
阅读次数:
232
https://vjudge.net/problem/HRBUST-1955 9 * 9 的 Sudoku 给每个格子标号 num 并且通过标号唯一确定格子的位置在 num / 9 行 num % 9 列 判断待定数字是不是在每行每列每宫中没有出现过 如果可以顺利搜索完所有格子 ans 标为 1 如 ...
分类:
其他好文 时间:
2019-02-20 13:11:40
阅读次数:
114
描述:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. ...
分类:
其他好文 时间:
2019-02-19 12:02:48
阅读次数:
153
题目传送门 题意: 给你16个16宫格的数独,里面是0~F,你可以逆时针旋转里面的每个16宫格 问你它是从标准数独逆时针旋转多少次得到? 思路: 可以知道每个16宫已经是标准的了,接下来只要考虑每行、每列就行了 那么我们在dfs中就可以用两个行列两个数组来标记每个数字出现的次数, 大于1则不行 另外 ...
分类:
其他好文 时间:
2019-02-18 18:56:54
阅读次数:
148