diff --git a/bugsink/views.py b/bugsink/views.py index 3ee268c..7990864 100644 --- a/bugsink/views.py +++ b/bugsink/views.py @@ -4,19 +4,23 @@ from django.conf import settings from django.views.decorators.http import require_GET from django.views.decorators.cache import cache_control from django.http import FileResponse, HttpRequest, HttpResponse +from django.shortcuts import render from projects.models import Project from issues.views import issue_list def home(request): - # TODO if count() == 0 it's time to do onboarding :-) + if Project.objects.count() == 0: + raise NotImplementedError("Onboarding not implemented yet") - if Project.objects.count() == 1: + elif Project.objects.count() == 1: project = Project.objects.get() return redirect(issue_list, project_id=project.id) - raise NotImplementedError() # some kind of Project-list + return render(request, "bugsink/home_project_list.html", { + # user_projecs is in the context_processor, we don't need to pass it here + }) def trigger_error(request): diff --git a/templates/bugsink/home_project_list.html b/templates/bugsink/home_project_list.html new file mode 100644 index 0000000..5aa77d7 --- /dev/null +++ b/templates/bugsink/home_project_list.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} + +{% block title %}Projects ยท {{ site_title }}{% endblock %} + +{% block content %} + + +
+

Projects

+ +{% for project in user_projects %} +
{{ project.name }}
+{% endfor %} + +
+ +{% endblock %}