Example #1
0
def user_activities(request, page):
  # get all the user's projects
  activities = Activity.getActivitiesForUser(request.user)

  paginator = Paginator(activities, 10)
  page_obj = paginator.page(page)

  return render_to_response("activities/activity_list.html", {
    "activities": page_obj.object_list,
    "activities_page":page_obj,
  }, context_instance=RequestContext(request))
Example #2
0
def user_activities(request, page):
    # get all the user's projects
    activities = Activity.getActivitiesForUser(request.user)

    paginator = Paginator(activities, 10)
    page_obj = paginator.page(page)

    return render_to_response("activities/activity_list.html", {
        "activities": page_obj.object_list,
        "activities_page": page_obj,
    },
                              context_instance=RequestContext(request))
Example #3
0
def home(request):
    my_projects = []
    member_projects = []
    organizations = []
    activities = []
    next_page = False

    if request.user.is_authenticated():
        organizations = Organization.getOrganizationsForUser(request.user)
        activities = Activity.getActivitiesForUser(request.user)

        assigned_stories = Story.getAssignedStories(request.user)

        paginator = Paginator(activities, 10)
        page_obj = paginator.page(1)
        activities = page_obj.object_list
        next_page = page_obj.has_next()

        memberships = ProjectMember.objects.filter(user=request.user)
        for membership in memberships:
            try:

                if (membership.project.creator_id == request.user.id):
                    my_projects.append(membership.project)
                else:
                    member_projects.append(membership.project)
            except:
                pass

        num_projects = len(member_projects) + len(
            filter(lambda p: p.organization == None, my_projects))
        blank_state = True if (num_projects +
                               len(organizations)) == 0 else False
        return render_to_response(
            "homepage.html",
            {
                "my_projects": my_projects,
                "my_organizations": organizations,
                "activities": activities,
                "activities_next_page": next_page,
                "assigned_stories": assigned_stories,
                "return_type": "queue",  # for the queue mini stories
                "member_projects": member_projects,
                "num_projects": num_projects,
                "now": datetime.datetime.now(),
                "blank_state": blank_state
            },
            context_instance=RequestContext(request))
    else:
        return render_to_response("unauthenticated_homepage.html",
                                  context_instance=RequestContext(request))
Example #4
0
def home(request):
    my_projects = []
    member_projects = []
    organizations = []
    activities = []
    next_page = False

    if request.user.is_authenticated():
        organizations = Organization.getOrganizationsForUser(request.user)
        activities = Activity.getActivitiesForUser(request.user)

        assigned_stories = Story.getAssignedStories(request.user)

        paginator = Paginator(activities, 10)
        page_obj = paginator.page(1)
        activities = page_obj.object_list
        next_page = page_obj.has_next()

        memberships = ProjectMember.objects.filter(user=request.user)
        for membership in memberships:
            try:

                if membership.project.creator_id == request.user.id:
                    my_projects.append(membership.project)
                else:
                    member_projects.append(membership.project)
            except:
                pass

        num_projects = len(member_projects) + len(filter(lambda p: p.organization == None, my_projects))
        blank_state = True if (num_projects + len(organizations)) == 0 else False
        return render_to_response(
            "homepage.html",
            {
                "my_projects": my_projects,
                "my_organizations": organizations,
                "activities": activities,
                "activities_next_page": next_page,
                "assigned_stories": assigned_stories,
                "return_type": "queue",  # for the queue mini stories
                "member_projects": member_projects,
                "num_projects": num_projects,
                "now": datetime.datetime.now(),
                "blank_state": blank_state,
            },
            context_instance=RequestContext(request),
        )
    else:
        return render_to_response("unauthenticated_homepage.html", context_instance=RequestContext(request))
Example #5
0
def user_activities(request, page):
    # get all the user's projects
    activities = Activity.getActivitiesForUser(request.user)

    paginator = Paginator(activities, 40)
    try:
        page_obj = paginator.page(page)
    except EmptyPage:
        # someone asked for a page that has no entries
        raise Http404

    return render_to_response("activities/activity_list.html", {
      "activities": page_obj.object_list,
      "activities_page":page_obj,
      }, context_instance=RequestContext(request))
Example #6
0
def user_activities(request, page):
    # get all the user's projects
    activities = Activity.getActivitiesForUser(request.user)

    paginator = Paginator(activities, 10)
    try:
        page_obj = paginator.page(page)
    except EmptyPage:
        # someone asked for a page that has no entries
        raise Http404

    return render_to_response("activities/activity_list.html", {
        "activities": page_obj.object_list,
        "activities_page": page_obj,
    },
                              context_instance=RequestContext(request))
Example #7
0
 def read(self, request, num=20):
    """ returns a given user's newsfeed stories (optional param specifying how many """
    return Activity.getActivitiesForUser(request.user)[:int(num)]
Example #8
0
 def obj_get_list(self, request=None, **kwargs):
   """ overriding """
   return Activity.getActivitiesForUser(request.user)
Example #9
0
 def obj_get_list(self, request=None, **kwargs):
     """ overriding """
     return Activity.getActivitiesForUser(request.user)
Example #10
0
 def read(self, request, num=20):
     """ returns a given user's newsfeed stories (optional param specifying how many """
     return Activity.getActivitiesForUser(request.user)[:int(num)]