%global _empty_manifest_terminate_build 0 Name: python-mad-notifications Version: 1.5.3 Release: 1 Summary: A Django app to send push notifications to to users. License: Other/Proprietary License URL: https://www.madithouse.com/ Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b1/3a/6e20bf6b47ea4eedec5a8e81b34997a3ed5d212626a214c695541ca0488a/mad_notifications-1.5.3.tar.gz BuildArch: noarch %description # Mad Notifications Mad Notifications app for django to send notifications to the user ## Quick start 1. Add "mad_notifications" to your INSTALLED_APPS setting like this: ```python INSTALLED_APPS = [ ... 'mad_notifications', ] ``` 2. Include the notifications URLconf in your project urls.py like this: ```python path('notifications/', include('mad_notifications.api.urls')), ``` 3. Run `python manage.py migrate` to create the notifications models. ## Usage ### Shorthand method ```python from mad_notifications.shorthand import newNotification # create and send return newNotification( user, # django user object title, # string content, # string template_slug = None, # slug from mad_notification.EmailTemplate data = {}, # dict actions = {} # dict ) ``` ### Notification Class ```python from mad_notifications.notification import Notification # create a notification notification = Notification( user = user, title = "New Order", content = "You have a new order!", data = { 'order': order_data, }, actions = { 'click_action': "ORDER_SCREEN" }, template = email_template, # mad_notification.EmailTemplate Object ) # send the notification notification.notify() ``` ## Overriding default ```python MAD_NOTIFICATIONS = { "FIREBASE_MOBILE_PUSH_NOTIFICATION_CLASS": "mad_notifications.senders.firebase.FirebaseMobilePushNotification", "EMAIL_NOTIFICATION_CLASS": "mad_notifications.senders.email.EmailNotification", } ``` ## Developer Guide ### Setting up a new provider Create logic in `~/senders/PROVIDER.py` and call via tasks in `~/notify/PROVIDER.py` %package -n python3-mad-notifications Summary: A Django app to send push notifications to to users. Provides: python-mad-notifications BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-mad-notifications # Mad Notifications Mad Notifications app for django to send notifications to the user ## Quick start 1. Add "mad_notifications" to your INSTALLED_APPS setting like this: ```python INSTALLED_APPS = [ ... 'mad_notifications', ] ``` 2. Include the notifications URLconf in your project urls.py like this: ```python path('notifications/', include('mad_notifications.api.urls')), ``` 3. Run `python manage.py migrate` to create the notifications models. ## Usage ### Shorthand method ```python from mad_notifications.shorthand import newNotification # create and send return newNotification( user, # django user object title, # string content, # string template_slug = None, # slug from mad_notification.EmailTemplate data = {}, # dict actions = {} # dict ) ``` ### Notification Class ```python from mad_notifications.notification import Notification # create a notification notification = Notification( user = user, title = "New Order", content = "You have a new order!", data = { 'order': order_data, }, actions = { 'click_action': "ORDER_SCREEN" }, template = email_template, # mad_notification.EmailTemplate Object ) # send the notification notification.notify() ``` ## Overriding default ```python MAD_NOTIFICATIONS = { "FIREBASE_MOBILE_PUSH_NOTIFICATION_CLASS": "mad_notifications.senders.firebase.FirebaseMobilePushNotification", "EMAIL_NOTIFICATION_CLASS": "mad_notifications.senders.email.EmailNotification", } ``` ## Developer Guide ### Setting up a new provider Create logic in `~/senders/PROVIDER.py` and call via tasks in `~/notify/PROVIDER.py` %package help Summary: Development documents and examples for mad-notifications Provides: python3-mad-notifications-doc %description help # Mad Notifications Mad Notifications app for django to send notifications to the user ## Quick start 1. Add "mad_notifications" to your INSTALLED_APPS setting like this: ```python INSTALLED_APPS = [ ... 'mad_notifications', ] ``` 2. Include the notifications URLconf in your project urls.py like this: ```python path('notifications/', include('mad_notifications.api.urls')), ``` 3. Run `python manage.py migrate` to create the notifications models. ## Usage ### Shorthand method ```python from mad_notifications.shorthand import newNotification # create and send return newNotification( user, # django user object title, # string content, # string template_slug = None, # slug from mad_notification.EmailTemplate data = {}, # dict actions = {} # dict ) ``` ### Notification Class ```python from mad_notifications.notification import Notification # create a notification notification = Notification( user = user, title = "New Order", content = "You have a new order!", data = { 'order': order_data, }, actions = { 'click_action': "ORDER_SCREEN" }, template = email_template, # mad_notification.EmailTemplate Object ) # send the notification notification.notify() ``` ## Overriding default ```python MAD_NOTIFICATIONS = { "FIREBASE_MOBILE_PUSH_NOTIFICATION_CLASS": "mad_notifications.senders.firebase.FirebaseMobilePushNotification", "EMAIL_NOTIFICATION_CLASS": "mad_notifications.senders.email.EmailNotification", } ``` ## Developer Guide ### Setting up a new provider Create logic in `~/senders/PROVIDER.py` and call via tasks in `~/notify/PROVIDER.py` %prep %autosetup -n mad_notifications-1.5.3 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-mad-notifications -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu Jun 08 2023 Python_Bot - 1.5.3-1 - Package Spec generated