Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Add extra data to Django notifications model object (extend the notify signal)

Extra data
You can attach arbitrary data to your notifications by doing the following:

Add to your settings.py: DJANGO_NOTIFICATIONS_CONFIG = { 'USE_JSONFIELD': True}
Then, any extra arguments you pass to notify.send(...) will be attached to the .data attribute of the notification object. These will be serialised using the JSONField's serialiser, so you may need to take that into account: using only objects that will be serialised is a good idea.
Comment

PREVIOUS NEXT
Code Example
Python :: python certain charaacter in string 
Python :: not all arguments converted during string formatting postgresql 
Python :: django url with special characters in template 
Python :: python identation 
Python :: url encoding in python 
Python :: As a general rule in python 
Python :: python autorun script 
Python :: python read text on screen 
Python :: matplotlib facet scatter 
Python :: ENCAPSUALTION 
Python :: adding multiple items to a list python 
Python :: import * with __import__ 
Python :: Python Tkinter Scale Widget Syntax 
Python :: The get() method on Python dicts and its "default" arg 
Python :: how to track exact location of a phone number in python 
Python :: pygame lerp 
Python :: python denest list of anything 
Python :: from django.urls import path, re_path 
Python :: Python | Set 3 (Strings, Lists, Tuples, Iterations) 
Python :: property values 
Python :: slice all elements from list 
Python :: pylance not reading django 
Python :: python using recursion advanced 
Python :: jax.numpy 
Python :: Django forms I cannot save picture file 
Python :: dalsports 
Python :: odoo site map for employees hierarchy 
Python :: rotate an image python keras 
Python :: 1 min candle resampling pandas 
Python :: all possibilities of 0 and 1 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =