| 60 | |
| 61 | @phone_home |
| 62 | def home(request): |
| 63 | accepted_projects = request.user.project_set.filter(projectmembership__accepted=True).distinct() |
| 64 | if accepted_projects.count() == 1: |
| 65 | # if the user has exactly one project, we redirect them to that project |
| 66 | project = accepted_projects.get() |
| 67 | return redirect("issue_list_open", project_pk=project.id) |
| 68 | |
| 69 | if request.user.project_set.all().distinct().count() > 0: |
| 70 | # note: no filter on projectmembership__accepted=True here; if there is _any_ project, we show the project list |
| 71 | return redirect("project_list") |
| 72 | |
| 73 | if get_bugsink_settings().SINGLE_TEAM: |
| 74 | # in single-team mode, there's is no (meaningful) team list. We redirect to the (empty) project list instead |
| 75 | return redirect("project_list") |
| 76 | |
| 77 | # final fallback: show the team list. |
| 78 | # (the assumption is: if there are no projects, the team-list is the most useful page to show, because if there are |
| 79 | # no teams, this is where you can create one, and if there are teams, this is where you can select one) |
| 80 | return redirect("team_list") |
| 81 | |
| 82 | |
| 83 | @login_exempt |