Wagtail initDateChooser is defined for one app but not the other app?

6 views
Skip to first unread message

Meagen Voss

unread,
Jul 21, 2021, 7:54:15 AM7/21/21
to Wagtail support
Hello,

I'm creating a portfolio site and I've deployed my code to an Ubuntu server on DigitalOcean. I have two apps within my project: a blog app and a portfolio app. For the page models I created in the blog app, the DateField works fine and the little calendar picker shows up when the page is created.

For the portfolio app, however, the calendar picker doesn't activate. The error in the console reads:

Uncaught ReferenceError: initDateChooser is not defined <anonymous> http://MYIPADDRESS/admin/pages/14/edit/:759

I checked the Network tab to see if all the stylesheets were loading. I don't see any 400 or 500 errors. Just 200 and 304.

I've tried changing the field models to DateTimeField and the same problem occurs. Deleting and re-adding the models and re-migrating also does not fix the issue.

So I'm not sure what else to check at this point. Could something have gone wrong during collectstatic? Should I run that again to see if that makes a differences? Any tips folks can offer to help me track this bug down would be very much appreciated.

All the best,

Meagen

Meagen Voss

unread,
Jul 23, 2021, 4:09:53 PM7/23/21
to Wagtail support

UPDATE: I've figured out where the conflict is. When I comment out the media model in the following code and re-migrate everything, the initDateChooser functions again. But if I add the media model back in, then initDateChooser doesn't function right. Still not sure what I can do about it since definitely need the media model here.

class WritingPage(Page):
     date = models.DateField("Post date", null=True)
     media = models.ForeignKey(to=Media, on_delete=models.SET_NULL, null=True)
     hyperlink = models.CharField(max_length=1000, null=True)

content_panels = Page.content_panels + [
     FieldPanel('date'),
     FieldPanel('hyperlink'),
     FieldPanel('media'),
]

Hazho Human

unread,
Aug 1, 2021, 12:57:16 AM8/1/21
to wag...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Wagtail support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wagtail+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wagtail/de51960a-d024-45f4-af02-2e8f63b2f1b7n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages