Add password component (#519)
This commit is contained in:
parent
c203ad57a4
commit
8c8b2396fc
@ -12,6 +12,7 @@ from pynecone.compiler import utils as compiler_utils
|
||||
from pynecone.components.component import Component, ComponentStyle
|
||||
from pynecone.event import Event, EventHandler
|
||||
from pynecone.middleware import HydrateMiddleware, Middleware
|
||||
from pynecone.model import Model
|
||||
from pynecone.route import DECORATED_ROUTES
|
||||
from pynecone.state import DefaultState, Delta, State, StateManager, StateUpdate
|
||||
|
||||
@ -316,6 +317,10 @@ class App(Base):
|
||||
print("Skipping compilation in non-dev mode.")
|
||||
return
|
||||
|
||||
# Update models during hot reload.
|
||||
if config.db_url is not None:
|
||||
Model.create_all()
|
||||
|
||||
# Empty the .web pages directory
|
||||
compiler.purge_web_pages_dir()
|
||||
|
||||
|
@ -14,6 +14,7 @@ from .numberinput import (
|
||||
NumberInputField,
|
||||
NumberInputStepper,
|
||||
)
|
||||
from .password import Password
|
||||
from .pininput import PinInput, PinInputField
|
||||
from .radio import Radio, RadioGroup
|
||||
from .rangeslider import (
|
||||
|
11
pynecone/components/forms/password.py
Normal file
11
pynecone/components/forms/password.py
Normal file
@ -0,0 +1,11 @@
|
||||
"""A password input component."""
|
||||
|
||||
from pynecone.components.forms.input import Input
|
||||
from pynecone.var import Var
|
||||
|
||||
|
||||
class Password(Input):
|
||||
"""A password input component."""
|
||||
|
||||
# The type of input.
|
||||
type_: Var[str] = "password" # type: ignore
|
@ -49,7 +49,6 @@ if TYPE_CHECKING:
|
||||
from pynecone.components.component import ImportDict
|
||||
from pynecone.config import Config
|
||||
from pynecone.event import Event, EventHandler, EventSpec
|
||||
from pynecone.model import Model
|
||||
from pynecone.var import Var
|
||||
|
||||
# Shorthand for join.
|
||||
@ -720,6 +719,9 @@ def setup_backend():
|
||||
|
||||
Specifically ensures backend database is updated when running --no-frontend.
|
||||
"""
|
||||
# Import here to avoid circular imports.
|
||||
from pynecone.model import Model
|
||||
|
||||
config = get_config()
|
||||
if config.db_url is not None:
|
||||
Model.create_all()
|
||||
|
Loading…
Reference in New Issue
Block a user