Ajout des tags
This commit is contained in:
parent
dc9d398409
commit
018dae05af
3 changed files with 24 additions and 2 deletions
9
app.py
9
app.py
|
@ -59,12 +59,19 @@ def bizutage():
|
||||||
titre = Markup.escape(request.values["titre"])
|
titre = Markup.escape(request.values["titre"])
|
||||||
desc = Markup.escape(request.values["desc"])
|
desc = Markup.escape(request.values["desc"])
|
||||||
categorie = Markup.escape(request.values["categories"])
|
categorie = Markup.escape(request.values["categories"])
|
||||||
|
tagsList = request.values["tags"].split(';')
|
||||||
|
tags = []
|
||||||
|
for i in tagsList:
|
||||||
|
i.strip()
|
||||||
|
i = Markup.escape(i)
|
||||||
|
if i not in tags:
|
||||||
|
tags.append(i)
|
||||||
|
|
||||||
nouvLien = {"titre": titre,
|
nouvLien = {"titre": titre,
|
||||||
"url": lien,
|
"url": lien,
|
||||||
"desc": desc,
|
"desc": desc,
|
||||||
"categorie": categorie,
|
"categorie": categorie,
|
||||||
"tags": []
|
"tags": tags
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = manip.ajoutLienJson(nouvLien)
|
ret = manip.ajoutLienJson(nouvLien)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="fr">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" href="/static/styles/base.css">
|
<link rel="stylesheet" href="/static/styles/base.css">
|
||||||
|
@ -25,13 +25,22 @@
|
||||||
<option value="musique">Musique</option>
|
<option value="musique">Musique</option>
|
||||||
<option value="autres" selected>Autre</option>
|
<option value="autres" selected>Autre</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<label for="tags">Séparez vos tags avec ; </label>
|
||||||
|
<textarea name="tags" id="tag" cols="30" rows="10"></textarea>
|
||||||
|
<!-- <input type="text" name="tag" id="tag" placeholder="Tag">
|
||||||
|
<input type="button" onClick="addTag()" value="Ajouter tag"> -->
|
||||||
<input type="submit" value="Envoyer">
|
<input type="submit" value="Envoyer">
|
||||||
</form>
|
</form>
|
||||||
|
<!-- <div id="listTag">
|
||||||
|
</div> -->
|
||||||
|
|
||||||
{% if erreur %}
|
{% if erreur %}
|
||||||
<p id="erreur">{{ erreur }}</p>
|
<p id="erreur">{{ erreur }}</p>
|
||||||
{% elif reussi %}
|
{% elif reussi %}
|
||||||
<p id="reussi">{{ reussi }}</p>
|
<p id="reussi">{{ reussi }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- <script src="/static/test.js"></script> -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -31,6 +31,12 @@
|
||||||
<p><a href="{{lien.url}}">{{lien.url}}</a></p>
|
<p><a href="{{lien.url}}">{{lien.url}}</a></p>
|
||||||
<hr>
|
<hr>
|
||||||
<p>{{lien.desc}}</p>
|
<p>{{lien.desc}}</p>
|
||||||
|
<p>Tags:</p>
|
||||||
|
<ul>
|
||||||
|
{% for tag in lien.tags %}
|
||||||
|
<li>{{tag}}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<footer>
|
<footer>
|
||||||
|
|
Loading…
Reference in a new issue