Beispiel #1
0
    def ready(self):
        super(GroundtruthAppConfig, self).ready()
        GroundtruthRecord = self.get_model('GroundtruthRecord')
        registry.register(GroundtruthRecord)
        django_monitor.nq(GroundtruthRecord)

        import signals
Beispiel #2
0
    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
Beispiel #3
0
    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 *
Beispiel #4
0
    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
Beispiel #5
0
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)
Beispiel #6
0
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)
Beispiel #7
0
    """ 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)
Beispiel #8
0
          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')
Beispiel #9
0

@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

Beispiel #10
0
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()
Beispiel #11
0
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)
Beispiel #12
0
 def ready(self):
     super(StewardAppConfig, self).ready()
     django_monitor.nq(self.get_model('StewardNotification'))
     import signals
Beispiel #13
0
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)