Hide FieldWidgets from Personal Preferences

I've been trying to hide the editor and timezone fields from the /@@personal-preferences View, but somehow am unable to do so. I managed to access the widgets in question, as I can manipulate their labels, but for some reason they do not have the attribute "visible", so I'm unsure how to prevent them from rendering.

Here's my approach:

class CustomPersonalPreferencesPanel(PersonalPreferencesPanel):

    def updateWidgets(self):
        super(PersonalPreferencesPanel, self).updateWidgets()
        self.widgets['wysiwyg_editor'].label = "hello"
        self.widgets['wysiwyg_editor'].visible = { "view" : "invisible", "edit" : "invisible" }
        self.widgets['timezone'].visible = { "view" : "invisible", "edit" : "invisible" }

The "label" changes to "hello", however both fields are still visible. I've tried several other approaches in the meantime, some of which even included me adding the widgets in question to the hidden_widgets list in AccountPanelForm, but nothing seems to work.

Have you tried using mode?


Thanks a lot! Yeah, mode seems to be doing the trick.

Though, on second thought, there's something that irks me a little. If possible, we'd like to avoid the fields from being rendered at all. Hiding them this way seems almost synonymous to doing it via CSS, as they're still right there in the HTML.

Do you have any ideas as to how to accomplish that?

From a security viewpoint it would be best practice to not render the widget at all and also not letting the backend accept any changes in the correspondent fields. Is there maybe the possibililty to solve this with permissions?

On further inspection, it turns out that while it does indeed render some HTML, it seems to merely render useless HTML Wrappers, while the actual form items do not get rendered. So, I believe with that being the case it's safe to say the issue is resolved.

As far as I know, permissions does not work on /@@personal preferences. It does not work the same way as 'other content'