I already read the documentation about https://github.com/Atrox/sweetify-django but I don't understand clearly, I already download and import requirement of sweetify in Django. I just want that if the record is updated the popup message (sweetify) will appear.
def studentrecords(request):
if request.method == 'POST':
id = request.POST.get("id")
update = StudentsEnrollmentRecord.objects.get(id=id)
update.Section = s
update.save()
sweetify.success(request, 'You did it', text='Your Form has been Updated',persistent='Hell yeah')
return render(request, 'Homepage/selectrecord.html')
this is my html
{% load sweetify %}
{% sweetify %}
<form method="post" action="/studentrecords/" enctype="multipart/form-data">{% csrf_token %}
<table>
{% for student in myrecord %}
<tr>
<td>Control #</td>
<td><input type="text" name="id" value="{{student.id}}"></td>
<td><input type="submit"></td>
</tr>
<tr>
<td>Name: </td>
<td><input type="text" value="{{student.Student_Users.Firstname}} {{student.Student_Users.Lastname}} {{student.Student_Users.Middle_Initial}}"></td>
<td>Course/Track</td>
<td><input type="text" value="{{student.Courses}}"></td>
</tr>
<tr>
<td>Education Level: </td>
<td><input type="text" value="{{student.Education_Levels}}"></td>
<td>Strand: </td>
<td><input type="text" value="{{student.strands}}"></td>
</tr>
<tr>
<td>Section: </td>
<td>
<select name="section">
<option value="{{student.Section.id}}">{{student.Section}}</option>
{% for sections in section %}
<option value="{{sections.id}}">{{sections.Description}}</option>
{% endfor %}
</select>
</td>
<td>Payment Type: </td>
<td><input type="text" value="{{student.Payment_Type}}" class="myform"></td>
</tr>
{% endfor %}
</table>
</form>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
<script>
Swal.fire(
'Good job!',
'Data Updated!',
'success'
)
</script>
my settings.py
INSTALLED_APPS = [
#my apps
….
'sweetify'
]
SWEETIFY_SWEETALERT_LIBRARY = 'sweetalert2'
I didn't receive any error , but no popup message appear (sweetify)