atrox / sweetify-django Goto Github PK
View Code? Open in Web Editor NEWSweetAlert integration for Django
License: BSD 3-Clause "New" or "Revised" License
SweetAlert integration for Django
License: BSD 3-Clause "New" or "Revised" License
When using django 4.0 you will face an issue with importing force_text from django.utils.encoding, instead you'd want to change that to force_str instead of force_text because django 4.0 no longer supports force_text
I installed in last version of django "3" and just did what documentation says but still doesn't work
Hi Atrox, I am experience an issue on a similar view as in the below; where the popup keep showing after the redirection especially when I click on a different url page and use the "back" option in the browser the pop up will show again ! any idea how to fix it or would it be a bug I am not sure. Many Thanks a lot
Jabor
import sweetify
def test_view(request):
sweetify.success(request, 'Deleted!')
return redirect('xyz:index')
Hi,
Is there a way to add one time option for customClass{} ?
better not repeating this for every single message.
Thanks in advance.
sweetify.error(
request, title='Error.', text='Text',
persistent="Close", customClass={
'icon': 'dark:color-pink-600',
'popup': 'dark:bg-slate-900 dark:text-slate-200',
})
How to do that ?
I don't see an option to pass "className" to the alert for buttons or any other part. Is there a way around this by any chance?
Hi, I followed all the steps to install on Django and I was not successful.
Inside my views.py I inserted :
import sweetify
sweetify.fire('Good job!', 'You clicked the button!', 'success')
No message appears.
It is normal behaviour that I get this JavaScript console warning on every Sweetify toast?
SweetAlert2: The parameter "allowOutsideClick" is incompatible with toasts sweetalert2.all.min.js:5:1392
I don't actually use "allowOutsideClick" anywhere in my code, and when I do try to set it to "false" for my toasts, the issue persists. It's not causing problems, but obviously I'd rather not see warnings.
how to make input ajax requests (form) ?
I tried using the sweetify exactly how it was explained but I don't get any alert.
def post(self, request, *args, **kwargs):
form = self.get_form()
if form.is_valid():
sweetify.success(self.request, 'Successfully applied for this job!')
return self.form_valid(form)
else:
sweetify.error(self.request, 'Your application was unsuccessful. Kindly re-apply with correct details')
return HttpResponseRedirect(reverse_lazy('job-detail', kwargs={'id': self.kwargs['job_id']}))
How do I show the icons of success, error, etc ?
For example :
Swal.fire({
icon: 'error',
title: 'Oops...',
text: 'Something went wrong!',
footer: 'Why do I have this issue?'
})
As per your instruction, I did all the things but in how to download in vs code I am not understood.
You have to install sweetalert2, the library, itself.
See here: https://sweetalert2.github.io/#download
how to install swwetalert in django . I am using vs code I did pip install --upgrade sweetify.
but how to install the package after this
Is it possible to return the value from the alert ?
For example:
sweetify.warning(request, "Do you wanna delete it?", backdrop="rgba(199, 212, 21, 0.4)",showConfirmButton=True,confirmButtonText="Delete",timer=0)
And I want to get information from the user if he presses the confirm button.
I know sweetaler2 can do this.
On my Sentry report, I get some issue AttributeError 'Context' object has no attribute 'request'
.
After I observed, this error appeared when an error 500 occurred in my application. If there is an error 500 in the application then the context contains None
.
Hello, I can use json objects to send to message ?
Hi there,
I followed the exact same steps described here, and I loaded the CDN for sweetalert2 as well, that said, the call to the library seems to function but nothing shows up on the front end, no modal displayed, no message and the page redirects successfully after the call.
Tried to put it on a Try/Catch thinking there might be some silent exception but nothing, the code is clean, but the alert is not working
Any ideas ?
Up to what version of sweetalert2 does this support? I know they have completely changed the way it works since this was developed.
Hi I am try to use sweetalerts2 to show multiple alerts to user in DJANGO project. I am using sweetify version 2.0. Any suggestion will be a great help
Is there a way to simulate this functionality ?:
Swal.fire({ title: 'Are you sure?', text: "You won't be able to revert this!", icon: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, delete it!' }).then((result) => { if (result.value) { // Django code Swal.fire( 'Deleted!', 'Your file has been deleted.', 'success' ) } })
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.