Skip to main content

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

Release files for xy-django-app-account 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xy-django-app-account 1.0.4
File Size Uploaded
xy_django_app_account-1.0.4.tar.gz 16.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xy-django-app-account 1.0.4
File Interpreter ABI Platform
xy_django_app_account-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 34.1 kB

Release files / xy_django_app_account-1.0.4.tar.gz

Download URL xy_django_app_account-1.0.4.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b1f5651272ea80344a687b72adf028f42cdc3a19dcb12230b5e830ff6194cc30
BLAKE2b-256 checksum
How to use checksums
b67ff9fbe6a5489b6ee0a4b88e4da5500999998dfe89d1ca71f1d812f8c016cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Release files / xy_django_app_account-1.0.4-py3-none-any.whl

Download URL xy_django_app_account-1.0.4-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cf0f6c25516d6071edb27f23cc0b2b41914e11889a9de3769f02c54ed244dbf
BLAKE2b-256 checksum
How to use checksums
500b75a8344752577c757b780f7de91cb8c9f40a54ff3d5720274306ce4a9d13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page