diff --git a/config/settings/base.py b/config/settings/base.py index a26d4d3..811b9aa 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -132,7 +132,7 @@ ] AUTH_USER_MODEL = "users.User" -LOGIN_REDIRECT_URL = "wagtailadmin_home" +LOGIN_REDIRECT_URL = "wagtailadmin_login_redirect" LOGIN_URL = "wagtailadmin_login" # PASSWORDS diff --git a/config/urls.py b/config/urls.py index cd086a1..652c909 100644 --- a/config/urls.py +++ b/config/urls.py @@ -25,6 +25,7 @@ SignedURLView, media_index, ) +from mycarehub.users.views import CustomLoginView, login_redirect urlpatterns = [ path("sysadmin/", HomeView.as_view(), name="home"), @@ -124,6 +125,8 @@ path("admin/images/", CustomImageIndexView.as_view(), name="wagtailimages-index"), path("admin/media/", media_index, name="wagtailmedia-index"), path("admin/documents/", CustomDocumentIndexView.as_view(), name="wagtaildocs-index"), + path("admin/login/", CustomLoginView.as_view(), name="wagtailadmin_login"), + path("admin/redirect/", login_redirect, name="wagtailadmin_redirect"), path("admin/", include(wagtailadmin_urls)), path("documents/", include(wagtaildocs_urls)), re_path( diff --git a/mycarehub/conftest.py b/mycarehub/conftest.py index 293fda6..6311b2a 100644 --- a/mycarehub/conftest.py +++ b/mycarehub/conftest.py @@ -194,7 +194,7 @@ def content_item_with_tag_and_category(content_item_index, program, facility): def initial_sms_content_item(content_item_index, sms_category, sms_tag, request_with_user): """Initial SMS content item fixture.""" initial_sms_content_item = SMSContentItem( - content="This is some sample content for testing purposes", + body="This is some sample content for testing purposes", category=sms_category, tag=sms_tag, ) @@ -211,7 +211,7 @@ def initial_sms_content_item(content_item_index, sms_category, sms_tag, request_ def sms_content_item(content_item_index, sms_category, sms_tag, request_with_user): """Subsequent SMS content item fixture.""" sms_content_item = SMSContentItem( - content="Hello is some sample content for testing purposes", + body="Hello is some sample content for testing purposes", category=sms_category, tag=sms_tag, ) diff --git a/mycarehub/content/migrations/0018_rename_content_smscontentitem_body.py b/mycarehub/content/migrations/0018_rename_content_smscontentitem_body.py new file mode 100644 index 0000000..b0b15b2 --- /dev/null +++ b/mycarehub/content/migrations/0018_rename_content_smscontentitem_body.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.20 on 2023-10-25 07:39 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("content", "0017_alter_contentitem_facilities"), + ] + + operations = [ + migrations.RenameField( + model_name="smscontentitem", + old_name="content", + new_name="body", + ), + ] diff --git a/mycarehub/content/models/sms.py b/mycarehub/content/models/sms.py index 0d57827..81feafd 100644 --- a/mycarehub/content/models/sms.py +++ b/mycarehub/content/models/sms.py @@ -157,7 +157,7 @@ class SMSContentItem(Page): ) sequence_number = models.IntegerField(null=True, blank=True) sequence = models.CharField(max_length=10, null=True, blank=True) - content = models.TextField( + body = models.TextField( max_length=160, help_text="Write out the body of the content to be sent to subscribers" ) @@ -175,13 +175,13 @@ class SMSContentItem(Page): ], heading="About", ), - FieldPanel("content"), + FieldPanel("body"), ] # these fields determine the content that is indexed for search purposes search_fields = Page.search_fields + [ index.SearchField("category"), - index.SearchField("content"), + index.SearchField("body"), ] # this configuration allows these custom fields to be available over the API @@ -193,7 +193,7 @@ class SMSContentItem(Page): APIField("tag"), APIField("sequence"), APIField("sequence_number"), - APIField("content"), + APIField("body"), ] # limit the parent page types @@ -241,7 +241,7 @@ def save(self, *args, **kwargs): We replace the title to make it easier for users to keep track of their sms's. """ - new_title = Truncator(self.content).chars(30) + new_title = Truncator(self.body).chars(30) self.slug = slugify(new_title) self.title = new_title super().save(*args, **kwargs) diff --git a/mycarehub/content/tests/test_models.py b/mycarehub/content/tests/test_models.py index 2f1f952..c8a60a9 100644 --- a/mycarehub/content/tests/test_models.py +++ b/mycarehub/content/tests/test_models.py @@ -209,14 +209,14 @@ def test_bypass_generate_sequence_after_save(): sms_content_item = SMSContentItem( path="test", depth=3, - content="This is some sample content for testing purposes", + body="This is some sample content for testing purposes", category=category, tag=tag, ) sms_content_item.save() - sms_content_item.content = "This is a new title to test the save method" + sms_content_item.body = "This is a new title to test the save method" sms_content_item.save() assert sms_content_item.title == "This is a new title to test t…" diff --git a/mycarehub/content/tests/test_wagtail_hooks.py b/mycarehub/content/tests/test_wagtail_hooks.py index 72ad861..12c3c53 100644 --- a/mycarehub/content/tests/test_wagtail_hooks.py +++ b/mycarehub/content/tests/test_wagtail_hooks.py @@ -95,7 +95,7 @@ def test_set_sequence_number_after_page_create( sms_tag, ): sms_content_item = SMSContentItem( - content="Hello is some sample content for testing purposes", + body="Hello is some sample content for testing purposes", category=sms_category, tag=sms_tag, ) diff --git a/mycarehub/templates/wagtailadmin/pages/listing/_list.html b/mycarehub/templates/wagtailadmin/pages/listing/_list.html new file mode 100644 index 0000000..dc9f683 --- /dev/null +++ b/mycarehub/templates/wagtailadmin/pages/listing/_list.html @@ -0,0 +1,84 @@ +{% load i18n %} +{% load l10n %} +{% load wagtailadmin_tags %} +
+ {% if orderable and ordering == "ord" %}
+
+ {% trans 'Drag' %}
+ Item {{ forloop.counter }} of {{ pages|length }}
+
+ {% endif %}
+ |
+ {% elif show_bulk_actions %}
+ {% include "wagtailadmin/bulk_actions/listing_checkbox_cell.html" with obj_type="page" obj=page aria_labelledby_prefix="page_" aria_labelledby=page.pk|unlocalize aria_labelledby_suffix="_title" %}
+ {% endif %}
+ + {% block page_title %} + {% endblock %} + | ++ {% if page.category %} + {{ page.category }} + {% endif %} + + {% for category in page.categories.all %} + {{ category.name }} + {% if not forloop.last %}, {% endif %} + {% endfor %} + | + + {% if show_parent %} ++ {% block page_parent_page_title %} + {% with page.get_parent as parent %} + {% if parent %} + {{ parent.specific_deferred.get_admin_display_title }} + {% endif %} + {% endwith %} + {% endblock %} + | + {% endif %} ++ {% if page.latest_revision_created_at %} + {% human_readable_date page.latest_revision_created_at %} + {% endif %} + | +{{ page.page_type_display_name }} | ++ {% include "wagtailadmin/shared/page_status_tag.html" with page=page %} + | ++ {{ page.owner }} + | + {% block page_navigation %} + {% endblock %} +