Ejemplo n.º 1
0
def sidebar_widget(request):
    if SpecialQuestGame.disabled():
        return ''
    user = request.user.get_profile().get_extension(SpecialQuestUser)
    count = len(user.active_tasks)

    if not count:
        return ''

    return render_to_string('specialquest/sidebar.html', {'not_done': count})
Ejemplo n.º 2
0
def sidebar_widget(context):
    user = context.get('user', None)
    if SpecialQuestGame.disabled() or not user or not user.is_authenticated():
        return ''
    user = user.get_profile().get_extension(SpecialQuestUser)
    count = len(user.active_tasks)

    if not count:
        return ''

    return render_to_string('specialquest/sidebar.html', {'not_done': count, 'id': 'specialquest'})
Ejemplo n.º 3
0
def sidebar_widget(context):
    user = context.get('user', None)
    if SpecialQuestGame.disabled() or not user or not user.is_authenticated():
        return ''
    user = user.get_profile().get_extension(SpecialQuestUser)
    count = len(user.active_tasks)

    if not count:
        return ''

    return render_to_string('specialquest/sidebar.html', {'not_done': count})
Ejemplo n.º 4
0
def header_link(request):
    profile = request.user.get_profile()
    if SpecialQuestGame.disabled():
        return None
    if profile:
        user = profile.get_extension(SpecialQuestUser)
        count = len(user.active_tasks)
    else:
        count = 0
    url = reverse('wouso.games.specialquest.views.index')

    return dict(link=url, count=count, text=_('Special'))
Ejemplo n.º 5
0
def sidebar_widget(request):
    if SpecialQuestGame.disabled():
        return ''
    user = request.user.get_profile().get_extension(SpecialQuestUser)
    tasks = SpecialQuestTask.objects.all()
    today = date.today()
    tasks = [t for t in tasks if t not in user.done_tasks.all() and t.start_date <= today <= t.end_date]

    if not tasks:
        return ''

    return render_to_string('specialquest/sidebar.html', {'not_done': len(tasks)})
Ejemplo n.º 6
0
def sidebar_widget(request):
    if SpecialQuestGame.disabled():
        return ""
    user = request.user.get_profile().get_extension(SpecialQuestUser)
    tasks = SpecialQuestTask.objects.all()
    today = date.today()
    tasks = [t for t in tasks if t not in user.done_tasks.all() and t.start_date <= today <= t.end_date]

    if not tasks:
        return ""

    return render_to_string("specialquest/sidebar.html", {"not_done": len(tasks)})
Ejemplo n.º 7
0
def header_link(context):
    user = context.get('user', None)
    if not user or not user.is_authenticated() or SpecialQuestGame.disabled():
        return {}
    profile = user.get_profile()
    if profile:
        user = profile.get_extension(SpecialQuestUser)
        count = len(user.active_tasks)
    else:
        count = 0
    url = reverse('wouso.games.specialquest.views.index')

    return dict(link=url, count=count, text=_('Special'))
Ejemplo n.º 8
0
def header_link(context):
    user = context.get('user', None)
    if not user or not user.is_authenticated() or SpecialQuestGame.disabled():
        return {}
    profile = user.get_profile()
    if profile:
        user = profile.get_extension(SpecialQuestUser)
        count = len(user.active_tasks)
    else:
        count = 0
    url = reverse('wouso.games.specialquest.views.index')

    return dict(link=url, count=count, text=_('Special'))
Ejemplo n.º 9
0
def header_link(request):
    profile = request.user.get_profile()
    if SpecialQuestGame.disabled():
        return None
    if profile:
        user = profile.get_extension(SpecialQuestUser)
        tasks = SpecialQuestTask.objects.all()
        today = date.today()
        tasks = [t for t in tasks if t not in user.done_tasks.all() and t.start_date <= today <= t.end_date]

        count = len(tasks)
    else:
        count = 0
    url = reverse('wouso.games.specialquest.views.index')
    
    return dict(link=url, count=count, text=_('Special'))
Ejemplo n.º 10
0
def header_link(request):
    profile = request.user.get_profile()
    if SpecialQuestGame.disabled():
        return None
    if profile:
        user = profile.get_extension(SpecialQuestUser)
        tasks = SpecialQuestTask.objects.all()
        today = date.today()
        tasks = [t for t in tasks if t not in user.done_tasks.all() and t.start_date <= today <= t.end_date]

        count = len(tasks)
    else:
        count = 0
    url = reverse("wouso.games.specialquest.views.index")

    return dict(link=url, count=count, text=_("Special"))