我需要知道如何限制对经过身份验证的用户的访问,以便可以为以管理员身份登录的用户完整列出用户记录,而对于以用户身份登录的用户,只能列出、更新和创建他们的记录。
目前我正在使用serializers.ModelSerializer、viewsets.ModelViewSet 和permissions.BasePermission 但似乎进展不快。
我是nodejs的新手并且正在尝试设置API服务器,这是我的第一次尝试.我想使用mysql而不是mongo db.
我的问题是'knex('user').insert({email:req.body.email});' 似乎不想保存到数据库.
var dbConfig = {
client: 'mysql',
connection: {
host : 'localhost',
user : 'root',
password : '',
database : 'db_nodeapi'
}
};
var express = require('express'); // call express
var bodyParser = require('body-parser'); // call body-parser
var knex = require('knex')(dbConfig); // set up database connection
var app = express(); // define our app using express
app.use(bodyParser.urlencoded({ extended: true })); // configure app to use bodyParser()
app.use(bodyParser.json()); // this will let us get the data from a …Run Code Online (Sandbox Code Playgroud) 我希望从锚标签中删除所有标准样式的下划线,粗体和颜色,以便所有锚标签都是链接而不是扰乱显示.
我试过以下但是我仍然把所有内容都用蓝色和粗体来表示这很痛苦.
a,
a:link,
a:visited,
a:hover,
a:active {
color: inherit;
text-decoration: inherit;
font-weight: inherit;
}
Run Code Online (Sandbox Code Playgroud)
任何人都知道如何通过替换替换来删除样式,但实际上根本没有对链接进行样式设置,以便样式不会在锚点内打乱.
这是我的问题我定义了许多函数,我想循环遍历这些函数的列表,并以正确的顺序一次运行一个.
def one():
print "One "
def two():
print "Two "
def three(): "Three "
print "Three "
arr = ('one','two','three')
for fnc in arr:
<some how run the function name in the variable fnc>
Run Code Online (Sandbox Code Playgroud)
感谢任何帮助,因为我是python和django的初学者.