Exemple #1
0
def savedsearches_data(request):
    context = {}
    qs = SavedSearch.objects.filter(
        user=request.user
    ).order_by('-created')
    searches = []
    for savedsearch in qs:
        item = {
            'id': savedsearch.id,
            'name': savedsearch.name,
            'summary': savedsearch.summary,
            'modified': savedsearch.modified.isoformat(),
        }
        searches.append(item)

    # We need a general Feed URL that is tailored to this user
    from airmozilla.main.context_processors import base
    feed = base(request)['get_feed_data']()

    context['savedsearches'] = searches
    context['urls'] = {
        'search:savedsearch': reverse('search:savedsearch', args=(0,)),
        'search:home': reverse('search:home'),
        'feed': feed['url'],

    }
    return context
Exemple #2
0
def savedsearches_data(request):
    context = {}
    qs = SavedSearch.objects.filter(user=request.user).order_by('-created')
    searches = []
    for savedsearch in qs:
        item = {
            'id': savedsearch.id,
            'name': savedsearch.name,
            'summary': savedsearch.summary,
            'modified': savedsearch.modified.isoformat(),
        }
        searches.append(item)

    # We need a general Feed URL that is tailored to this user
    from airmozilla.main.context_processors import base
    feed = base(request)['get_feed_data']()

    if request.user.is_active:
        profile = get_profile_safely(request.user)
        if profile and profile.contributor:
            calendar_privacy = 'contributors'
        else:
            calendar_privacy = 'company'
    else:
        calendar_privacy = 'public'

    context['savedsearches'] = searches
    context['urls'] = {
        'search:savedsearch': reverse('search:savedsearch', args=(0, )),
        'search:home': reverse('search:home'),
        'feed': feed['url'],
        'ical': reverse('main:calendar_ical', args=(calendar_privacy, )),
    }
    return context
Exemple #3
0
def savedsearches_data(request):
    context = {}
    qs = SavedSearch.objects.filter(
        user=request.user
    ).order_by('-created')
    searches = []
    for savedsearch in qs:
        item = {
            'id': savedsearch.id,
            'name': savedsearch.name,
            'summary': savedsearch.summary,
            'modified': savedsearch.modified.isoformat(),
        }
        searches.append(item)

    # We need a general Feed URL that is tailored to this user
    from airmozilla.main.context_processors import base
    feed = base(request)['get_feed_data']()

    if request.user.is_active:
        profile = get_profile_safely(request.user)
        if profile and profile.contributor:
            calendar_privacy = 'contributors'
        else:
            calendar_privacy = 'company'
    else:
        calendar_privacy = 'public'

    context['savedsearches'] = searches
    context['urls'] = {
        'search:savedsearch': reverse('search:savedsearch', args=(0,)),
        'search:home': reverse('search:home'),
        'feed': feed['url'],
        'ical': reverse('main:calendar_ical', args=(calendar_privacy,)),

    }
    return context