Пример #1
0
def index():
    person_count = MissedPerson.objects(user=current_user.id).count()
    notification_count = NotificationMethod.objects(user=current_user.id).count()

    not_seen = Detection.objects(user=current_user.id, seen=False).count()
    return render_template("index.html",
                           person_count=person_count,
                           notification_count=notification_count,
                           not_seen=not_seen)
Пример #2
0
    def validate(self):
        valid = super(NotificationForm, self).validate()

        filters = self.data
        filters['user'] = self.user

        if NotificationMethod.objects(**filters):
            self.errors['__all__'] = [u"Método de notificação já cadastrado."]
            valid = False

        return valid
Пример #3
0
    def run(self, detection):
        if detection is None:
            return None

        print(detection.person.name)

        self.detection = detection
        methods = NotificationMethod.objects(user=detection.person.user)

        for method in methods:
            self.notify(method)
Пример #4
0
def list_notification_methods():
    methods = NotificationMethod.objects(user=current_user.id)
    return render_template("notifications/list.html", notification_methods=methods)