Browse Source

feat(forms): add Podcast.publish_date to the admin fields

pull/12/head
Jérôme Lebleu 6 months ago
parent
commit
61f45741fa
  1. 6
      tests/test_views.py
  2. 6
      wagtail_webradio/forms.py

6
tests/test_views.py

@ -1,7 +1,9 @@ @@ -1,7 +1,9 @@
import datetime
from html import escape
from django.contrib.auth.models import Group, Permission
from django.urls import reverse
from django.utils.timezone import make_naive
import pytest
@ -222,6 +224,7 @@ class TestPodcastAdminViews(PodcastAdminViewsMixin, AdminViewTestMixin): @@ -222,6 +224,7 @@ class TestPodcastAdminViews(PodcastAdminViewsMixin, AdminViewTestMixin):
.widget.format_value("<p>Description of this podcast.</p>")
)
form['sound_url'] = 'https://example.org/podcast1.ogg'
form['publish_date'] = '2022-01-01 12:00:00'
response = form.submit(status=302)
assert response['location'] == self.get_index_url(radio_show)
assert escape("'Interview with a person' added") in response.follow()
@ -230,6 +233,9 @@ class TestPodcastAdminViews(PodcastAdminViewsMixin, AdminViewTestMixin): @@ -230,6 +233,9 @@ class TestPodcastAdminViews(PodcastAdminViewsMixin, AdminViewTestMixin):
assert podcast.radio_show == radio_show
assert podcast.sound_url == 'https://example.org/podcast1.ogg'
assert podcast.slug == 'interview-with-a-person'
assert make_naive(podcast.publish_date) == datetime.datetime(
2022, 1, 1, 12, 0
)
def test_edit(self):
podcast = PodcastFactory()

6
wagtail_webradio/forms.py

@ -272,5 +272,11 @@ podcast_edit_handler = ObjectList( @@ -272,5 +272,11 @@ podcast_edit_handler = ObjectList(
],
heading=_("Media"),
),
MultiFieldPanel(
[
FieldPanel('publish_date', heading=_("Date")),
],
heading=_("Publishing"),
),
],
)

Loading…
Cancel
Save
Map all the world