Skip to main content

快速构建 RESTful API

Project description

Dseagull

快速构建 RESTful API


INSTALLED_APPS

添加 dseagull 到 INSTALLED_APPS 中, 注意必须要放在 rest_framework 前面

INSTALLED_APPS = [
    ...
    'dseagull',
    'rest_framework',
]

serializers.Field

支持 required=True 时提示带上字段的 help_text 信息

from rest_framework.serializers import Serializer
class ExampleSerializer(Serializer):
    name = field(help_text='姓名')
ExampleSerializer(data={}).is_valid()

原本提示:这个字段是必填项。

现提示:姓名:这个字段是必填项。


支持 required=True, null=False 时提示带上字段的 help_text 信息

from rest_framework.serializers import Serializer
class ExampleSerializer(Serializer):
    name = field(help_text='姓名')
ExampleSerializer(data={'name': None}).is_valid()

原本提示:This field may not be null. 现提示:姓名:不能为空。


支持 required=True, null=False 时提示带上字段的 help_text 信息

from rest_framework.serializers import Serializer
class ExampleSerializer(Serializer):
    name = field(help_text='姓名')
ExampleSerializer(data={'name': ''}).is_valid()

原本提示:This field may not be blank. 现提示:姓名:不能为空白。


Jwt

简化对称加密型的 JWT 编码和解码的过程, 需要配置 JWT_KEY 和 JWT_EXP,

from dseagull.djwt import JWTHS256
token = jwt_obj.encode({'username': 'admin'})
payload = jwt_obj.decode(token)

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

dseagull-0.0.5.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dseagull-0.0.5-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file dseagull-0.0.5.tar.gz.

File metadata

  • Download URL: dseagull-0.0.5.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for dseagull-0.0.5.tar.gz
Algorithm Hash digest
SHA256 7b5520e304b791b7a7ad2bf17e1d8dec30f28a7605e6095ca9caacdf02a04632
MD5 263d02dc71ecce340265fb47841411f9
BLAKE2b-256 071540c1b2af4b4a450361a7ab4e15057763cbd414bb26b72ab89f5dd2ac4668

See more details on using hashes here.

File details

Details for the file dseagull-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: dseagull-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for dseagull-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5d8ca921305166200bbeb7c62c4915b46935dab0efa9d7f46f87313d1861a671
MD5 b27892b7d7cc47486f6318eac4d91648
BLAKE2b-256 da8e72192bb045d85093272d4ee08f23e7d1e43b7a0c97f8812b85d28d481b21

See more details on using hashes here.

Supported by

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