model 相关问题

作为MVC模式的一部分,Model管理应用程序的行为和数据。

EagerLoadingError [SequelizeEagerLoadingError]:攻击与角色无关

我试图将 8 个模型与 1 个模型关联起来,但每次我尝试使用“include”查询主模型时,我都会收到相同的消息 EagerLoadingError [SequelizeEagerLoadingError]:攻击我...

回答 1 投票 0

我可以在 Django 管理面板中禁用默认排序吗?

我正在尝试使用“liczba_glosow”字段在 Django 管理面板中进行排序。问题是模型本身在 Meta 方法中按“numer_na_liscie”排序,而管理员使用默认值或...

回答 1 投票 0

使用枚举名称而不是值对 Pydantic 字段进行编码

我有一个枚举类: 类组(枚举.Enum): 用户 = 0 经理 = 1 管理员=2 我有一个 pydantic 模型: 用户类(基础模型): id:整数 用户名:str 组: 组 它生成了

回答 5 投票 0

Flask 动态模型

我想知道是否可以为模型添加变量? 表 = 'Cms' 查询=表.查询 属性错误:“str”对象没有属性“query”

回答 1 投票 0

如何在laravel上使用orderby内部关系?

我知道这是一个有趣的问题,但我无法使用关系来解决它。 这是我的模型: 公共函数类别():属于 { return $this->belongsTo('App\Models\Master\Product\Category');...

回答 1 投票 0

TF1 from TF2 如何得到模型的概率?

您好,我生成了以下模型,并且已使用 Tf 迁移脚本成功将 TF 1 示例转换为 TF 2。 这是模型: tf.compat.v1.reset_default_graph X = tf.compa...

回答 1 投票 0

使用 StandardScaler 与 Min-Max Scaler 的线性回归模型性能差异

问题: 我正在研究线性回归问题,我注意到使用不同的缩放技术(StandardScaler 和 Min-Max Scaler)时模型性能存在显着差异。我...

回答 2 投票 0

使用 flutter 的交互式 3d 模型

我想制作一个加载 3D 模态的 flutter 应用程序,当用户单击 3D 模型的特定部分然后转到另一个 3d 模态时,该怎么做。 就像应用程序加载街道的 3D 模型一样......

回答 1 投票 0

忽略使用 Automapper 映射一个属性

我正在使用Automapper,我有以下场景: OrderModel 类有一个名为“ProductName”的属性,该属性不在数据库中。 所以当我尝试使用以下方法进行映射时: 映射器.CreateMap<

回答 9 投票 0

为什么 Laravel 模块中模型文件比配置文件先加载

我的模型和配置文件有问题,我试图调用模型中的配置。 模型文件中的代码是这样的 公共静态函数 boot() { 父::启动(); ...

回答 1 投票 0

我怎么得到“未定义的方法‘model_name’ for {:model=>#<RealQuoteLine ... " when the name is right there?

有人可以向我解释一下吗?我收到此错误: 引用中的 NoMethodError#work 未定义方法 `model_name' for {:model=># 有人可以向我解释一下吗?我收到此错误: NoMethodError in Quotations#work undefined method `model_name' for {:model=>#<RealQuoteLine id: 303, quote_concept: "Exportación Aerea CDMX", quantity: 1, unit_price: 0.134e3, real_segment_id: 194, created_at: "2023-08-10 19:56:48.617556000 +0000", updated_at: "2023-08-10 19:56:48.617556000 报告的错误在这一行: <%= form.fields_for(model: rql) do |line_form| %> 令我困惑的部分是:undefined method model_name' for {:model=>#<RealQuoteLine 那里没有型号名称吗?我确信有一个解释和一些我没有想到的东西,这会对我有很大帮助。 Quotations#work 操作方法是: <div> <h3>Captura de Cotización</h3> </div> <table class="show-table" > <tr> <td class="fw-light">Cotización:</td> <td><%= @quotation.id %></td> </tr> <tr> <td class="fw-light">Requerimiento:</td> <td><%= @quotation.request.description %></td> </tr> <tr> <td class="fw-light">Cliente:</td> <td><%= @quotation.request.client.name %></td> </tr> </table> <div class="container"> <% @quotation.real_service_group.tap do |rsg| %> <div class="row mt-4"> <div class="col"> <span>Servicio:</span> <span><%= rsg.title %></span> </div> </div> <% rsg.real_segments.each do |rs| %> <div class="row mt-8"> <div class="col"> <span>Segmento:</span> <span><%= rs.title %></span> </div> <div class="col"> <span>Moneda:</span> <span><%= rs.currency %></span> </div> </div> <div class="row mt-4"> <div class="col"> <span>Concepto</span> </div> <div class="col"> <span>Cantidad</span> </div> <div class="col"> <span>Precio Unitario</span> </div> <div class="col"> <span>importe</span> </div> </div> <% subtotal_segmento = 0 %> <%= form_with model: rs, method: :put do |form| %> <% rs.real_quote_lines.each do |rql| %> <div data-controller="linea-cotizacion"> <div class="row mt-4"> <%= form.fields_for(model: rs.real_quote_lines) do |line_form| %> <div class="col"> <%= line_form.text_field :quote_concept, value: rql.quote_concept, readonly: true %> </div> <div class="col"> <%= line_form.text_field :quantity, class: "linea-cantidad", data: { target: 'linea-cotizacion.quantity' } %> </div> <div class="col"> <%= line_form.number_field :unit_price, data: { target: 'linea-cotizacion.unitPrice', action: 'focusout->linea-cotizacion#updateImporte' } %> </div> <div class="col"> <%= content_tag(:span, '', id: 'importe', class: "fw-bold") %> </div> <%= line_form.hidden_field :id %> <%= line_form.hidden_field :real_segment_id %> <% end %> <%# end fields_for %> </div> </div> <% end %> <%# end each real_quote_lines (rql) %> <p style="background-color: darkgray;"> <span class="text-end">Subtotal</span> <span id="subtotal-segmento"><%= number_to_currency(subtotal_segmento) %></span> </p> <div class="row mt-4"> <div class="col-12"> <span> <%= form.submit "Guardar Segmento", class: "btn btn-primary" %> </span> </div> </div> <% end %> <%# end form_with%> <% end %> <%# end real_segments.each (rs) %> <% end %> <%# end real_service_group.tap (rsg) %> </div> 涉及型号及参数: class RealSegment < ApplicationRecord belongs_to :real_service_group has_many :real_quote_lines, dependent: :destroy accepts_nested_attributes_for :real_quote_lines, allow_destroy: true end class RealQuoteLine < ApplicationRecord belongs_to :real_segment, class_name: "RealSegment" end def real_segment_params params.require(:real_segment).permit(:id, :title, :currency, :iva, :retention, :real_service_group_id, real_quote_lines_attributes: %i[id real_segment_id quote_concept quantity unit_price]) end 这是我可以从错误控制台得到的: >> rql => #<RealQuoteLine id: 303, quote_concept: "Exportación Aerea CDMX", quantity: 1, unit_price: 0.134e3, real_segment_id: 194, created_at: "2023-08-10 19:56:48.617556000 +0000", updated_at: "2023-08-10 19:56:48.617556000 +0000"> >> rql.class => RealQuoteLine (call 'RealQuoteLine.connection' to establish a connection) >> 我正在尝试更新 real_quote_lines 表行上的值,我已经尝试了几种配置,但仍然无法前进...我怀疑这与 rql 是传递给阻止: <% rs.real_quote_lines.each do |rql| %> 但是那么正确的做法是什么? 你说报的错误是来自这一行: <%= form.fields_for(model: rql) do |line_form| %> ...但是在你的代码中你实际拥有的是: <%= form.fields_for(model: rs.real_quote_lines) do |line_form| %> 毫不奇怪,rs.real_quote_lines不是一个单独的模型,如果您将块变量rql放在那里,一切都可以正常工作。

回答 1 投票 0

此 json 文件的通用类 c#

我有一个涉及数据建模的问题 我必须开发2个项目。其中涉及本地化(后端 API、前端 Angular) 后端的目的是执行 CRUD 操作...

回答 1 投票 0

如何防止 R 在数据点范围之外推断回归线?

我正在 R 中拟合一个线性模型,其交互项如下:模型<- 'lm(y ~ x * z)'. y and z are continuous variables and z is a categorical variable with 3 categories. When I plot my ...

回答 1 投票 0

如何在 Django 数据库模型的字段中存储字典

我需要在模型的字段中保存字典。我怎么做? 例如我有这个代码: def create_random_bill(self): name_chars = re.compile("[a-zA-Z0-9 -_]") bill_name = "".join(

回答 9 投票 0

Django - 允许在大型用户模型中重复用户的电子邮件,但在其扩展模型中是唯一的?

Django - 允许在大型用户模型中重复用户的电子邮件,但在其扩展模型中是唯一的? 我正在 Django 中开发一个项目,该项目有一个从 AbstractBaseUser 扩展的用户模型;和 2 个模组...

回答 1 投票 0

Profile() 获得意外的关键字参数:'id_user'

我无法弄清楚为什么当“user_id”位于配置文件模型上时会发生此错误。帮助! Profile 正在从 Django 用户表单获取 FK,并且 id_user 位于 Profile 模型上。我关注...

回答 1 投票 0

Flutter,解析 json 模型时出现问题,导致空数组

这是我的api调用逻辑。 在 getx 控制器中使用此函数。调用获取 API。 我正在解析函数中的“住宿”模型,似乎得到一个空数组。我可以保证...

回答 1 投票 0

如何更改此多项选择答案的模型?

我正在为多项选择题答案考试制作一个 Django 应用程序。我创建了一个问题模型,如下所示。 类问题(模型.模型): subject = models.ForeignKey(Subject, on_delete=

回答 2 投票 0

(Rails) 如何通过 Rails 中的一个嵌套表单插入来创建友谊的双方?

基本上我有一个用户模型和一个友谊连接表,使用户彼此成为朋友。 用户类 < ApplicationRecord has_many :friendships has_many :friends, through: :friend...

回答 1 投票 0

Redis模型注释中数据类中的Env变量

在模型类 @Hashkey Redis 注释中指定动态环境变量很麻烦。 模型: @RedisHash("${spring.redis.namespace}:Book") 公开课书{ @ID 私有字符串...

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.