问题描述
在一件奇怪的事情上,我需要一些帮助:
items = ContainerItem.objects.filter(
container=OuterRef('container'),date__gte=OuterRef('start_datetime'),date__lt=OuterRef('end_datetime')
)
total_amount_qs = items.aggregate(
total_amount=Sum('amount'),).values('total_amount')
Group.objects.all().annotate(amount_sum=Subquery(total_amount_qs)
我所有的字段都包含字符<%= form_for @model do |f|
<%= f.text_area :text %>
<%= f.text_area :other_text %>
<%= f.submit "Submit" %>
...
:
\n
当我进入表单页面时,Rails会自动填充字段: form screenshot
然后,当我单击“提交”而未做任何修改时,所有内容都会更新:所有@model.text # => "A text on multiple line\nIs sleeping here"
@model.other_text # => "An other text on multiple line\nIs sleeping here"
之后都是\n
:
\r
这些@model.text # => "A text on multiple line\r\nIs sleeping here"
@model.other_text # => "An other text on multiple line\r\nIs sleeping here"
来自哪里?
你们对我在提交表单时如何防止添加\r
有任何想法吗?
谢谢您的帮助!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)