diff --git a/README.md b/README.md index 9e26183..a8aba4e 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ The application will run in a Kubernetes cluster, so we need a container image f Creating the container image might take several minutes, so this is a good point to take a break. When you return, you should see the following output: > ``` -> Packed dashboard_0.24_amd64.rock +> Packed dashboard_0.25_amd64.rock > ``` ### Create a charm @@ -109,10 +109,10 @@ Creating the charm might take several minutes, so this is another good point to ``` { name=deploy-dashboard } cd ~/dashboard rockcraft.skopeo --insecure-policy copy --dest-tls-verify=false \ - oci-archive:dashboard_0.24_amd64.rock \ - docker://localhost:32000/dashboard:0.24 + oci-archive:dashboard_0.25_amd64.rock \ + docker://localhost:32000/dashboard:0.25 juju deploy ./charm/dashboard_ubuntu-22.04-amd64.charm \ - --resource django-app-image=localhost:32000/dashboard:0.24 + --resource django-app-image=localhost:32000/dashboard:0.25 ``` The `rockcraft.skopeo` command makes the container image available to Juju. diff --git a/dashboard/dashboard/settings.py b/dashboard/dashboard/settings.py index d61b14a..8a5ba7e 100644 --- a/dashboard/dashboard/settings.py +++ b/dashboard/dashboard/settings.py @@ -131,3 +131,6 @@ # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" + +LOGIN_REDIRECT_URL = "projects:project_list" +LOGOUT_REDIRECT_URL = "projects:project_list" diff --git a/dashboard/dashboard/templates/registration/login.html b/dashboard/dashboard/templates/registration/login.html new file mode 100644 index 0000000..9597548 --- /dev/null +++ b/dashboard/dashboard/templates/registration/login.html @@ -0,0 +1,23 @@ +{% extends "base.html" %} + +{% block content %} + +

Log in

+
+ {% csrf_token %} + + + + {% for field in form %} + + {% endfor %} + +
{{ field.label_tag }}{{ field }}
+ +

+ +

+ +
+ +{% endblock %} diff --git a/dashboard/dashboard/urls.py b/dashboard/dashboard/urls.py index ba26b91..ba60a4f 100644 --- a/dashboard/dashboard/urls.py +++ b/dashboard/dashboard/urls.py @@ -4,6 +4,7 @@ urlpatterns = [ path("admin/doc/", include("django.contrib.admindocs.urls")), path("admin/", admin.site.urls), + path("accounts/", include("django.contrib.auth.urls")), path("__reload__/", include("django_browser_reload.urls")), path("", include("projects.urls")), ] diff --git a/dashboard/initial_data.yaml b/dashboard/initial_data.yaml index 07295de..1726ebe 100644 --- a/dashboard/initial_data.yaml +++ b/dashboard/initial_data.yaml @@ -478,7 +478,7 @@ pk: 1 fields: name: Nuclear - url: '' + url: https://nuclear.org group: 1 owner: A. Scientist driver: A. Technician @@ -489,7 +489,7 @@ pk: 2 fields: name: Chemistry - url: https://nuclear.nut + url: https://chemistry.org group: 1 owner: A. Chemist driver: null diff --git a/dashboard/projects/admin.py b/dashboard/projects/admin.py index d95c3d8..c8c3b28 100644 --- a/dashboard/projects/admin.py +++ b/dashboard/projects/admin.py @@ -50,21 +50,6 @@ def has_delete_permission(self, request, obj): return False -class ProjectObjectiveInline(admin.TabularInline): - model = ProjectObjective - max_num = 0 - can_delete = False - fields = ("name", "unstarted_reason") - readonly_fields = ["name"] - exclude = ["objective", "description", "status"] - - def has_add_permission(self, request, obj): - return False - - def has_delete_permission(self, request, obj): - return False - - @admin.register(ProjectObjective) class ProjectObjectiveAdmin(admin.ModelAdmin): readonly_fields = ["project", "objective", "status"] @@ -95,9 +80,7 @@ def change_view(self, request, object_id, form_url="", extra_context=None): @admin.register(Project) class ProjectAdmin(admin.ModelAdmin): - inlines = [ - ProjectObjectiveInline, - ] + list_display = [ "name", "owner", diff --git a/dashboard/projects/templates/projects/partial_project_basics.html b/dashboard/projects/templates/projects/partial_project_basics.html index bfe1c1b..b8aa035 100644 --- a/dashboard/projects/templates/projects/partial_project_basics.html +++ b/dashboard/projects/templates/projects/partial_project_basics.html @@ -1,9 +1,4 @@
- - {% if not user.is_authenticated %} -
Log in to edit
- {% endif %} -
{{ project }} +
-
-
-
-
-
+ -
{% include "projects/partial_project_basics.html" %}
+

{{ project }}

-
+
+
+
+
-
{% include "projects/partial_project_commitments.html" %}
+
{% include "projects/partial_project_basics.html" %}
-
+
- {% include "projects/partial_projectobjectives.html" %} +
{% include "projects/partial_project_commitments.html" %}
+
+ + {% include "projects/partial_projectobjectives.html" %} + +
-
-
+ +
-
+ {% endblock content %} diff --git a/dashboard/tests.py b/dashboard/tests.py index 69e3fbe..3d72b07 100644 --- a/dashboard/tests.py +++ b/dashboard/tests.py @@ -58,7 +58,7 @@ def test_toggling_conditions(live_server, page): # after toggling, the new conditions should be saved in the database page.get_by_test_id("toggle_condition_94").uncheck() page.get_by_test_id("toggle_condition_102").check() - time.sleep(0.5) # Temporary workaround. Find a better solution. + time.sleep(5) # Temporary workaround. Find a better solution. assert ProjectObjectiveCondition.objects.get(id=94).done == False assert ProjectObjectiveCondition.objects.get(id=102).done == True @@ -70,7 +70,7 @@ def test_toggling_conditions(live_server, page): page.get_by_test_id("toggle_commitment_705").check() page.get_by_test_id("toggle_commitment_474").uncheck() - time.sleep(0.5) # Temporary workaround. Find a better solution. + time.sleep(5) # Temporary workaround. Find a better solution. assert Commitment.objects.get(id=705).committed == True assert Commitment.objects.get(id=474).committed == False @@ -88,6 +88,7 @@ def test_toggling_conditions(live_server, page): # check the remaining box to get to Started page.get_by_test_id("toggle_condition_10").check() + time.sleep(5) # Temporary workaround. Find a better solution. assert ProjectObjectiveCondition.objects.get( id=10 ).projectobjective().status() == Level.objects.get(id=1) @@ -95,6 +96,7 @@ def test_toggling_conditions(live_server, page): # check one more to get to First results page.get_by_test_id("toggle_condition_14").check() + time.sleep(5) # Temporary workaround. Find a better solution. assert ProjectObjectiveCondition.objects.get( id=14 ).projectobjective().status() == Level.objects.get(id=1) diff --git a/dashboard_rock_patch/dashboard/settings.py b/dashboard_rock_patch/dashboard/settings.py index cf51e1a..de23c4c 100644 --- a/dashboard_rock_patch/dashboard/settings.py +++ b/dashboard_rock_patch/dashboard/settings.py @@ -151,3 +151,6 @@ # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" + +LOGIN_REDIRECT_URL = "projects:project_list" +LOGOUT_REDIRECT_URL = "projects:project_list" diff --git a/rockcraft.yaml b/rockcraft.yaml index 070933a..d346957 100644 --- a/rockcraft.yaml +++ b/rockcraft.yaml @@ -2,7 +2,7 @@ name: dashboard # see https://documentation.ubuntu.com/rockcraft/en/1.8.0/explanation/bases/ # for more information about bases and using 'bare' bases for chiselled rocks base: ubuntu@22.04 # the base environment for this Django application -version: "0.24" # just for humans. Semantic versioning is recommended +version: "0.25" # just for humans. Semantic versioning is recommended summary: A summary of your Django application # 79 char long summary description: | Dashboard is a Django application to track quality and progress of multiple