我閱讀了這個 https://github.com/Atrox/sweetify-django 關于sweetify的文檔,我做了文檔中所說的一切,但是每次用戶管理員插入新數據時,sweetify都沒有激活,我錯過了什么嗎?我已經安裝了它。我正在使用詹戈 2.2.4我的網頁中有這段代碼{% load sweetify %}{% sweetify %} <form method="POST" action-xhr="/InsertProduct/" enctype="multipart/form-data"> {% csrf_token %} .... <button type="submit" name="submit" id="submit">Submit</button></form>這是我的 views.pyimport sweetifydef InsertProduct(request): .... insert_data = Product( .... ) sweetify.success(request, 'You did it', text='Good job! You successfully showed a SweetAlert message', persistent='Hell yeah') insert_data.save() return redirect('/') # <-- tabbed this linesweetify.pyfrom sweetify.templatetags import sweetify sweetify.DEFAULT_OPTS = { 'showConfirmButton': False, 'timer': 2500, 'allowOutsideClick': True, 'confirmButtonText': 'OK',}settings.pyINSTALLED_APPS = [ ..... 'sweetify',]SWEETIFY_SWEETALERT_LIBRARY = 'sweetalert2'
django sweetalert2 活動,當數據插入成功時
慕村225694
2022-09-29 17:48:37