Example #1
0
def check_events_happened():
    a = Event.objects.all()
    l = []
    for a1 in a:
        if a1.user not in l:
            l.append(a1.user)
    events2 = Event.objects.filter(status="APPROVED",
                                   event_date__lt=date.today())
    for e in events2:
        e.status = "HAPPENED"
        e.save()
        services.notify_all_updated("The Event " + e.title + " has Happened",
                                    e, "USER")
    events = Event.objects.filter(status="APPROVED", event_date=date.today())
    for e in events:
        e.status = "HAPPENING TODAY"
        e.save()
        services.notify_all_updated(
            "Reminder : The Event " + e.title + " is Happening Today", e,
            "USER")
    events2 = Event.objects.filter(status="HAPPENING TODAY",
                                   event_date__lt=date.today())
    for e in events2:
        e.status = "HAPPENED"
        e.save()
        a = e.attendee_set.all()
        l = []
        for a1 in a:
            if a1.user not in l:
                l.append(a1.user)
        services.set_notification3(
            "HOW WAS THE EVENT\nGIVE FEEDBACK BY CLICKING THIS NOTIFICATION!",
            l, e, "USER")
Example #2
0
def approve_request(id):
    check_events_happened()
    req = Request.objects.get(id=id)
    if req.type == "UPDATE":
        add_registrations_to_event(req.event)
        change_status2(req.event, "APPROVED")
        services.set_notification("YOU HAVE SUCCESSFULLY UPDATED YOUR EVENT!",
                                  req.id, "ORGANIZER")
        services.notify_all_updated(
            "The Event " + req.event_title +
            " has been updated by the organizer "
            "of the event", req.event, "USER")
    elif req.type == "DELETE":
        add_registrations_to_event(req.event)
        change_status2(req.event, "DELETED")
        services.set_notification("YOU HAVE SUCCESSFULLY DELETED YOUR EVENT!",
                                  req.id, "ORGANIZER")
        services.notify_all_updated(
            "Sorry To Inform you the event " + req.event_title +
            " has been deleted by the organizer. If you had any payment then your"
            " Payment will be refunded "
            "by the organizer as soon as Possible", req.event, "USER")
    elif req.type == "NEW":
        event = req.event
        event.status = "APPROVED"
        event.save()
        services.set_notification("YOU HAVE SUCCESSFULLY CREATED A NEW EVENT!",
                                  req.id, "ORGANIZER")
        services.notify_all(
            "A new Event Has Been Added That Might Be Of Your Interest! \nClick To Regist"
            "er As Soon As Possible!", req.event, "USER")
    req.status = "APPROVED"
    req.save()
Example #3
0
def approve_request(id):
    event_services.check_events_happened()
    req = Request.objects.get(id=id)
    if req.type == "UPDATE":
        add_registrations_to_event(req.event)
        change_status2(req.event, "APPROVED")
        services.set_notification(
            "CONGRATULATIONS YOUR REQUEST FOR UPDATE HAS BEEN APPROVED BY THE ADMIN OF "
            "THIS SITE!", req.id, "ORGANIZER")
        services.notify_all_updated(
            "The Event " + req.event_title +
            " has been updated by the organizer "
            "of the event", req.event, "USER")
    elif req.type == "DELETE":
        add_registrations_to_event(req.event)
        change_status2(req.event, "DELETED")
        services.set_notification(
            "CONGRATULATIONS YOUR REQUEST FOR DELETE HAS BEEN APPROVED BY THE ADMIN OF "
            "THIS SITE!", req.id, "ORGANIZER")
        services.notify_all_updated(
            "Sorry To Inform you the event " + req.event_title +
            " has been deleted by the organizer. Your Payment will be refunded "
            "by the organizer as soon as Possible", req.event, "USER")
    elif req.type == "NEW":
        event = req.event
        event.status = "APPROVED"
        event.save()
        services.set_notification(
            "CONGRATULATIONS YOUR REQUEST HAS BEEN APPROVED BY THE ADMIN OF THIS SITE!",
            req.id, "ORGANIZER")
        services.notify_all(
            "A new Event Has Been Added That Might Be Of Your Interest! \nClick To Regist"
            "er As Soon As Possible!", req.event, "USER")
    req.status = "APPROVED"
    req.save()
    return get_requests()