小编Die*_*ila的帖子

谷歌地图自动完成建议未出现

我正在尝试使用 HTML 和 JavaScript 为 Google 地图创建自动完成功能,并且我正在使用 Bootstrap 模式。但它没有显示建议。这是我的代码:

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  <body>
    
    
    
    <!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
 Abrir mapa
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"> …
Run Code Online (Sandbox Code Playgroud)

html javascript google-maps twitter-bootstrap

2
推荐指数
1
解决办法
1744
查看次数

我的自定义登录安全吗?

我创建了自己的自定义登录,我没有使用django的登录.

这是我的models.py:

class TipeUser(models.Model):
    tipe = models.CharField(max_length=30)
    detail = models.CharField(max_length=50, blank=True, null=True)
class User(models.Model):

    user = models.CharField(max_length=20)
    password = models.CharField(max_length=50)
    state = models.CharField(max_length=1)
    id_tipe_user = models.ForeignKey(TipeUser, on_delete=models.CASCADE)
Run Code Online (Sandbox Code Playgroud)

我的views.py:

    def login(request):

        context={}  
        return render(request, 'login.html', context)

    def validate(request):
        if request.method=='POST':
            nameUser = request.POST.get('nameUser')
            passwordUser = request.POST.get('passwordUser')
            password = md5.new(passwordUser).hexdigest()
         try:
            userAdmin = User.objects.get(user=nameUser, password=password, id_tipe_user=1, state=1)
            request.session['nameUser'] = userAdmin.user
            return redirect('home')
         except User.DoesNotExist: 
             message= "User/Password wrong !!"
              context = {
                 'message': message,
              }
               return render(request, 'login.html', context) …
Run Code Online (Sandbox Code Playgroud)

python security django

0
推荐指数
1
解决办法
69
查看次数