RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题

全部问题

Martin Hope
weldoy
Asked: 2024-10-12 23:50:44 +0000 UTC

如何通过按按钮类型输入来获取表单中的数据?

  • 5

有一种形式,其中有 5 个按钮类型的输入。提交表单时,您需要获取用户单击了哪个按钮。没有 JavaScript! 您需要接收product_size变量中的数据,该变量位于proof_success(product_id)函数中

超文本标记语言

<form method="post" action="proof/success">
    <div class="assorti"><h2>{{ product.product }}</h2></div>
    <div class="cardcontainer">
        <article class="card">
            <img src="{{ url_for('static', filename='img/t-shirts.jpg') }}" alt="Футболка" height="270">
        </article>
    </div>
    <div class="oryr">
        <h3>{{ product.product_price }} руб</h3>
            
        <div class="choose_size">
            <input name="XS" type="button" value="XS" class="cs_card">
            <input name="S" type="button" value="S" class="cs_card">
            <input name="M" type="button" value="M" class="cs_card">
            <input name="L" type="button" value="L" class="cs_card">
            <input name="XL" type="button" value="XL" class="cs_card">
        </div>

        <ul>
            <p>Собственное произодство</p>
            <p>Хлопок - 100%</p>
            <p>Качественный принт</p>
        </ul>
    </div>

    <div class="box_4_btn">
        <button data-v-c3114ba2="" class="app-button basket-price__submit width-100 paypose" type="submit">
        Добавить в корзину</button>
    </div>
</form>

PYTHON

@app.route('/<int:product_id>/proof/success', methods=["GET", "POST"])
def proof_success(product_id):
    product = Cart.query.get_or_404(product_id)

    product_price = product.product_price

    if request.method == "POST":
        pass

        return redirect(url_for('tshirts'))
python
  • 2 个回答
  • 14 Views
Martin Hope
Кален
Asked: 2024-10-12 23:24:35 +0000 UTC

如何将不同变量随机生成的数字存储到只有一个元素的列表中?

  • 6

该代码生成随机 IP 地址和 IP 块,然后输出生成的随机 IP 地址:

def ip_generation():
    global ip_generation_ipv4
    global ip_generation2_ipv4
    global ip_generation3_ipv4
    global ip_generation4_ipv4
    global subnet_generation

    ip_generation_ipv4 = randint(0, 255)
    ip_generation2_ipv4 = randint(0, 255)
    ip_generation3_ipv4 = randint(0, 255)
    ip_generation4_ipv4 = randint(0, 255)
    subnet_generation = randint(0, 24)

    print(f"{ip_generation_ipv4}.{ip_generation2_ipv4}.{ip_generation3_ipv4}.{ip_generation4_ipv4}/{subnet_generation}")
ip_generation()

问题: 需要将显示的数据作为单独的元素保存在列表中,以便最终列表由这些 IP 组成

['192.76.0.0/24', '210.92.71.85/16'] и т.д.
python
  • 1 个回答
  • 19 Views
Martin Hope
weldoy
Asked: 2024-10-12 22:58:50 +0000 UTC

从没有输入标签的表单中获取数据

  • 5

是否可以从 h3 标签获取数据,该标签的表单包含使用 Jinja 语言输入的一些文本?您需要从h3标签获取{{product.product_price}}并将其发送到product_price变量中的hoodies_proof(product_id)函数。

超文本标记语言

<form method="post">
    <div class="assorti"><h2>{{ product.product }}</h2></div>
    <div class="cardcontainer">
        <article class="card">
            <img src="{{ url_for('static', filename='img/t-shirts.jpg') }}" alt="Футболка" height="270">
        </article>
    </div>
    <div class="oryr">
        <h3 name="product_price">{{ product.product_price }} руб</h3>
            
        <div class="choose_size">
            <input name="XS" type="button" value="XS" class="cs_card">
            <input name="S" type="button" value="S" class="cs_card">
            <input name="M" type="button" value="M" class="cs_card">
            <input name="L" type="button" value="L" class="cs_card">
            <input name="XL" type="button" value="XL" class="cs_card">
        </div>

        <ul>
            <p>Собственное произодство</p>
            <p>Хлопок - 100%</p>
            <p>Качественный принт</p>
        </ul>
    </div>

    <div class="box_4_btn">
        <button data-v-c3114ba2="" class="app-button basket-price__submit width-100 paypose" type="submit">
        Добавить в корзину</button>
    </div>
</form>

PYTHON

@app.route('/hoodies/<int:product_id>/proof', methods=["GET", "POST"])
def hoodies_proof(product_id):
    product = Cart.query.get_or_404(product_id)
    # product_price = request.form.get('product_price')

    return render_template('proof.html', product=product)
python
  • 1 个回答
  • 21 Views
Martin Hope
Щит Постер
Asked: 2024-10-12 20:10:31 +0000 UTC

如何确保文件夹/文件已加载到 C# 中的 .exe 中[重复]

  • 5
这个问题已经在这里得到回答:
如何在 Visual Studio 项目中编译单个 exe 文件? (1 个回答)
如何将所有解决方案项目编译为一个.EXE? (4 个回答)
昨天关门了。

这样的问题,我需要制作一个 .exe 文件,如何放置文件夹和 .dll 以便它可以工作并且不需要这两个文件彼此相邻。

  1. Windows输入.dll在此输入图像描述
  2. 资产
c#
  • 1 个回答
  • 38 Views
Martin Hope
eccs0103
Asked: 2024-10-12 19:27:46 +0000 UTC

动态覆盖 Symbol.toPrimitive

  • 6

描述

我编写了一个带有动态覆盖的简单类Symbol.toPrimitive:

interface PrimitiveHintsMap {
    "number": number;
    "boolean": boolean;
    "string": string;
}

class Timespan {
    #duration = 0;
    [Symbol.toPrimitive]<K extends keyof PrimitiveHintsMap>(hint: K): PrimitiveHintsMap[K] {
        switch (hint) {
            case `number`: return this.#duration;
            case `boolean`: return Boolean(this.#duration);
            case `string`: return this.toString();
            default: throw new TypeError(`Invalid '${hint}' primitive hint`);
        }
    }
}

...就像对内置 DOM 侦听器所做的那样:

return该函数每次都会抱怨

类型“number”不可分配给类型“PrimitiveHintsMap[K]”。
类型“number”不可分配给类型“never”。ts(2322)

问题

我哪里错了?
你从哪里找到它的never?

typescript
  • 1 个回答
  • 13 Views
上一页
下一页

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5