How to use GridCal - 8 common examples

To help you get started, we’ve selected a few GridCal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikical / grical / gridcal / functions.py View on Github external
def is_user_in_group(user_id, group_id):
    if len(Membership.objects.filter(user__id__exact=user_id, group__id__exact=group_id)) == 1:
        return True
    else:
        return False
github wikical / grical / gridcal / functions.py View on Github external
def is_event_viewable_by_user(event_id, user_id):
    event = Event.objects.get(id=event_id)
    if event.public_view:
        return True
    elif event.user == None:
        return True
    elif event.user.id == user_id:
        return True
    else:
        # iterating over all groups that the event belongs to
        for g in Group.objects.filter(events__id__exact=event_id):
            if is_user_in_group(user_id, g.id):
                return True
        return False
github wikical / grical / gridcal / functions.py View on Github external
eu = EventUrl.objects.filter(event=event.id)
    if len(eu) < 0:
        t = t + 'url: ' + '\n'
    else:
        for e in eu.all():
             t = t + 'url: ' + e.url_name + '|' + e.url + '\n'

    et = EventTimechunk.objects.filter(event=event.id)
    if len(et) < 0:
        t = t + 'time: ' + '\n'
    else:
        for e in et.all():
            t = t + 'time: ' + e.timechunk_name + '|' + str(e.timechunk_date) + '|' + str(e.timechunk_starttime) + '|' + str(e.timechunk_endtime) +'\n'

    ed = EventDeadline.objects.filter(event=event.id)
    if len(ed) < 0:
        t = t + 'dl: ' + '\n'
    else:
        for e in ed.all():
            t = t + 'dl: ' + e.deadline_name + '|' + str(e.deadline) + '\n'

    t = t + 'desc: ' + unicode(event.description) + '\n'
    return t
github wikical / grical / gridcal / functions.py View on Github external
t = t + 'city: ' + unicode(event.city) + '\n'
    t = t + 'addr: ' + unicode(event.address) + '\n'
    t = t + 'code: ' + unicode(event.postcode) + '\n'
    t = t + 'land: ' + str_country + '\n'
    t = t + 'tizo: ' + str_timezone + '\n'
    t = t + 'lati: ' + str_latitude + '\n'
    t = t + 'long: ' + str_longitude + '\n'

    eu = EventUrl.objects.filter(event=event.id)
    if len(eu) < 0:
        t = t + 'url: ' + '\n'
    else:
        for e in eu.all():
             t = t + 'url: ' + e.url_name + '|' + e.url + '\n'

    et = EventTimechunk.objects.filter(event=event.id)
    if len(et) < 0:
        t = t + 'time: ' + '\n'
    else:
        for e in et.all():
            t = t + 'time: ' + e.timechunk_name + '|' + str(e.timechunk_date) + '|' + str(e.timechunk_starttime) + '|' + str(e.timechunk_endtime) +'\n'

    ed = EventDeadline.objects.filter(event=event.id)
    if len(ed) < 0:
        t = t + 'dl: ' + '\n'
    else:
        for e in ed.all():
            t = t + 'dl: ' + e.deadline_name + '|' + str(e.deadline) + '\n'

    t = t + 'desc: ' + unicode(event.description) + '\n'
    return t
github wikical / grical / gridcal / functions.py View on Github external
t = t + 'acro: ' + unicode(event.acro) + '\n'
    t = t + 'titl: ' + unicode(event.title) + '\n'
    t = t + 'date: ' + event.start.strftime("%Y-%m-%d") + '\n'
    t = t + 'endd: ' + ee + '\n'
    t = t + 'tags: ' + unicode(event.tags) + '\n'
    t = t + 'view: ' + str(event.public_view) + '\n'
    t = t + 'edit: ' + str(event.public_edit) + '\n'
    t = t + 'city: ' + unicode(event.city) + '\n'
    t = t + 'addr: ' + unicode(event.address) + '\n'
    t = t + 'code: ' + unicode(event.postcode) + '\n'
    t = t + 'land: ' + str_country + '\n'
    t = t + 'tizo: ' + str_timezone + '\n'
    t = t + 'lati: ' + str_latitude + '\n'
    t = t + 'long: ' + str_longitude + '\n'

    eu = EventUrl.objects.filter(event=event.id)
    if len(eu) < 0:
        t = t + 'url: ' + '\n'
    else:
        for e in eu.all():
             t = t + 'url: ' + e.url_name + '|' + e.url + '\n'

    et = EventTimechunk.objects.filter(event=event.id)
    if len(et) < 0:
        t = t + 'time: ' + '\n'
    else:
        for e in et.all():
            t = t + 'time: ' + e.timechunk_name + '|' + str(e.timechunk_date) + '|' + str(e.timechunk_starttime) + '|' + str(e.timechunk_endtime) +'\n'

    ed = EventDeadline.objects.filter(event=event.id)
    if len(ed) < 0:
        t = t + 'dl: ' + '\n'
github wikical / grical / gridcal / functions.py View on Github external
def is_event_viewable_by_user(event_id, user_id):
    event = Event.objects.get(id=event_id)
    if event.public_view:
        return True
    elif event.user == None:
        return True
    elif event.user.id == user_id:
        return True
    else:
        # iterating over all groups that the event belongs to
        for g in Group.objects.filter(events__id__exact=event_id):
            if is_user_in_group(user_id, g.id):
                return True
        return False
github wikical / grical / gridcal / functions.py View on Github external
def getEventForm(user):
    """returns a simplied event form with or without the public field"""
    if user.is_authenticated():
        return SimplifiedEventForm()
    return SimplifiedEventFormAnonymous()
github wikical / grical / gridcal / functions.py View on Github external
def getEventForm(user):
    """returns a simplied event form with or without the public field"""
    if user.is_authenticated():
        return SimplifiedEventForm()
    return SimplifiedEventFormAnonymous()