django 用户模型类 User继承 AbstractUser 新建User Model时出现fields.E304错误

Django之使用自定义用户表(AbstractUser)/自定义登录验证(jwt)/获取当前登录用户 1、自定义的用户表继承AbstractUser;2、settings.py添加配置,指向用户表:AUTH_USER_MODEL = ‘myUser.Account’(子项目名称.用户表models名称);# 签发: jwt_payload_handler = api_settings . JWT_PAYLOAD_HANDLER # 生成token: jwt_encode_handler = api_settings . JWT_ENCODE_HANDLER。 阅读详情

上错误:

(django_py3) huangdonglin@huangdonglin-virtual-machine:~/django_show/dailyfresh$ python manage.py makemigrations
SystemCheckError: System check identified some issues:

ERRORS:
auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'User.groups'.
	HINT: Add or change a related_name argument to the definition for 'User.groups' or 'User.groups'.
auth.User.user_permissions: (fields.E304) Reverse accessor for 'User.user_permissions' clashes with reverse accessor for 'User.user_permissions'.
	HINT: Add or change a related_name argument to the definition for 'User.user_permissions' or 'User.user_permissions'.
user.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'User.groups'.
	HINT: Add or change a related_name argument to the definition for 'User.groups' or 'User.groups'.
user.User.user_permissions: (fields.E304) Reverse accessor for 'User.user_permissions' clashes with reverse accessor for 'User.user_permissions'.
	HINT: Add or change a related_name argument to the definition for 'User.user_permissions' or 'User.user_permissions'.

在这里插入图片描述

  • 这里是因为要使用 django默认的认证系统(AbstractUser)在生成迁移文件之前,要先在settings文件里面做一个配置
# user代表应用  , User代表应用下的模型类
AUTH_USER_MODEL='user.User'

配置这里之后,就能接触,错误中的,冲突问题,迁移文件时,不会默认生成“ auth_user” 这张表而是生成 我们指定的这个模型类对应的表(看一下我的)。就不会冲突报错了。

在这里插入图片描述

  • desc
    在这里插入图片描述
解决django 新增加用户信息出现错误的问题 今天小编就为大家分享一篇解决django 新增加用户信息出现错误的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧 立即下载

相关推荐

Django User 模块之 AbstractUser 扩展详解

主要介绍了Django User 模块之 AbstractUser 扩展详解,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧

django --fields.E304 错误解决方案

在定义model的时候,如果有主外键或者多对多关系定义的时候,会遇到类似如下报错信息: (fields.E304) Reverse accessor for'SplaceCheckTask.other_firer_id' clashes with reverse accessor for 'SplaceCheckT ask.main_firer_id'. fields.E

meylovezn的专栏 1万+

AS5600磁编码器选型与安装避坑指南:磁铁形状、间隙距离到底怎么选?(附实测数据)

本文详细解析了AS5600磁编码器的选型与安装要点,包括磁铁形状、间隙距离等关键参数的选择,并附有实测数据支持。特别针对Arduino和I2C接口的应用场景,提供了硬件选型和机械安装的实用指南,帮助开发者避免常见陷阱,提升系统精度和稳定性。

weixin_27038245的博客 287

django继承AbstractUser新建User Model时出现(fields.E304)ERROR的具体解决办法

数据库迁移时报错: ERRORS: auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'User.groups'. HINT: Add or change a related_name argument to the definition for 'User.groups' or 'User.groups'. auth.User.user_permiss

CofDoria的博客 557

用OpenIPC复活你的旧摄像头:手把手教你给君正T31芯片设备刷开源固件

本文详细介绍了如何使用OpenIPC项目为君正T31芯片的旧摄像头刷入开源固件,解锁更多功能并延长设备寿命。从硬件识别、风险控制到详细刷机步骤和后期配置,手把手教你将闲置摄像头改造为智能监控设备,实现隐私可控、功能扩展等优势。

weixin_30790841的博客 765

Ubuntu20.04运行Vins-fusion

因已安装ROS noetic,eigen,opencv及ceres等库,这部分环境配置就不细讲,直接下载VINS-FUSION的代码库 下载编译 cd ~/vins-fusion/src git clone https://github.com/HKUST-Aerial-Robotics/VINS-Fusion.git cd ../ catkin_make source ~/catkin_ws/devel/setup.bash 编译时会发现一堆错误,别急,无非就是环境冲突问题,一个个解决 1)首先,ROS

xiaojinger_123的博客 1万+

Django模型(字段关系)

字段之间的关系Django定义了一组表示字段关系的字段0.外键ForeignKey1.多对一class ForeignKey(to, on_delete, **options) 源代码:class ForeignKey(ForeignObject): """ Provide a many-to-one relation by adding a column to t...

weixin_34413802的博客 2323

ParaView :在paraview创建渲染视图

ParaView :在paraview创建渲染视图

希望我的博客,能帮上你解决学习中工作中所遇到的问题 1301

django框架-自定义用户模型类报错

要使用自定义的模型类的话,需要在自己项目的配置文件(不修改的话是settings.py)中配置AUTH_USER_MODEL指向自定义的模型类。也就是说,迁移前不修改默认配置信息,系统默认使用的是默认的模型类而不是自定义的模型类。Django用户模型类是通过全局配置项 AUTH_USER_MODEL 决定的。自定义了模型类,但Django默认用户模型类是User,需要自己指定路径。在项目配置文件中指定自定义的用户模型类。再次运行项目:运行成功!

weixin_52260564的博客 1205

【笔记篇】Davinci Configurator BswM模块

AUTOSAR BSWM模块配置介绍

weixin_47571898的博客 1534

第01章 Hermes Agent 是什么

如果读者所在的开发团队已经引入了 Cursor、Claude Code 这类 AI IDE,可能会有一个困惑:写代码已经有 AI 帮忙了,还需要 Hermes Agent 做什么?这一章将给出答案。Hermes Agent 不是另一个写代码的 AI,而是一个常驻在团队里的"AI 协作成员",专门负责写代码之外的协作环节——讨论需求、审查代码、查日志、监控告警、生成报告。学完本章,读者将清楚 Hermes 的定位以及它在团队里的角色。

亢少军的博客 73

【Django】auth.User.groups: (fields.E304) Reverse accessor for User.groups clashes with reverse

【Django】auth.User.groups: (fields.E304) Reverse accessor for User.groups clashes with reverse 。1:这是由于新建的User类与Django自带的User类发生冲突。2:继承Django的User类又想扩展一些字段会产生此错误。

自律遇到更好的自己!! 419

第14.5章 高翔博士最新开源框架Lightning-LM源码解读(五):揭秘位姿图优化核心模块,从数学原理到代码实现

本文介绍了Lightning-LM框架中的位姿图优化(PGO)模块实现。该模块通过融合多源定位信息(激光定位、激光里程计、DR等),构建并优化位姿图来获得更精确的位姿估计。 主要内容包括: 模块概况与数据流程:初始化配置→添加PGO帧→分配位姿→优化求解→更新位姿→滑动窗口 16个核心函数详解:从构造函数到边缘化处理,涵盖完整的PGO工作流程 关键技术点:噪声参数设置、优化问题构建、约束添加、异常值处理等 关键数据结构:帧队列管理、顶点和边构建、优化统计信息收集 该PGO模块采用增量式优化方式,支持多种约束

行知SLAM 1215

Django继承AbstractUser新建User Model时出现fields.E304错误

(venv) D:\zz\PycharmProjects\output>python manage.py makemigrations SystemCheckError: System check identified some issues: ERRORS: auth.User.groups: (fields.E304) Reverse accessor for 'User.group...

zb0567的专栏 407

uniapp - 最新实现APP连接使用MQTT流程及源码教程,uniapp app端接入mqtt发布订阅和接收消息队列传送消息、断开重连等各种示例代码(完美兼容安卓Android与苹果ios手机)

uniapp app端接入mqtt示例代码教程,uni-app中使用mqtt,uniapp安卓app接入mqtt,uniApp苹果ios集成MQTT教程,uniapp vue3 mqtt app端的接入流程,uniapp开发安卓和ios如何在项目里集成mqtt,Mqtt协议,uniapp开发APP,主动连接mqtt,订阅消息,实现发布,订阅和接收消息,如何在uniapp项目中使用mqtt,uniapp mqtt的使用示例,mqtt连接报错,搭建MQTT通讯做聊天项目,uniapp与设备通信 通过mqtt实现

🏆 前端领域优质创作者 6570

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

【转】Django继承AbstractUser新建User Model时出现auth.User.groups: (fields.E304)错误

错误详情如下: (venv) D:\workspace\music>python manage.py makemigrations SystemCheckError: System check identified some issues: ERRORS: auth.User.groups: (fields.E304) Reverse accessor for 'User.g...

weixin_30338461的博客 303

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

django中继承AbstractUser新建User模型时产生fields.E304错误

一、报错具体情况 SystemCheckError: System check identified some issues: ERRORS: auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'Users.groups'. HI...

qq_43593912的博客 581

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

auth.User.groups: (fields.E304) Django继承AbstractUser新建User Model时出现fields.E304错误

解决方案:需要在setting中重载AUTH_USER_MODEL

Christian的博客 446

python 用户认证模型类数据迁移报错

python 用户认证模型类数据迁移报错如下: auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'User.groups'. HINT: Add or change a related_name argument to the definition for 'User.groups' or 'User.groups'. auth.User...

weixin_41061575的博客 1640

解决报错HINT: Add or change a related_name argument to the definition for ‘users.User.user_permissions‘

看到这样的提示时,通常意味着在你的项目中存在两个模型(或多个)都有相同名称的反向关系(reverse relation),这导致 Django 在内部处理这些关系时产生冲突。在你的情况下,冲突发生在。将AUTH_USER_MODEL = "auth.User"复制到dev.py(settings.py)配置文件中,并将auth改为users。,你需要在你的 settings.py 文件中设置。模型并且继承了 Django 的。上,这通常是因为你自定义了。),但同时又保留了默认的。

我的个人博客 1471

【Django】创建用户,继承AbstractUser自定义用户模型类

1.AbstractUser 如果要创建一个用户,需要设置各种字段、组、权限、cookie管理、密码处理等,比较麻烦,所以Django已经为我们创建了一个抽象用户,我们只需要继承它,然后添加自己的字段即可 用户基本属性和常用方法 属性或方法 说明 username 用户名(必要) password 密码(必要) email 邮件 first_name 名字 last_name 姓氏 is_staff 是否管理员 create() 创建一个普通用户 create_u

冰冷的希望的博客 3807

Django报错:(fields.E304) Reverse accessor for 'User.groups' clashes with reverse access

在pycharm中运行Django:执行命令:python manage.py makemigrations时,报错 解决办法: 在settings.py文件中加入 AUTH_USER_MODEL = 'user.User' 就可以了。具体是原因,也没太搞清楚。 ...

sinat_35347729的博客 2141
上一篇: redis_启动服务端和客户端:
下一篇: choices选项与富文本编辑器与 verbose_name选项:django开发之天天生鲜项目知识总结【1】
我是py呀
博客等级 码龄8年 205粉丝 130原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值