Bonjour à tous,
UPDATE du 24/11/2020 15h28:
j'ai trouvé pour mon problème au dessus.
Mais Je ne vois rien sur ma page HTML alors que quand je Print le résultat de ma requête je vois tout ? voici ce que je raconte en image ci dessous:
C'est modeles.py:
et ma page html:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 def index(request): try: with cx_Oracle.connect("user", "pass", "connexion") as connection: with connection.cursor() as cursor: cursor.execute("SELECT * FROM CDE_CLI_LIGN WHERE NUM_CDE ='480559'") result = cursor.fetchall() print(result) template = loader.get_template('polls/index.html') return HttpResponse(template.render({'Lignecommande':result},request)) except cx_Oracle.Error as error: print(error)
Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 {% load static %} <!DOCTYPE html> <html> <head> <title>COMPTAGE</title> <link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="{% static 'css/index.css' %}"> <nav class="navbar navbar-dark bg-dark"> <a class="navbar-brand" href="#"> <img src="{% static 'img/logo.png' %}"> </a> </nav> </head> <body> <div class="container mt-2"> <p class="text-white bg-dark p-2 rounded">Rechercher une commande</p> <div class="row"> <div class="col-sm-9"> <form class="form-inline" action="#"> <div class="input-group mb-3" style="width:100%;" > <input type="text" class="form-control" placeholder="Taper le numéro de commande ici"> <div class="input-group-append"> <button class="btn btn-outline-success" type="submit" id="recherche_commande" onclick="affiche_tableau()">Rechercher</button> </div> </div> </form> </div> </div> <div class="col-8 col-sm-6" id="tableau_commande" style="display:none;"> <table class="table"> <thead class="thead-dark"> <tr> <th scope="col">Articles</th> <th scope="col">EAN</th> <th scope="col">Taille</th> <th scope="col">Nombre d'articles</th> <th scope="col">Nombre d'articles Scanner</th> </tr> </thead> <tbody> {% for co in Lignecommande %} <tr> <td>{{co.CODE_ART_COM}}</td> </tr> {% endfor %} </tbody> </table> </div> </div> <script> var div_tableau = document.getElementById("tableau_commande"); function affiche_tableau(){ if(getComputedStyle(div_tableau).display == "none"){ div_tableau.style.display = "block"; } else { div_tableau.style.display = "none"; } } </script> </body> </html>
j'ai une image qui montre le résultat on vois bien des traits qui sépare les lignes mais rien dedans:
![]()
Partager