我正在尝试删除固定顶级菜单左侧的一些空白区域,ul但我卡住了,我已经搜索过并将其放入:
#nav li {
list-style: none;
display: inline-block;
}
Run Code Online (Sandbox Code Playgroud)
我想把所有列表放在左边(比如left: 0?),但是有些东西在第一个列表项的左边产生了一些空格.
为什么会发生这种情况,我该如何删除它?
这是代码(小提琴):
#contenedormenu {
background-color: #FFFFFF;
width: 100%;
position: fixed;
top: 0px;
box-shadow: 0px 1px 2px #888;
height: 40px;
z-index: 1;
}
#menu {
width: 100%;
height: 40px;
position: fixed;
top: 0px;
}
#nav {
width: 100%;
height: 40px;
top: 0px;
position: fixed;
margin-top: 0px;
}
#nav li {
margin-top: 10px;
list-style: none;
display: inline-block;
}
#nav li a {
color: #5D5D5D;
font-family: …Run Code Online (Sandbox Code Playgroud)我正在尝试使用 SQLAlchemy 和 Marshmallow 将新用户插入到数据库中。该user参数是从 API 端点接收的。一切正常,直到我到达create函数中的这一行:
db.session.add(new_user)
Run Code Online (Sandbox Code Playgroud)
此时new_user变量的值是:
{'password': 'string', 'email': 'fave@string', 'username': 'string'}
Run Code Online (Sandbox Code Playgroud)
功能:
def create(user):
uname = user.get('username')
email = user.get('email')
password = user.get ('password')
existing_username = User.query.filter(User.username == uname).one_or_none()
if existing_username is None:
schema = UserSchema()
new_user = schema.load(user, session=db.session)
db.session.add(new_user) <- It fails here
db.session.commit()
return schema.dump(new_user), 201
Run Code Online (Sandbox Code Playgroud)
楷模:
class User (db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(20), unique=True, nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
profile_picture = db.Column(db.String(20), …Run Code Online (Sandbox Code Playgroud) python sqlalchemy flask-sqlalchemy flask-marshmallow marshmallow-sqlalchemy