Skip to main content

Use ormar for your fastapi-users project.

Project description

fastapi-users-ormar-ext

Extension to use ormar in fastapi-users

Installation

To install use:

pip install fastapi-users-ormar-ext

Usage

Example:

from typing import Optional

import ormar

from fastapi_users_ormar_ext import (
    OrmarBaseUserTableUUID,
    OrmarBaseOAuthAccountTableUUID,
)

class BaseMeta(ormar.ModelMeta):
    """Base metadata for models."""

    database = database
    metadata = meta


class User(OrmarBaseUserTableUUID):
    class Meta(BaseMeta):
        pass

    phone: str = ormar.String(nullable=False, max_length=100)


class OAuthAccount(OrmarBaseOAuthAccountTableUUID):
    class Meta(BaseMeta):
        pass

    user: User = ormar.ForeignKey(User, nullable=False, ondelete="cascade")

TODO

[ ] Think of a way to force user field overriding in OrmarBaseOAuthAccountTableUUID [ ] Add tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi-users-ormar-ext-0.1.1.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

fastapi_users_ormar_ext-0.1.1-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page