def ready(self): super(GroundtruthAppConfig, self).ready() GroundtruthRecord = self.get_model('GroundtruthRecord') registry.register(GroundtruthRecord) django_monitor.nq(GroundtruthRecord) import signals
def ready(self): import django_monitor StewardNotification = self.get_model('StewardNotification') django_monitor.nq(StewardNotification) # Disconnect monitor's post-save handler, moderation will be handled in the # view from django_monitor.util import save_handler post_save.disconnect(save_handler, sender=StewardNotification) from . import signals
def ready(self): super(FriendlyOwnersAppConfig, self).ready() FriendlyOwner = self.get_model('FriendlyOwner') django_monitor.nq(FriendlyOwner) # Disconnect monitor's post-save handler, moderation will be handled in # the view post_save.disconnect(save_handler, sender=FriendlyOwner) from .signals import *
def ready(self): import django_monitor GroundtruthRecord = self.get_model('GroundtruthRecord') django_monitor.nq(GroundtruthRecord) # Disconnect monitor's post-save handler, moderation will be handled in the # view from django_monitor.util import save_handler post_save.disconnect(save_handler, sender=GroundtruthRecord) from . import signals
from django.conf.urls import patterns, url from django.db.models.signals import post_save import django_monitor from django_monitor.util import save_handler from .models import StewardNotification from .views import AddStewardNotificationView, AddStewardNotificationSuccessView urlpatterns = patterns('', url(r'^add/$', AddStewardNotificationView.as_view(), name='add_stewardnotification'), url(r'^(?P<stewardnotification_pk>\d+)/add/success/$', AddStewardNotificationSuccessView.as_view(), name='add_stewardnotification_success'), ) django_monitor.nq(StewardNotification) # Disconnect monitor's post-save handler--moderation handled in view post_save.disconnect(save_handler, sender=StewardNotification)
from django.conf.urls import patterns, url from django.db.models.signals import post_save import django_monitor from django_monitor.util import save_handler from .models import GroundtruthRecord from .views import AddGroundtruthRecordView, AddGroundtruthRecordSuccessView urlpatterns = patterns('', url(r'^add/$', AddGroundtruthRecordView.as_view(), name='add_groundtruthrecord'), url(r'^(?P<groundtruthrecord_pk>\d+)/add/success/$', AddGroundtruthRecordSuccessView.as_view(), name='add_groundtruthrecord_success'), ) django_monitor.nq(GroundtruthRecord) # Disconnect monitor's post-save handler, moderation will be handled in the # view post_save.disconnect(save_handler, sender=GroundtruthRecord)
""" Moderated model """ name = models.CharField(max_length=100) age = models.IntegerField() # To make sure that post_moderation signal is emitted. signal_emitted = models.BooleanField(editable=False, default=False) def __unicode__(self): return self.name def collect_signal(self): """Registers the emission of post_moderation signals""" self.signal_emitted = True self.save() django_monitor.nq(Author) def auth_moderation_handler(sender, instance, **kwargs): """ Receives the post_moderation signal from Author & passes it to the instance """ instance.collect_signal() django_monitor.post_moderation.connect(auth_moderation_handler, sender=Author) class Publisher(models.Model): """ Not moderated model """ name = models.CharField(max_length=255)
dispatch_uid='watcher_subscribe_organizer_watcher') def subscribe_organizer_watcher(sender, created=False, instance=None, **kwargs): if created: subscribe(instance, is_participating=True) # # Moderation # import django_monitor from django_monitor.util import save_handler django_monitor.nq(Note) django_monitor.nq(Organizer) # Disconnect monitor's post-save handler post_save.disconnect(save_handler, sender=Note) post_save.disconnect(save_handler, sender=Organizer) # # Signals # from django.dispatch import receiver from django_monitor import post_moderation @receiver(post_moderation, sender=Note, dispatch_uid='organize_create_note')
@receiver(post_save, sender=Organizer, dispatch_uid='organizer_subscribe_organizer_watcher') @receiver(post_save, sender=Watcher, dispatch_uid='watcher_subscribe_organizer_watcher') def subscribe_organizer_watcher(sender, created=False, instance=None, **kwargs): if created: subscribe(instance, is_participating=True) # # Moderation # import django_monitor from django_monitor.util import save_handler django_monitor.nq(Note) django_monitor.nq(Organizer) # Disconnect monitor's post-save handler post_save.disconnect(save_handler, sender=Note) post_save.disconnect(save_handler, sender=Organizer) # # Signals # from django.dispatch import receiver from django_monitor import post_moderation
class Author(models.Model): """ Moderated model """ name = models.CharField(max_length = 100) age = models.IntegerField() # To make sure that post_moderation signal is emitted. signal_emitted = models.BooleanField(editable = False, default = False) def __unicode__(self): return self.name def collect_signal(self): """Registers the emission of post_moderation signals""" self.signal_emitted = True self.save() django_monitor.nq(Author) def auth_moderation_handler(sender, instance, **kwargs): """ Receives the post_moderation signal from Author & passes it to the instance """ instance.collect_signal() django_monitor.post_moderation.connect( auth_moderation_handler, sender = Author ) class Publisher(models.Model): """ Not moderated model """ name = models.CharField(max_length = 255) num_awards = models.IntegerField()
from django.conf.urls import patterns, url from django.db.models.signals import post_save import django_monitor from django_monitor.util import save_handler from .models import FriendlyOwner from .views import AddFriendlyOwnerView, AddFriendlyOwnerSuccessView urlpatterns = patterns('', url(r'^add/$', AddFriendlyOwnerView.as_view(), name='add'), url(r'^add/success/$', AddFriendlyOwnerSuccessView.as_view(), name='add_success'), ) django_monitor.nq(FriendlyOwner) # Disconnect monitor's post-save handler, moderation will be handled in the # view post_save.disconnect(save_handler, sender=FriendlyOwner)
def ready(self): super(StewardAppConfig, self).ready() django_monitor.nq(self.get_model('StewardNotification')) import signals
from django.conf.urls import patterns, url from django.db.models.signals import post_save import django_monitor from django_monitor.util import save_handler from .models import FriendlyOwner from .views import AddFriendlyOwnerView, AddFriendlyOwnerSuccessView urlpatterns = patterns( '', url(r'^add/$', AddFriendlyOwnerView.as_view(), name='add'), url(r'^add/success/$', AddFriendlyOwnerSuccessView.as_view(), name='add_success'), ) django_monitor.nq(FriendlyOwner) # Disconnect monitor's post-save handler, moderation will be handled in the # view post_save.disconnect(save_handler, sender=FriendlyOwner)