question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RuntimeError: Unable to resolve relationship `user` for `wagtailcore.ModelLogEntry`. Django is most likely not initialized, and its apps registry not populated. Ensure Django has finished setup before loading `FilterSet`s

See original GitHub issue

Hi!

I’ve updated to the LTS 4.1 but this error came out:

RuntimeError: Unable to resolve relationship `user` for `wagtailcore.ModelLogEntry`. Django is most likely not initialized, and its apps registry not populated. Ensure Django has finished setup before loading `FilterSet`s.

I have the following versions:

Wagtail 4.1 Django 4.0.8 django-filter 22.1]

My temporal “fix”

I was able to solve this by removing the user on the meta class of SnippetHistoryReportFilterSet :

    class Meta:
        model = ModelLogEntry
        fields = ["action", "**_user_**", "timestamp"]

This is located at wagtail/snippets/views/snippets.py

Is that a logger or something like that? If so, is there a way to disable it in order to use the page?

Thanks!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
gasmancommented, Nov 3, 2022

Reopening this, as we do want to find a proper fix for this that allows previously-working code to continue working on 4.1.

2reactions
gasmancommented, Nov 3, 2022

@ababic That sounds like a good plan, yep! We’re being a bit quirky with how we mix model and view code here, and while I think django-filter might be technically in the wrong for how early in the execution it’s doing model lookups, making it less quirky wouldn’t be a bad thing. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix issue with snippets and custom user model related to ...
ModelLogEntry `. Django is most likely not initialized, and its apps registry not populated. Ensure Django has finished setup before loading `FilterSet`s.
Read more >
Django stops working with RuntimeError: populate() isn't ...
This is caused by a bug in your Django settings somewhere. Unfortunately, Django's hiding the bug behind this generic and un-useful error message....
Read more >
21875 (Runtime Error with Django-Tastypie: "App registry isn't ...
Goes away when I remove django-tastypie as installed app. Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line( ...
Read more >
populate isn't reentrant - Google Groups
Ideally Django would in the case of seeing an exception while loading applications not leave the registry in an inconsistent state and cleanup...
Read more >
Relationships in Django models - Web Forefront
How to declare Django model relationships one to many, many to many and one to one; what are a Django models relationship options....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found