These are chat archives for django/django
In js an example of asynchronous call behavior is to use Promise.
You can get the data if successful through .then() otherwise the .catch() method is executed.
Now in celery:
@celery.task() def add(a, b): return a + b def some_view(): add.delay(1, 2) return HttpResponse("Here's the text of the Web page.")
My question is how to know that the add.delay() is successfully finished before the request cycle ends in HTTPResponse?
@receiverdecorator to do it
@receiver(user_logged_in, dispatch_uid='authentication.handle_user_logged_in') def handle_user_logged_in(sender, user=None, request=None, **kwargs): if hasattr(user, 'username'): details = USER_LOGGED_IN.format(user.username) log_user_login_event(event_details=details, user=user, request=request) else: logging.debug("No username found to audit log user_logged_in")
def test_my_receiver(self,…..): ……. self.signal_was_called = False @receiver(user_logged_in, dispatch_uid='authentication.handle_user_logged_in’) def handle(sender, user=None, request=None, **kwargs): self.signal_was_called = True self.assertEquals(self.signal_was_called, True)
self.signal_was_called = Truenever gets called
Hello everyone! I am creating a blog website. Whenever I post something through admin panel, it gets displayed as one paragraph. I want it to have a few paragraphs and a lil bit of text formatting like bold, etc. Any idea?
@thesanjeevsharma https://github.com/aljosa/django-tinymce —> This is one I use.