Skip to content

Commit

Permalink
Merge pull request #324 from maykinmedia/develop
Browse files Browse the repository at this point in the history
Release 1.0.5
  • Loading branch information
alextreme authored Nov 1, 2022
2 parents dd30803 + dfd5412 commit 76f3d8c
Show file tree
Hide file tree
Showing 14 changed files with 134 additions and 18 deletions.
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Open Inwoner
==================

:Version: 1.0.1

:Version: 1.0.5
:Source: https://github.com/maykinmedia/open-inwoner
:Keywords: inwoner
:PythonVersion: 3.9
Expand Down
4 changes: 3 additions & 1 deletion src/open_inwoner/accounts/tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ def test_password_change_is_logged(self):
form["new_password1"] = "newPassw0rd"
form["new_password2"] = "newPassw0rd"
form.submit()
log_entry = TimelineLog.objects.last()
log_entry = TimelineLog.objects.filter(
extra_data__message=str(_("password was changed"))
).last()

self.assertEqual(
log_entry.timestamp.strftime("%m/%d/%Y, %H:%M:%S"), "10/18/2021, 13:00:00"
Expand Down
6 changes: 4 additions & 2 deletions src/open_inwoner/accounts/tests/test_password_reset_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ def test_user_cant_access_the_password_reset_view_more_than_5_times(self):
url = reverse("admin_password_reset")
cache.clear()

for i in range(5):
response = self.client.get(url)
self.assertEqual(response.status_code, 200)

for i in range(10):
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
response = self.client.get(url)
self.assertEqual(response.status_code, 403)
2 changes: 1 addition & 1 deletion src/open_inwoner/conf/fixtures/django-admin-index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"model": "admin_index.appgroup", "fields": {"order": 0, "name": "Gebruikersprofielen", "slug": "accounts", "models": [["accounts", "action"], ["accounts", "appointment"], ["accounts", "contact"], ["accounts", "document"], ["accounts", "invite"], ["accounts", "message"], ["accounts", "user"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 2, "name": "PDC", "slug": "pdc", "models": [["pdc", "category"], ["pdc", "organization"], ["pdc", "organizationtype"], ["pdc", "product"], ["pdc", "productcondition"], ["pdc", "productcontact"], ["pdc", "productlocation"], ["pdc", "tag"], ["pdc", "tagtype"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 5, "name": "Permissies, 2FA en logging", "slug": "permissies-2fa-en-logging", "models": [["auth", "group"], ["axes", "accessattempt"], ["axes", "accesslog"], ["cspreports", "cspreport"], ["otp_totp", "totpdevice"], ["timeline_logger", "timelinelog"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 7, "name": "Overige / Diverse", "slug": "overige-diverse", "models": [["account", "emailconfirmation"], ["admin_index", "appgroup"], ["admin_index", "applink"], ["admin_index", "contenttypeproxy"], ["easy_thumbnails", "source"], ["easy_thumbnails", "thumbnail"], ["easy_thumbnails", "thumbnaildimensions"], ["filer", "folder"], ["filer", "folderpermission"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 6, "name": "Configuratie", "slug": "configuratie", "models": [["configurations", "siteconfiguration"], ["configurations", "siteconfigurationpage"], ["flatpages", "flatpage"], ["haalcentraal", "haalcentraalconfig"], ["mail_editor", "mailtemplate"], ["openzaak", "openzaakconfig"], ["sites", "site"], ["zgw_consumers", "nlxconfig"], ["zgw_consumers", "service"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 3, "name": "Vragen en antwoorden", "slug": "vraag-antwoord", "models": [["pdc", "question"], ["questionnaire", "questionnairestep"], ["questionnaire", "questionnairestepfile"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 4, "name": "Zoeken", "slug": "zoeken", "models": [["search", "feedback"], ["search", "fieldboost"], ["search", "synonym"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 1, "name": "Plannen", "slug": "plannen", "models": [["plans", "actiontemplate"], ["plans", "plan"], ["plans", "plantemplate"]]}}, {"model": "admin_index.applink", "fields": {"order": 0, "app_group": ["overige-diverse"], "name": "Link naar Documentatie", "link": "https://taiga.maykinmedia.nl/project/open-inwoner/wiki/home"}}, {"model": "admin_index.applink", "fields": {"order": 1, "app_group": ["overige-diverse"], "name": "Link naar Github", "link": "https://github.com/maykinmedia/open-inwoner"}}, {"model": "admin_index.applink", "fields": {"order": 2, "app_group": ["overige-diverse"], "name": "Link naar Maykin", "link": "https://www.maykinmedia.nl/nl/"}}]
[{"model": "admin_index.appgroup", "fields": {"order": 0, "name": "Gebruikersprofielen", "slug": "accounts", "models": [["accounts", "action"], ["accounts", "appointment"], ["accounts", "contact"], ["accounts", "document"], ["accounts", "invite"], ["accounts", "message"], ["accounts", "user"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 2, "name": "PDC", "slug": "pdc", "models": [["pdc", "category"], ["pdc", "organization"], ["pdc", "organizationtype"], ["pdc", "product"], ["pdc", "productcondition"], ["pdc", "productcontact"], ["pdc", "productlocation"], ["pdc", "tag"], ["pdc", "tagtype"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 5, "name": "Permissies, 2FA en logging", "slug": "permissies-2fa-en-logging", "models": [["auth", "group"], ["axes", "accessattempt"], ["axes", "accesslog"], ["cspreports", "cspreport"], ["otp_totp", "totpdevice"], ["timeline_logger", "timelinelog"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 7, "name": "Overige / Diverse", "slug": "overige-diverse", "models": [["admin_index", "appgroup"], ["admin_index", "applink"], ["admin_index", "contenttypeproxy"], ["easy_thumbnails", "source"], ["easy_thumbnails", "thumbnail"], ["easy_thumbnails", "thumbnaildimensions"], ["filer", "folder"], ["filer", "folderpermission"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 6, "name": "Configuratie", "slug": "configuratie", "models": [["configurations", "siteconfiguration"], ["configurations", "siteconfigurationpage"], ["flatpages", "flatpage"], ["haalcentraal", "haalcentraalconfig"], ["mail_editor", "mailtemplate"], ["openzaak", "openzaakconfig"], ["sites", "site"], ["zgw_consumers", "nlxconfig"], ["zgw_consumers", "service"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 3, "name": "Vragen en antwoorden", "slug": "vraag-antwoord", "models": [["pdc", "question"], ["questionnaire", "questionnairestep"], ["questionnaire", "questionnairestepfile"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 4, "name": "Zoeken", "slug": "zoeken", "models": [["search", "feedback"], ["search", "fieldboost"], ["search", "synonym"]]}}, {"model": "admin_index.appgroup", "fields": {"order": 1, "name": "Plannen", "slug": "plannen", "models": [["plans", "actiontemplate"], ["plans", "plan"], ["plans", "plantemplate"]]}}, {"model": "admin_index.applink", "fields": {"order": 0, "app_group": ["overige-diverse"], "name": "Link naar Documentatie", "link": "https://taiga.maykinmedia.nl/project/open-inwoner/wiki/home"}}, {"model": "admin_index.applink", "fields": {"order": 1, "app_group": ["overige-diverse"], "name": "Link naar Github", "link": "https://github.com/maykinmedia/open-inwoner"}}, {"model": "admin_index.applink", "fields": {"order": 2, "app_group": ["overige-diverse"], "name": "Link naar Maykin", "link": "https://www.maykinmedia.nl/nl/"}}]
12 changes: 11 additions & 1 deletion src/open_inwoner/pdc/managers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
from django.db import models

from treebeard.mp_tree import MP_NodeQuerySet


class PublishedQueryset(MP_NodeQuerySet):
class PublishedQueryset(models.QuerySet):
def published(self):
return self.filter(published=True)

def draft(self):
return self.filter(published=False)


class CategoryPublishedQueryset(MP_NodeQuerySet):
def published(self):
return self.filter(published=True)

Expand Down
4 changes: 2 additions & 2 deletions src/open_inwoner/pdc/models/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from treebeard.exceptions import InvalidMoveToDescendant
from treebeard.mp_tree import MP_MoveHandler, MP_Node

from ..managers import PublishedQueryset
from ..managers import CategoryPublishedQueryset


class PublishedMoveHandler(MP_MoveHandler):
Expand Down Expand Up @@ -62,7 +62,7 @@ class Category(MP_Node):
)

node_order_by = ["slug"]
objects = PublishedQueryset.as_manager()
objects = CategoryPublishedQueryset.as_manager()

class Meta:
verbose_name = _("Category")
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/pdc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get_context_data(self, **kwargs):
kwargs.update(product_locations=ProductLocation.objects.all()[:1000])
kwargs.update(
questionnaire_roots=QuestionnaireStep.get_root_nodes().filter(
highlighted=True
highlighted=True, published=True
)
)
if self.request.user.is_authenticated:
Expand Down
16 changes: 13 additions & 3 deletions src/open_inwoner/questionnaire/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def clean(self):
class QuestionnaireStepAdmin(TreeAdmin):
form = QuestionnaireStepAdminForm
inlines = (QuestionnaireStepFileInline,)
list_display = ("display_question_answer", "highlighted")
list_display = ("display_question_answer", "highlighted", "published")
prepopulated_fields = {"slug": ("question",)}
save_as = True
list_editable = ("highlighted",)
Expand Down Expand Up @@ -83,6 +83,8 @@ class QuestionnaireStepAdmin(TreeAdmin):
"description",
"category",
"highlighted",
"published",
"redirect_to",
),
},
),
Expand All @@ -97,11 +99,19 @@ class QuestionnaireStepAdmin(TreeAdmin):
},
),
)
raw_id_fields = ("redirect_to",)

def display_question_answer(self, obj):
redirect = ""
if obj.redirect_to:
redirect = " - doorsturen -> {} - {}".format(
obj.redirect_to.question, obj.redirect_to.id
)

postfix = " <small>({} - {}{})</small>".format(obj.id, obj.code, redirect)
if not obj.parent_answer:
return obj.question
return "{} -> {}</p>".format(obj.parent_answer, obj.question)
return obj.question + postfix
return "{} -> {}".format(obj.parent_answer, obj.question) + postfix

display_question_answer.allow_tags = True

Expand Down
Loading

0 comments on commit 76f3d8c

Please sign in to comment.