Skip to main content

后台账户数据模型

Project description

xy_django_app_account

说明

后台账户数据模型.

源码仓库

安装

# bash
pip install xy_django_app_account

使用

1. 直接引入
  • 1. 设置全局配置

在Django项目中的settings.py文件中加入如下配置 例如: settings.py

# settings.py

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "xy_django_app_account",
    "Demo",
    "Resource",
    "Media",
]

AUTH_USER_MODEL = "xy_django_app_account.AdminUser"
# 启动工程后访问 http://127.0.0.1:8401/admin 验证账户系统
  • 2. 运行项目
xy_web_server -w django start
# 启动工程后访问 http://127.0.0.1:8401/admin 验证账户管理系统
2. 自定义
  • 1. 创建Account模块

操作 样例工程

# bash
xy_web_server -w django startapp Account
# Account 模块创建在 source/Runner/Admin/Account 
  • 2. 设置全局配置

在Django项目中的settings.py文件中加入如下配置 例如: settings.py

# settings.py

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "Demo",
    "Resource",
    "Media",
    "Account",
]

AUTH_USER_MODEL = "Account.AdminUser"
# 启动工程后访问 http://127.0.0.1:8401/admin 验证账户系统
# models.py
from django.utils.translation import gettext_lazy as _

# Create your models here.
from xy_django_app_account.abstracts import (
    AdminUserManager as xyAdminUserManager,
    MAAdminUser as xyAdminUser,
)


class MAdminUserManager(xyAdminUserManager):
    pass


class MAdminUser(xyAdminUser):
    objects = MAdminUserManager()

    class Meta:
        verbose_name = _("用户")
        verbose_name_plural = _("用户")
        app_label = "Account"
# admin.py
from django.contrib import admin

# Register your models here.
from .models import MAdminUser
from xy_django_app_account.aabstracts import *


class AUserCreationForm(AAUserCreationForm):

    class Meta:
        model = MAdminUser
        fields = ("username",)


class AUserChangeForm(AAUserChangeForm):

    class Meta:
        model = MAdminUser
        fields = (
            "password",
            "email",
            "username",
            "is_active",
            "is_admin",
            "sex",
            "thumb",
            "age",
            "userid",
        )


@admin.register(MAdminUser)
class AAdminUserAdmin(AAAdminUserAdmin):
    # The forms to add and change user instances
    form = AAUserChangeForm
    add_form = AAUserCreationForm
  • 5. 运行项目
xy_web_server -w django start
# 启动工程后访问 http://127.0.0.1:8401/admin 验证账户管理系统
运行 样例工程

样例工程具体使用方式请移步 xy_web_server.git 下列仓库

许可证

xy_django_app_account 根据 <木兰宽松许可证, 第2版> 获得许可。有关详细信息,请参阅 LICENSE 文件。

捐赠

如果小伙伴们觉得这些工具还不错的话,能否请咱喝一杯咖啡呢?

Pay-Total

联系方式

微信: yuyangiit
邮箱: yuyangit.0515@qq.com

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

xy_django_app_account-1.0.4.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

xy_django_app_account-1.0.4-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file xy_django_app_account-1.0.4.tar.gz.

File metadata

  • Download URL: xy_django_app_account-1.0.4.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for xy_django_app_account-1.0.4.tar.gz
Algorithm Hash digest
SHA256 b1f5651272ea80344a687b72adf028f42cdc3a19dcb12230b5e830ff6194cc30
MD5 b6a65e4f07426eb6b077ca81317ab336
BLAKE2b-256 b67ff9fbe6a5489b6ee0a4b88e4da5500999998dfe89d1ca71f1d812f8c016cf

See more details on using hashes here.

File details

Details for the file xy_django_app_account-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for xy_django_app_account-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8cf0f6c25516d6071edb27f23cc0b2b41914e11889a9de3769f02c54ed244dbf
MD5 bd0f5273302c7aa16a1e3fc7b1695762
BLAKE2b-256 500b75a8344752577c757b780f7de91cb8c9f40a54ff3d5720274306ce4a9d13

See more details on using hashes here.

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