Exemplo n.º 1
0
def bilde():
  pictureName = request.args.get('picture')
  pictureID = picmethods.findPictureIdByName(pictureName)
  #Ja tiek pievienots jauns komentārs no formas
  if request.method == 'POST':
    comments = commethods.searchAllComments(pictureID)
    newComment = request.form['newComment']
    commethods.addNewComment(pictureID,newComment)
    return render_template(
    "bilde.html", picture = pictureName,comm = comments)
  #Ja lapa tiek vienkārši ielādēta
  else:
    comments = commethods.searchAllComments(pictureID)
    return render_template(
    "bilde.html", picture = pictureName,comm = comments
  )
Exemplo n.º 2
0
def mainit():
    newComment = "Rs viens pats"  # jasanjem no lapas, ja "xxx", tad ar sho nomaina veco, ja "", tad dzesh esosho komentaru
    picture_txt = request.args.get('co2')  #Attēla nosaukums - saite
    oldCom_txt = request.args.get(
        'co1')  #Aktīvais komentārs - labošanai, dzēšanai
    pictureID = picmethods.findPictureIdByName(picture_txt)
    oldComID = commethods.findCommentIdByName(pictureID, oldCom_txt)

    commethods.deleteComment(pictureID, oldComID)
    comments = commethods.searchAllComments(pictureID)
    print("------->>> " + picture_txt)
    return render_template("bilde.html", picture=picture_txt, comm=comments)