openedx.core.djangoapps.notifications.management.commands package#

Submodules#

openedx.core.djangoapps.notifications.management.commands.delete_expired_notifications module#

Management command for deleting expired notifications

class openedx.core.djangoapps.notifications.management.commands.delete_expired_notifications.Command(stdout=None, stderr=None, no_color=False, force_color=False)#

Bases: BaseCommand

Invoke with:

python manage.py lms delete_expired_notifications

handle(*args, **kwargs)#

The actual logic of the command. Subclasses must implement this method.

help = 'Deletes notifications that have been expired'#

openedx.core.djangoapps.notifications.management.commands.delete_notifications module#

Management command for deleting notifications with parameters

class openedx.core.djangoapps.notifications.management.commands.delete_notifications.Command(stdout=None, stderr=None, no_color=False, force_color=False)#

Bases: BaseCommand

Invoke with:

python manage.py lms delete_notifications

add_arguments(parser)#

Add command line arguments to management command

handle(*args, **kwargs)#

Calls delete notifications task

help = 'Delete notifications that meets a criteria. Requires app_name, notification_type and created (duration)'#
openedx.core.djangoapps.notifications.management.commands.delete_notifications.argparse_date(string: str)#

Argparse Type to return datetime dictionary from string Returns { ‘created__gte’: datetime, ‘created__lte’: datetime, }

openedx.core.djangoapps.notifications.management.commands.delete_notifications.parse_date(string)#

Converts string date to datetime object

openedx.core.djangoapps.notifications.management.commands.fix_mixed_email_cadence module#

Management command to fix NotificationPreference records with invalid ‘Mixed’ email_cadence values created during migration.

class openedx.core.djangoapps.notifications.management.commands.fix_mixed_email_cadence.Command(stdout=None, stderr=None, no_color=False, force_color=False)#

Bases: BaseCommand

Management command to identify and correct NotificationPreference records with an invalid ‘Mixed’ value in the email_cadence field.

By default, the command runs in dry-run mode and only logs the count of affected records. Use the –fix flag to replace all ‘Mixed’ values with ‘Daily’, ensuring data consistency with defined model choices. Invoke with:

python manage.py [lms] fix_mixed_email_cadence –fix

add_arguments(parser)#

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)#

The actual logic of the command. Subclasses must implement this method.

help = "Identifies NotificationPreference records with 'Mixed' as email_cadence and optionally replaces it with a valid value (default: 'Daily')."#

openedx.core.djangoapps.notifications.management.commands.send_email_digest module#

Management command for sending email digest.

DEPRECATED: This command is retained for backward compatibility. Digest emails are now scheduled automatically via delayed Celery tasks when notifications are created. Remove any cron jobs calling this command.

class openedx.core.djangoapps.notifications.management.commands.send_email_digest.Command(stdout=None, stderr=None, no_color=False, force_color=False)#

Bases: BaseCommand

Invoke with:

python manage.py lms send_email_digest [cadence_type] cadence_type: Daily or Weekly

DEPRECATED: Digest emails are now automatically scheduled via delayed Celery tasks when notifications are created.

add_arguments(parser)#

Adds management commands parser arguments

handle(*args, **kwargs)#

Start task to send email digest to users

help = 'DEPRECATED: Send email digest to users. Digest emails are now scheduled automatically. Remove cron jobs using this command.'#

openedx.core.djangoapps.notifications.management.commands.update_notification_preferences module#

Management command for updating notification preferences with parameters

class openedx.core.djangoapps.notifications.management.commands.update_notification_preferences.Command(stdout=None, stderr=None, no_color=False, force_color=False)#

Bases: BaseCommand

Management command to update boolean notification preferences.

This command updates channel (web, push, email) in the NotificationPreference model for a given app and type.

Features:
  • Requires app and type, validated against COURSE_NOTIFICATION_APPS and COURSE_NOTIFICATION_TYPES.

  • Allows updating a single channel to true or false.

  • Supports optional –user_ids argument to limit updates to specific users.

  • Provides a –dry-run mode to preview changes without committing to the database.

  • Logs the number of affected records and affected user IDs.

Example usage:

python manage.py update_notification_preference discussion new_comment_on_response email false python manage.py update_notification_preference discussion new_comment_on_response push false –user_ids 5 7 12 python manage.py update_notification_preference discussion new_comment_on_response web false –dry-run

add_arguments(parser)#

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)#

The actual logic of the command. Subclasses must implement this method.

help = 'Update boolean notification preferences for users at account level.'#

Module contents#