我尝试覆盖默认的密码重置模板并收到此错误:
TypeError at /password_reset/
__init__() takes 1 positional argument but 2 were given
这是我的网址
url(r'^password_reset/$', auth_views.PasswordResetView, {'template_name': 'accounts/password_reset_done.html'}, name='password_reset'),
答案 0 :(得分:0)
将视图传递到URL配置的方式是错误的。
更改:
public class LongestLine {
private int hmax = 0;
private int vmax = 0;
private int rdmax = 0; // right down direction
private int ldmax = 0; // left down direction
public int longestLine(int[][] grid) {
for(int i = 0; i < grid.length; i++) {
for(int j = 0; j < grid[i].length; j++) {
if(grid[i][j] == 1) update(grid, i, j);
}
}
return Math.max(Math.max(hmax, vmax), Math.max(rdmax, ldmax));
}
private void update(int[][] grid, int i, int j) {
int h = 1, v = 1, rd = 1, ld = 1;
if(j < grid[i].length - 1 && grid[i][j+1] == 1) h = updateH(grid, i, j+1, h);
if(i < grid.length - 1 && grid[i+1][j] == 1) v = updateV(grid, i+1, j, v);
if(j < grid[i].length - 1 && i < grid.length - 1 && grid[i+1][j+1] == 1)
rd = updateRD(grid, i+1, j+1, rd);
if(j > 0 && i < grid.length - 1 && grid[i+1][j-1] == 1)
ld = updateLD(grid, i+1, j-1, ld);
hmax = Math.max(h, hmax);
vmax = Math.max(v, vmax);
rdmax = Math.max(rd, rdmax);
ldmax = Math.max(ld, ldmax);
}
private int updateH(int[][] grid, int i, int j, int h) {
h++;
if(j < grid[i].length - 1 && grid[i][j+1] == 1) h = updateH(grid, i, j+1, h);
return h;
}
private int updateV(int[][] grid, int i, int j, int v) {
v++;
if(i < grid.length - 1 && grid[i+1][j] == 1) v = updateV(grid, i+1, j, v);
return v;
}
private int updateRD(int[][] grid, int i, int j, int rd) {
rd++;
if(j < grid[i].length - 1 && i < grid.length - 1 && grid[i+1][j+1] == 1)
rd = updateRD(grid, i+1, j+1, rd);
return rd;
}
private int updateLD(int[][] grid, int i, int j, int ld) {
ld++;
if(j > 0 && i < grid.length - 1 && grid[i+1][j-1] == 1)
ld = updateLD(grid, i+1, j-1, ld);
return ld;
}
}
收件人:
url(r'^password_reset/$', auth_views.PasswordResetView, ...)
(docs)