Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 26 of 26 for UserCreate (0.16 sec)

  1. docs_src/sql_databases/sql_app/main.py

    
    # Dependency
    def get_db():
        db = SessionLocal()
        try:
            yield db
        finally:
            db.close()
    
    
    @app.post("/users/", response_model=schemas.User)
    def create_user(user: schemas.UserCreate, db: Session = Depends(get_db)):
        db_user = crud.get_user_by_email(db, email=user.email)
        if db_user:
            raise HTTPException(status_code=400, detail="Email already registered")
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sun May 17 10:14:14 UTC 2020
    - 1.6K bytes
    - Viewed (0)
  2. docs_src/sql_databases/sql_app_py39/alt_main.py

        return response
    
    
    # Dependency
    def get_db(request: Request):
        return request.state.db
    
    
    @app.post("/users/", response_model=schemas.User)
    def create_user(user: schemas.UserCreate, db: Session = Depends(get_db)):
        db_user = crud.get_user_by_email(db, email=user.email)
        if db_user:
            raise HTTPException(status_code=400, detail="Email already registered")
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 1.9K bytes
    - Viewed (0)
  3. docs_src/sql_databases_peewee/sql_app/main.py

            yield
        finally:
            if not database.db.is_closed():
                database.db.close()
    
    
    @app.post("/users/", response_model=schemas.User, dependencies=[Depends(get_db)])
    def create_user(user: schemas.UserCreate):
        db_user = crud.get_user_by_email(email=user.email)
        if db_user:
            raise HTTPException(status_code=400, detail="Email already registered")
        return crud.create_user(user=user)
    
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 2.2K bytes
    - Viewed (0)
  4. docs/em/docs/tutorial/sql-databases.md

        👉 🔜 ℹ 👥 ❎ 😨 ⏪ ⚙️ 👯‍♂️.
    
    ### ✍ ▶️ Pydantic *🏷* / 🔗
    
    ✍ `ItemBase` & `UserBase` Pydantic *🏷* (⚖️ ➡️ 💬 "🔗") ✔️ ⚠ 🔢 ⏪ 🏗 ⚖️ 👂 📊.
    
    & ✍ `ItemCreate` & `UserCreate` 👈 😖 ⚪️➡️ 👫 (👫 🔜 ✔️ 🎏 🔢), ➕ 🙆 🌖 📊 (🔢) 💪 🏗.
    
    , 👩‍💻 🔜 ✔️ `password` 🕐❔ 🏗 ⚫️.
    
    ✋️ 💂‍♂, `password` 🏆 🚫 🎏 Pydantic *🏷*, 🖼, ⚫️ 🏆 🚫 📨 ⚪️➡️ 🛠️ 🕐❔ 👂 👩‍💻.
    
    === "🐍 3️⃣.6️⃣ & 🔛"
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Apr 18 19:53:19 UTC 2024
    - 25.2K bytes
    - Viewed (0)
  5. docs/en/docs/tutorial/sql-databases.md

    ### Create initial Pydantic *models* / schemas
    
    Create an `ItemBase` and `UserBase` Pydantic *models* (or let's say "schemas") to have common attributes while creating or reading data.
    
    And create an `ItemCreate` and `UserCreate` that inherit from them (so they will have the same attributes), plus any additional data (attributes) needed for creation.
    
    So, the user will also have a `password` when creating it.
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Apr 18 19:53:19 UTC 2024
    - 29.6K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/sql-databases.md

        这些 Pydantic 模型或多或少地定义了一个“schema”(一个有效的数据形状)。
    
        因此,这将帮助我们在使用两者时避免混淆。
    
    ### 创建初始 Pydantic*模型*/模式
    
    创建一个`ItemBase`和`UserBase`Pydantic*模型*(或者我们说“schema”),他们拥有创建或读取数据时具有的共同属性。
    
    然后创建一个继承自他们的`ItemCreate`和`UserCreate`,并添加创建时所需的其他数据(或属性)。
    
    因此在创建时也应当有一个`password`属性。
    
    但是为了安全起见,`password`不会出现在其他同类 Pydantic*模型*中,例如通过API读取一个用户数据时,它不应当包含在内。
    
    === "Python 3.10+"
    
        ```Python hl_lines="1  4-6  9-10  21-22  25-26"
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue May 07 21:00:22 UTC 2024
    - 27.3K bytes
    - Viewed (0)
Back to top