Hi all,
I have a new error - the Admin screen is rejecting what appear to be valid strings. It began around the time I updated my packages but it was only from a previous 4.1 to 4.1.10. When I load the shell and use Things._meta.get_field(“labels”).choices, I can see the list of tuples I expect:
[(‘label1’, ‘label1’),
(‘label2’, ‘label2’)]
I could submit pages, but the backend would respond with “please correct this entry, is not a valid choice”
The “choices” list was being generated by a function that would create it at import time, just ahead of the model that used the choices. This made some sense for the job it was doing though I don’t see it recommended (and it had the bad quality of confusing the migrations part of the ORM into applying the choice limits as a new migration every time a migration occurred.)
The error is gone after I changed to the more normal hard-coded list. But I don’t really understand what started going wrong in the function-based version and I would like to. Also I had trouble getting to the bottom of this - is there a quick clean way to get more visibility of the content of admin pages? It would be easier if it had just thrown a stacktrace, but the admin was sure it was correctly rejecting invalid entries and I couldn’t think of a good way to interrogate.