Exemple #1
0
def event(request, url_path):
    resp = force_url_paths(event, url_path)
    if resp: return resp

    try:
        qs = InheritanceQuerySet(model=Event)
        the_event = qs.select_subclasses().get(url_path=url_path)
    except:
        raise Http404

    if the_event.__class__ is Commit:
        return HttpResponseRedirect(
            reverse(commits.show,
                    args=(
                        the_event.project.url_path,
                        the_event.url_path,
                    )))
    else:
        if the_event.project is not None:
            return HttpResponseRedirect(
                reverse(blogs.show_post,
                        args=(
                            the_event.project.url_path,
                            the_event.url_path,
                        )))
        else:
            return HttpResponseRedirect(
                reverse(blogs.show_user_post,
                        args=(
                            the_event.author.id,
                            the_event.url_path,
                        )))
    raise Http404
Exemple #2
0
def feed(request):
    qs = InheritanceQuerySet(model=Event)
    objs = qs.select_subclasses().order_by("date").reverse()[:INDEX_EVENT_COUNT]

    avoid_duplicate_queries(
        objs, "author", "project", author={request.user.id: request.user} if request.user.is_authenticated() else {}
    )

    return render_to_response(
        "feed/feed.html", {"events": objs, "disable_content": True}, context_instance=RequestContext(request)
    )
Exemple #3
0
def main(request):
  qs = InheritanceQuerySet(model = Event)
  objs = qs.select_subclasses().order_by('date').reverse()[:INDEX_EVENT_COUNT]
  projs = Project.objects.exclude(active = False).exclude(score = None).order_by('score')
  projs = projs[0:4] if projs else None

  avoid_duplicate_queries(objs, "author", "project",
                          author = { request.user.id: request.user }
                                   if request.user.is_authenticated() else {})

  return render_to_response('feed/feed.html', {
      'form': ShareForm(),
      'events': objs,
      'projects': projs,
      'disable_content': True
    }, context_instance = RequestContext(request))
Exemple #4
0
def feed(request):
    qs = InheritanceQuerySet(model=Event)
    objs = qs.select_subclasses().order_by(
        'date').reverse()[:INDEX_EVENT_COUNT]

    avoid_duplicate_queries(objs,
                            "author",
                            "project",
                            author={request.user.id: request.user}
                            if request.user.is_authenticated() else {})

    return render_to_response('feed/feed.html', {
        'events': objs,
        'disable_content': True
    },
                              context_instance=RequestContext(request))
Exemple #5
0
def event(request, url_path):
    resp = force_url_paths(event, url_path)
    if resp:
        return resp

    try:
        qs = InheritanceQuerySet(model=Event)
        the_event = qs.select_subclasses().get(url_path=url_path)
    except:
        raise Http404

    if the_event.__class__ is Commit:
        return HttpResponseRedirect(reverse(commits.show, args=(the_event.project.url_path, the_event.url_path)))
    else:
        if the_event.project == None:
            return HttpResponseRedirect(reverse(blogs.show_post, args=(the_event.project.url_path, the_event.url_path)))
        else:
            return HttpResponseRedirect(reverse(blogs.show_user_post, args=(the_event.user.id, the_event.url_path)))
    raise Http404