我正试图让django-register在我的网站上工作,但我一直收到这个我不明白的错误
我在Python 3.3上使用django 1.6
NoReverseMatch at /accounts/register/
Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/register/
Django Version: 1.6.1
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Exception Location: D:\Programming\Py33\lib\site-packages\django\core\urlresolvers.py in _reverse_with_prefix, line 429
Python Executable: D:\Programming\Py33\python.exe
Python Version: 3.3.3
Python Path:
['D:\\Programming\\GItHub\\photobyte\\PhotoByte',
'D:\\Programming\\Py33\\lib\\site-packages\\setuptools-2.0.3dev-py3.3.egg',
'C:\\WINDOWS\\SYSTEM32\\python33.zip',
'D:\\Programming\\Py33\\DLLs',
'D:\\Programming\\Py33\\lib',
'D:\\Programming\\Py33',
'D:\\Programming\\Py33\\lib\\site-packages']
Server time: Wed, 8 Jan …Run Code Online (Sandbox Code Playgroud) 所以我有这个组件
var LineItemRowsWrapper = React.createClass({
current_lineitem_count: 0,
getAjaxData: function(){
var lineitem_data = [];
for(var i = 0; i < this.current_lineitem_count; i++){
var data = this.refs['lineitem_'+i].getAjaxData();
lineitem_data.push(data)
}
return lineitem_data;
},
getLineitems: function(){
var self = this;
var lineitem_components = [];
this.current_lineitem_count = 0;
if(this.props.shoot){
var preview = this.props.preview;
var lineitems = this.props.shoot.get_lineitems();
lineitem_components = lineitems.map(function (item, index) {
var ref_str = 'lineitem_'+self.current_lineitem_count;
self.current_lineitem_count++;
return (
<LineItemRow item={item} key={index} ref={ref_str} preview={preview} onChange={self.props.onChange} />
)
});
}
return lineitem_components;
},
render: function() …Run Code Online (Sandbox Code Playgroud) 说我有这样的模特.
class Job(models.Model):
client = models.ForeignKey(Contacts, null=True)
Run Code Online (Sandbox Code Playgroud)
并且假设我有工作j.我知道我可以像这样访问属于j的客户端
j.client
Run Code Online (Sandbox Code Playgroud)
但也有
j.client_id
Run Code Online (Sandbox Code Playgroud)
所以我的问题是如何访问j.client工作?
django存储client__id然后当调用j.client时它会查询找到正确的对象吗?
或者是将对象引用存储到j并且访问client__id是从Contact对象获取id?
我查看了一下源代码,但找不到我的问题的答案
所以我有一个看起来像这样的序列化器
class BuildingsSerializer(serializers.ModelSerializer):
masterlisting_set = serializers.PrimaryKeyRelatedField(many=True,
queryset=Masterlistings.objects.all())
Run Code Online (Sandbox Code Playgroud)
它很棒
serializer = BuildingsSerializer(Buildings.objects.get(pk=1))
serializer.data
Run Code Online (Sandbox Code Playgroud)
产生
OrderedDict([
("masterlistings_set", [
"0a06e3d7-87b7-4526-a877-c10f54fa5bc9",
"343643ac-681f-4597-b8f5-ff7e5be65eef",
"449a3ad2-c76c-4cb8-bb86-1be72fafcf64",
])
])
Run Code Online (Sandbox Code Playgroud)
但是,如果我将序列化程序中的查询集更改为
class BuildingsSerializer(serializers.ModelSerializer):
masterlistings_set = serializers.PrimaryKeyRelatedField(many=True, queryset=[])
Run Code Online (Sandbox Code Playgroud)
我仍然得到相同的结果.
OrderedDict([
("masterlistings_set", [
"0a06e3d7-87b7-4526-a877-c10f54fa5bc9",
"343643ac-681f-4597-b8f5-ff7e5be65eef",
"449a3ad2-c76c-4cb8-bb86-1be72fafcf64",
])
])
Run Code Online (Sandbox Code Playgroud)
这应该发生吗?我错误地使用了查询集吗?我用[]作为一个简单的例子来表明,无论我什么都没有改变.
请有任何见解是非常宝贵的
应该注意的是,主列表具有指向建筑物的主键关系.所以一个主人名单属于一个建筑物.
我在Spotify上注册了我的应用程序.我确保将URI添加到我的注册应用程序中.但是每次我运行这段代码时,我都会遇到同样的错误.我也在后台运行这个,所以我知道不是这样.我究竟做错了什么?
我也试着开关/spotify用/provider_cb.
var client_id = '<my_client_id>';
var redirectUri = chrome.identity.getRedirectURL() + "/spotify";
chrome.identity.launchWebAuthFlow({
"url": "https://accounts.spotify.com/authorize?client_id="+client_id+
"&redirect_uri="+ encodeURIComponent(redirectUri) +
"&response_type=token",
'interactive': true,
},
function(redirect_url) {
console.log(redirect_url);
});
Run Code Online (Sandbox Code Playgroud)
这是我的权限:
"permissions": [
"http://*/*", "tabs", "webNavigation", "activeTab", "storage", "identity",
"declarativeContent", "https://accounts.spotify.com/*",
"https://accounts.spotify.com/authorize/*"
]
Run Code Online (Sandbox Code Playgroud)
在我重新启动Chrome后第一次运行我的应用程序时,登录页面弹出就像一切正常,但在我登录后仍然得到相同的错误:
identity.launchWebAuthFlow: Authorization page could not be loaded.
Run Code Online (Sandbox Code Playgroud) google-chrome spotify google-chrome-extension google-chrome-app spotify-app
所以我有一个看起来像这样的模型
def create_invite_code():
return str(uuid.uuid4())[0:8]
class InviteCodes(models.Model):
id = models.CharField(max_length = 36, primary_key = True, default=build_uuid)
code = models.CharField(max_length=8, unique=True, default=create_invite_code)
Run Code Online (Sandbox Code Playgroud)
如果create_invite_code返回已经存在于db中的代码会发生什么,django会再次调用该函数,直到找到一个不存在的函数?或者它会错误吗?
我有一个选择元素
<select id='bill_to'>
<option value='a634jhj2'>test@c.com</option>
<option value='agfd4ghj2'>test2@c.com</option>
<option value='asdf634jhj2'>tes3@c.com</option>
<option value='agf2342d4ghj2'>test4@c.com</option>
</select>
Run Code Online (Sandbox Code Playgroud)
如果我做
$('#bill_to').find(':selected')
Run Code Online (Sandbox Code Playgroud)
即使未选中,它也会返回第一个选项。
如果选择了一个选项
$('#bill_to').find(':selected')
Run Code Online (Sandbox Code Playgroud)
按预期工作并返回正确的选项
我究竟做错了什么?这是一个错误吗。这真让我抓狂。如果没有选择任何内容,我只希望它返回 []
我正在尝试将重新选择添加到我的反应代码中,但它似乎总是重新渲染.
每次我改变状态时,即使输入选择器没有改变,控制台也会打印"测试".我创建了一个简单的测试来向你们展示发生了什么.
import { connect } from 'react-redux'
import { createSelector } from 'reselect'
window.testObject = {'x': '5'}
const mapStateToProps = (state, props) => {
const test = state => {return window.testObject}
const getTest = createSelector(test, (t)=> console.log('testing'))
return {
test: getTest(state),
}
}
export default const TestContainer = connect(
mapStateToProps,
)(TestBase)
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么??我继续阅读文档,从我可以告诉console.log不应该在第一次运行后运行,因为输入选择器没有改变.我理解正确吗?
嘿家伙我正在写一个ocaml程序,我无法弄清楚如何查看int的特定数字
所以说比如我们有
let a = 405;;
Run Code Online (Sandbox Code Playgroud)
我希望能够看到第一个数字,第4个数字,或第二个数字,0.我怎样才能实现这个目标?我想把它变成一个字符串并查看字符,但我觉得应该有另一种方法.
django ×4
python ×4
javascript ×3
reactjs ×2
digit ×1
django-1.6 ×1
html ×1
int ×1
jquery ×1
ocaml ×1
python-2.7 ×1
python-3.3 ×1
refs ×1
render ×1
reselect ×1
selected ×1
spotify ×1
spotify-app ×1
unique ×1