I have an app that I built a Layout for using the tutorial. I then create a new form and use the layout as the template. that works fine.
When i activate the users service and add
anvil.users.login_with_form()
to the layouts __init__ method, underneath the self.init_components(**properties) line then it doesnt allow me to view the design tab of any forms that use the layout as a template, i just get this:
if not anvil.users.get_user():
print(“okay so far”)
try:
anvil.users.login_with_form()
print(“phew”)
except:
print(“gone wonky”)
Give the app a run an see what happens.
Try it first in the Layout and see what happens on a page running the Layout. Then use the code on the page using the Layout but not the layout itself.
on the form rather than the layout template it works fine… weird indeed. But, by having it in the form it doesnt trigger the login function.
will continue to play around!
is interfering with the IDE’s Designer. If it’s trying to run Layout code at Design time, as happens with many Custom Components, then you can prevent that. See “as-yet-undocumented but useful feature” in: