def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print "Creating notices for myapp" NoticeType.create("event_invite", _("A new event have been organize! Come and participate"), _("you have received an invitation")) else: print "Skipping creation of NoticeTypes as notification app not found"
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: print "Creating notices for myapp" NoticeType.create("received_email", _("Private messages"), _("(this is highly recommended)")) signals.post_syncdb.connect(create_notice_types, sender=notification) else: print "Skipping creation of NoticeTypes (Threaded Messages) as notification app not found"
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print "Creating notices for condottieri_messages" NoticeType.create("condottieri_messages_received", _("Letter Received"), _("you have received a letter"), default=2) else: print "condottieri_messages: Skipping creation of NoticeTypes"
def update(self, request, *args, **kwargs): partial = kwargs.pop('partial', False) instance = self.get_object() serializer = self.get_serializer(instance, data=request.data, partial=partial) serializer.is_valid(raise_exception=True) self.perform_update(serializer) time = f"{datetime.now()}" if request.data.get('status'): if request.data['status'] == Event.QUOTATION: supplier = Suppliers.objects.get(id=request.tenant.id) user = User.objects.filter(user_type=User.ASSOCIATE_USER) NoticeType.create( f"quotation_{instance.id}_{time[5:-7]}", _(instance.name), _(instance.name + " has been changed to quotation")) send(user, f"quotation_{instance.id}_{time[5:-7]}", {"from_user": settings.DEFAULT_FROM_EMAIL}) if request.data['status'] == Event.CONFIRMATION: NoticeType.create( f"confirmation_{instance.id}_{time[5:-7]}", _(instance.name), _(instance.name + " has been changed to confirmation")) send([instance.client.user], f"confirmation_{instance.id}_{time[5:-7]}", {"from_user": settings.DEFAULT_FROM_EMAIL}) if getattr(instance, '_prefetched_objects_cache', None): # If 'prefetch_related' has been applied to a queryset, we need to # forcibly invalidate the prefetch cache on the instance. instance._prefetched_objects_cache = {} return Response(serializer.data)
def create_notice_types(): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print("Creating notices for company") NoticeType.create('new_company', ' New Company ', 'There is a company added') else: print("Notification app not found")
def create_notice_types(): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print("Creating notices for job") NoticeType.create('new_job', ' Job Vacancy ', 'New Job vacancy created') else: print("Notification app not found")
def create_notice_types(): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print("Creating notices for review") NoticeType.create('new_review', ' Review added ', 'Check out this review') else: print("Notification app not found")
def create_notice_types(**_): if 'pinax.notifications' in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print('Creating notices for autonag') NoticeType.create('new_mentor', 'New mentor', 'you have a new mentor') NoticeType.create('new_mentee', 'New mentee', 'you have a new mentee') else: print('Skipping creation of NoticeTypes as notification app not found')
def create_notice_types(sender, **kwargs): if "pinax.notifications" in base.INSTALLED_APPS: from pinax.notifications.models import NoticeType print("Creating notices for follow") NoticeType.create("new_follower", _("New Follower"), _("You have a new follower."), default=2) else: print("Skipping creation of NoticeTypes as notification app not found")
def create_notice_types(**_): if 'pinax.notifications' in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print('Creating notices for autonag') NoticeType.create( 'new_mentor', 'New mentor', 'you have a new mentor') NoticeType.create( 'new_mentee', 'New mentee', 'you have a new mentee') else: print('Skipping creation of NoticeTypes as notification app not found')
def create_notice_types(): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print("Creating notices for blog") NoticeType.create('new_blog', ' Recent Blog Post ', 'Check out this post ') NoticeType.create('new_comment', ' Comment ', 'There is a comment added') else: print("Notification app not found")
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType logger.debug("Creating notices for myapp") NoticeType.create("vatic_job_invite", _("Space-Time Job Invitation Received"), _("you have received an invitation")) NoticeType.create("vatic_job_accept", _("Space-Time Job Acceptance Received"), _("an invitation you sent has been accepted")) else: logger.debug( "Skipping creation of NoticeTypes as notification app not found")
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print("Creating notices for checkerapp") NoticeType.create( "assignment_feedback", _("Feedback op opdracht ontvangen"), _("Je hebt feedback ontvangen op een opdracht die je hebt ingezonden." )) NoticeType.create("new_feedback_ticket", _("Received new feedback ticket"), _("You have received a new feedback ticket.")) else: print("Skipping creation of NoticeTypes as notification app not found")
def create_notice_types(sender, **kwargs): """ define NoticeType for this app """ if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType logger.debug("Creating notices for ela") NoticeType.create( "signup_user", _("User Signup"), _("an user join to ela") ) # ... for more notice type else: logger.debug("Skipping creation of NoticeTypes as notification app not " "found")
def send_event_status_notification(instance, request): """ Send notifications when Event Status is changed. """ # FIXME change notificxation logic time = f"{datetime.now()}" if instance.status == Event.QUOTATION: # supplier = Suppliers.objects.get(id=request.tenant.id) user = User.objects.filter(user_type=User.ASSOCIATE_USER) NoticeType.create(f"quotation_{instance.id}_{time[5:-7]}", _(instance.name), _(instance.name + " has been changed to quotation")) send(user, f"quotation_{instance.id}_{time[5:-7]}", {"from_user": settings.DEFAULT_FROM_EMAIL}) if request.data['status'] == Event.CONFIRMATION: NoticeType.create( f"confirmation_{instance.id}_{time[5:-7]}", _(instance.name), _(instance.name + " has been changed to confirmation")) send([instance.client.user], f"confirmation_{instance.id}_{time[5:-7]}", {"from_user": settings.DEFAULT_FROM_EMAIL})
def create_notice_types(app, created_models, verbosity, **kwargs): #Notice types to send to users related to requests NoticeType.create("request_available", _("Request Available"), _("A new request is available")) NoticeType.create("request_accepted", _("Request Accepted"), _("Someone has accepted your request")) NoticeType.create("request_assigned", _("Assigned to Request"), _("Let's get to work"))
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType NoticeType.create("Referral_registered", _("New Referral"), _("One referral of you has join Betcnow")) NoticeType.create("Play_made", _("New play made"), _("You have made a new play")) NoticeType.create("Membership_upgraded", _("Membership upgraded"), _("You have purchased a new Betcnow 30-days Membership")) else: print("Skipping creation of NoticeTypes as notification app not found")
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print("Creating notification objects") NoticeType.create('profile_changed', _('Profile Changed'), _('A member changed their profile')) else: print("Skipping creation of NoticeTypes as notification app not found") # set the Site name (default is example.com) site = apps.get_model('sites', 'Site') site.objects.update_or_create(id=settings.SITE_ID, defaults={ 'domain': 'tzuri.myshul.nadalia.com', 'name': 'צורי' }) # Only head-of-households require the Kiddush duty from users.models import Profile qs = Profile.duties.through.objects.filter( profile__head_of_household=False, duty__pk=19).delete() #Generate verification codes print( '************************** Generating verification codes ************************************' ) from users.models import Profile #qs = Profile.objects.filter(verification_code__isnull=True) qs = Profile.objects.all() print('Generating verification code for profiles: ', qs.count()) for p in qs: p.generate_verification_code() p.save() print( '************************** Finished Generating verification codes ************************************' )
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print "Creating notices for condottieri_profiles" NoticeType.create("karma_healed", _("Karma healed"), _("you have recovered the minimum karma to join games")) NoticeType.create("new_friend", _("New friend"), _("a user has befriended you")) NoticeType.create("friend_joined", _("Friend joined a game"), _("a friend of you has just joined a game")) else: print "condottieri_profiles: Skipping creation of NoticeTypes"
def handle(self, *args, **options): NoticeType.create( "create_meeting_slot", _("Periodo de reunion creada"), _("tu periodo de reunion esta lista"), ) NoticeType.create( "reserved_meeting_slot", _("Reunion aceptada"), _("tu reunion ha sido aceptada"), ) NoticeType.create( "cancelled_by_mentor", _("Reunion cancelada por el mentor"), _("tu reunion ha sido cancelada"), ) NoticeType.create( "cancelled_by_protege", _("Reunion cacelada por aprendiz"), _("your meeting has been cancelled"), ) NoticeType.create( "confirmed_meeting", _("Reunion confirmada"), _("su reunion ha sido confirmada"), ) NoticeType.create( "post_meeting_mentor", _("Dejenos saber"), _("como le fue en su reunion?") ) NoticeType.create( "post_meeting_protege", _("Dejenos saber"), _("como le fue en su reunion?") ) NoticeType.create( "comment", _("Comentario nuevo"), _("tienes un nuevo comentario") ) self.stdout.write("--> Created notice types")
def create_notice_types(sender, **kwargs): """Create notice types to send email notifications""" NoticeType.create("new_join_request", ("New Join Request"), ("a user has requested to join the meetup location")) NoticeType.create("joined_meetup_location", ("Joined Meetup Location"), ("you have joined a meetup location")) NoticeType.create("made_moderator", ("Made moderator"), ("you have been made an moderator of a meetup location")) NoticeType.create("new_meetup", ("New Meetup"), ("a new meetup has been added")) NoticeType.create("new_support_request", ("New Support Request"), ("a user has added a support request")) NoticeType.create("support_request_approved", ("Support Request Approved"), ("your support request has been approved")) NoticeType.create("new_meetup_request", ("New Meetup Request"), ("a user has added a meetup request"))
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType NoticeType.create("valnet_join_task", _("Join Task"), _("a colleaque wants to help with this task"), default=0) NoticeType.create("valnet_help_wanted", _("Help Wanted"), _("a colleague requests help that fits your skills"), default=0) NoticeType.create("valnet_new_task", _("New Task"), _("a new task was posted that fits your skills"), default=0) NoticeType.create("valnet_new_todo", _("New Todo"), _("a new todo was posted that is assigned to you"), default=0) NoticeType.create("valnet_deleted_todo", _("Deleted Todo"), _("a todo that was assigned to you has been deleted"), default=0) NoticeType.create("valnet_distribution", _("New Distribution"), _("you have received a new income distribution"), default=0) NoticeType.create("valnet_payout_request", _("Payout Request"), _("you have received a new payout request"), default=0) NoticeType.create("work_membership_request", _("Freedom Coop Membership Request"), _("we have received a new membership request"), default=0) NoticeType.create("work_join_request", _("Project Join Request"), _("we have received a new join request"), default=0) NoticeType.create("work_new_account", _("Project New OCP Account"), _("a new OCP account details")) #, default=0) NoticeType.create("comment_membership_request", _("Comment in Freedom Coop Membership Request"), _("we have received a new comment in a membership request"), default=0) NoticeType.create("comment_join_request", _("Comment in Project Join Request"), _("we have received a new comment in a join request")) #, default=1) NoticeType.create("work_skill_suggestion", _("Skill suggestion"), _("we have received a new skill suggestion"), default=0) print "created valueaccounting notice types" else: print "Skipping creation of valueaccounting NoticeTypes as notification app not found"
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print("Creating notices for changes") NoticeType.create(NOTICE_SUSTAINING_MEMBER_CREATED, _("Sustaining Member Created"), _("A sustaining member has been created")) NoticeType.create(NOTICE_SUSTAINING_MEMBER_UPDATED, _("Sustaining Member Updated"), _("A sustaining member has been updated")) NoticeType.create(NOTICE_SUSTAINING_MEMBER_REJECTED, _("Sustaining Member Rejected"), _("A sustaining member has been rejected")) NoticeType.create(NOTICE_SUSTAINING_MEMBER_APPROVED, _("Sustaining Member Approved"), _("A sustaining member has been approved")) NoticeType.create(NOTICE_SUBSCRIPTION_CREATED, _("Subscription Created"), _("A subscription has been created")) NoticeType.create(NOTICE_SUBSCRIPTION_UPDATED, _("Subscription Updated"), _("A subscription has been updated")) NoticeType.create(NOTICE_TOP_UP_SUCCESS, _("Top Up Successful"), _("Top Up Successful")) else: print("Skipping creation of NoticeTypes as notification app not found")
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print("Creating notices for wikum") NoticeType.create( "reply_in_thread", _("Reply"), _("Someone replied to a comment in your comment thread")) NoticeType.create( "subscribed_reply", _("Reply to Subscribed"), _("Someone replied to a comment you are subscribed to")) NoticeType.create("summary_edit", _("Summary Edited"), _("Someone has edited a summary you contributed to")) NoticeType.create("subscribed_edit", _("Edit to Subscribed"), _("Someone edited a summary you are subscribed to")) NoticeType.create("summarize_your_comment", _("Summarized Comment"), _("Someone summarized your comment")) NoticeType.create("at_user", _("Mention User"), _("Someone mentioned you in a comment")) else: print("Skipping creation of NoticeTypes as notification app not found")
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType NoticeType.create("valnet_join_task", _("Join Task"), _("a colleaque wants to help with this task"), default=0) NoticeType.create("valnet_help_wanted", _("Help Wanted"), _("a colleague requests help that fits your skills"), default=0) NoticeType.create("valnet_new_task", _("New Task"), _("a new task was posted that fits your skills"), default=0) NoticeType.create("valnet_new_todo", _("New Todo"), _("a new todo was posted that is assigned to you"), default=0) NoticeType.create( "valnet_deleted_todo", _("Deleted Todo"), _("a todo that was assigned to you has been deleted"), default=0) NoticeType.create("valnet_distribution", _("New Distribution"), _("you have received a new income distribution"), default=0) NoticeType.create("valnet_payout_request", _("Payout Request"), _("you have received a new payout request"), default=0) NoticeType.create("work_membership_request", _("Freedom Coop Membership Request"), _("we have received a new membership request"), default=0) NoticeType.create("work_join_request", _("Project Join Request"), _("we have received a new join request"), default=0) NoticeType.create("work_new_account", _("Project New OCP Account"), _("a new OCP account details")) #, default=0) NoticeType.create( "comment_membership_request", _("Comment in Freedom Coop Membership Request"), _("we have received a new comment in a membership request"), default=0) NoticeType.create("comment_join_request", _("Comment in Project Join Request"), _("we have received a new comment in a join request") ) #, default=1) NoticeType.create("work_skill_suggestion", _("Skill suggestion"), _("we have received a new skill suggestion"), default=0) print "created valueaccounting notice types" else: print "Skipping creation of valueaccounting NoticeTypes as notification app not found"
def handle(self, *args, **options): NoticeType.create( 'create_meeting_slot', _('Periodo de reunion creada'), _('tu periodo de reunion esta lista') ) NoticeType.create( 'reserved_meeting_slot', _('Reunion aceptada'), _('tu reunion ha sido aceptada') ) NoticeType.create( 'cancelled_by_mentor', _('Reunion cancelada por el mentor'), _('tu reunion ha sido cancelada') ) NoticeType.create( 'cancelled_by_protege', _('Reunion cacelada por aprendiz'), _('your meeting has been cancelled') ) NoticeType.create( 'confirmed_meeting', _('Reunion confirmada'), _('su reunion ha sido confirmada') ) NoticeType.create( 'post_meeting_mentor', _('Dejenos saber'), _('como le fue en su reunion?') ) NoticeType.create( 'post_meeting_protege', _('Dejenos saber'), _('como le fue en su reunion?') ) NoticeType.create( 'comment', _('Comentario nuevo'), _('tienes un nuevo comentario') ) self.stdout.write('--> Created notice types')
def create_notice_types(sender, **kwargs): if "pinax.notifications" in base.INSTALLED_APPS and getattr( base, 'DJANGO_MESSAGES_NOTIFY', True): from pinax.notifications.models import NoticeType print("Creating notices for django_messages") NoticeType.create("messages_received", _("Message Received"), _("you have received a message"), default=2) NoticeType.create("messages_sent", _("Message Sent"), _("you have sent a message"), default=0) NoticeType.create("messages_replied", _("Message Replied"), _("you have replied to a message"), default=0) NoticeType.create("messages_reply_received", _("Reply Received"), _("you have received a reply to a message"), default=2) NoticeType.create("messages_deleted", _("Message Deleted"), _("you have deleted a message"), default=0) NoticeType.create("messages_recovered", _("Message Recovered"), _("you have undeleted a message"), default=0) else: print("Skipping creation of NoticeTypes as notification app not found")
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print("Creating notices for letshang") NoticeType.create("user_match", _("Match Received"), _("you have been matched"))
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType print "Creating notices for machiavelli" NoticeType.create("game_started", _("Game started"), _("a game that you're a player in has started")) NoticeType.create("game_over", _("Game over"), _("a game that you're playing is over")) NoticeType.create("new_phase", _("New phase"), _("a new phase has begun")) NoticeType.create("received_ducats", _("Ducats received"), _("you have received some ducats")) NoticeType.create("new_revolution", _("New revolution"), _("you skipped your turn")) NoticeType.create("missed_turn", _("Missed turn"), _("you missed your turn")) NoticeType.create("overthrow_attempt", _("Overthrow attempt"), _("you are being overthrown")) NoticeType.create("lost_player", _("Overthrow"), _("you have been overthrown")) NoticeType.create("got_player", _("Overthrow"), _("you have overthrown a government")) NoticeType.create("new_invitation", _("New invitation"), _("you have been invited to a private game")) NoticeType.create( "lost_invitation", _("Invitation revoked"), _("your invitation to a private game has been revoked")) NoticeType.create("team_message_received", _("Team message received"), _("you receive a team message")) NoticeType.create("player_excommunicated", _("Player excommunicated"), _("you are excommunicated in a game")) NoticeType.create("player_absolved", _("Player absolved"), _("your excommunication is lifted")) NoticeType.create("game_expired", _("Expired game"), _("one of your games expires and is deleted")) else: print "machiavelli: Skipping creation of NoticeTypes"
def create_notice_types(sender, **kwargs): from pinax.notifications.models import NoticeType print("Creating notices for Initproc") # Invitations NoticeType.create(NOTIFICATIONS.INVITE.SEND, 'Einladung zu Initiative', 'Du wurdest zu einer neuen Initiative eingeladen') NoticeType.create(NOTIFICATIONS.INVITE.ACCEPTED, 'Einladung angenommen', 'Die Einladung wurde angenommen') NoticeType.create(NOTIFICATIONS.INVITE.REJECTED, 'Einladung abgelehnt', 'Die Einladung wurde abgelehnt') # Initiative NoticeType.create(NOTIFICATIONS.INITIATIVE.EDITED, 'Initiative überarbeitet', 'Die Initiative wurde überarbeitet') NoticeType.create(NOTIFICATIONS.INITIATIVE.SUBMITTED, 'Initiative eingereicht', 'Die Initiative wurde eingereicht') NoticeType.create(NOTIFICATIONS.INITIATIVE.PUBLISHED, 'Initiative veröffentlicht', 'Die Initiative wurde veröffentlicht') NoticeType.create(NOTIFICATIONS.INITIATIVE.WENT_TO_DISCUSSION, 'Initiative in Diskussion', 'Die Initiative ist in die Diskussionphase eingetreten') NoticeType.create(NOTIFICATIONS.INITIATIVE.DISCUSSION_CLOSED, 'Diskussion zu Initiative beendet', 'Die Initiative kann jetzt final überarbeitet werden') NoticeType.create(NOTIFICATIONS.INITIATIVE.WENT_TO_VOTE, 'Initiative in Abstimmung', 'Die Initiative ist in die Abstimmung gegangen') # DISCUSSION NoticeType.create( NOTIFICATIONS.INITIATIVE.NEW_ARGUMENT, 'Neues Argument in Diskussion zu Initiative', 'Es wurde ein neues Argument in der Diskussion zur Initiative gepostet' )
def create_notice_types(sender, **kwargs): if "pinax.notifications" in settings.INSTALLED_APPS: from pinax.notifications.models import NoticeType NoticeType.create( "X_proposal_important", "Proposal Decision", "The proposal you have submitted was accepted/returned/rejected. You will always be informed about it." ) NoticeType.create( "x_proposal_important_team", "Team Proposal Decision", "The proposal you are part of the team was accepted/returned/rejected." ) NoticeType.create( "x_proposal_status_changed", "Proposal status changed", "The proposal you have submitted changed the status.", 1) NoticeType.create( "L_request_technical", "Technical review requested (LC)", "You (as a local contact) need to perform technical check of the proposal." ) NoticeType.create( "l_accepted", "Proposal accepted (LC)", "Proposal, where you are local contact was accepted and can be scheduled.", 1) NoticeType.create( "P_request_review", "Panel review requested (P)", "You (as a panel member) need to perform review of the proposal.") NoticeType.create( "p_request_comments", "Panel comments requested (P)", "Another panel member was assigned to the proposal.") NoticeType.create( "H_new_proposal", "Reporter selection requested (PH)", "You (as a panel head) need to assign reporter to the proposal.") NoticeType.create( "D_accepted", "Director approval needed (D)", "You (as a director) need approve or reject accepted proposal by the panel." ) NoticeType.create("d_rejected", "Proposal rejected by the panel (D)", "Inform about any rejection of the proposal.", 1) NoticeType.create( "d_returned", "Proposal returned to user (D)", "Inform about any return of the proposal to the user.", 1) NoticeType.create( "U_submited", "New proposal submitted (UO)", "New proposal was submitted and user office need to check it.") NoticeType.create("a_submited", "New proposal submitted (A)", "Inform about any new submitted proposal.") NoticeType.create( "a_accepted", "Proposal accepted (A)", "Inform about all proposals accepted by the director.") NoticeType.create( "B_new_proposal", "Board review requested (B)", "MGML Board (you are a member) need to perform review of the proposal." ) #Report NoticeType.create( "X_report", "Experimental report requested", "You need to submit an experimental report. You will always be informed about it." ) # booking notifications NoticeType.create("X_booking_changed", "Booking modified", "Your booked slot was canceled/modified.") NoticeType.create( "x_booking_new", "New Team booking", "There is a new booking for a proposal you are part of a team.", 1) NoticeType.create( "l_booking_lc", "New local contact job", "You were selected as a local contact for some booking") NoticeType.create("l_booking_lc_changed", "LC booking modified", "Your LC booked slot was canceled/modified.") NoticeType.create( "x_reminder", "Your experiment is coming", "Get reminder one day before about upcoming measurements.")