peewee

    0熱度

    1回答

    我是創建Web應用程序的新手,我決定從學習Flask開始。我將社交網絡作爲練習和學習一些基本技能的輔助項目。 到目前爲止,我已經能夠構建一個用戶可以發佈的「Stream」,類似於Twitter。 我一直在努力尋找一種方法來允許用戶刪除帖子。我正在使用Peewee庫的SQLite數據庫。這是我曾嘗試: @app.route('/delete_post/<int:post_id>') @login_

    0熱度

    1回答

    正如您從下面看到的,我正在嘗試更新記錄,但出於某種原因,我收到了這些錯誤。我一直在關注Peewee文檔,並且我發現了一些其他人有同樣的問題,但沒有與Djano的ORM而不是Peewee。我試圖放入「__」而不是「。」。沒有任何運氣的分類器。 測試的代碼 Python 2.7.9 (default, Feb 1 2015, 21:31:28) [GCC 4.4.7 20120313 (Red Ha

    4熱度

    1回答

    我使用Python/Mysql和Peewee作爲ORM。我陷入困境。假設我想用peewee插入一行,但檢查該行是否存在跳過else插入。有沒有任何程序在Python中使用peewee來做到這一點。

    1熱度

    1回答

    我正在嘗試學習Python,並有問題了解如何使用聚合函數與peewee。 在我的代碼我第一次做這樣的進口: import sys from datetime import datetime, timedelta from peewee import * from database import (db_init, MF_Djur, MF_Logg, MF_Senaste_Koll, MF_F

    0熱度

    2回答

    我遵循關於如何添加用戶定義的運算符的peewee文檔中的簡短指南,但是當我嘗試這樣做時,它會給我一個KeyError。 from peewee import * from peewee import OP from peewee import Expression db = MySQLDatabase(app.config['MYSQL_DATABASE_DB'], host=app.co

    1熱度

    1回答

    不工作我使用一個SQLite後端用一個簡單的展示 - 季 - 集模式: class Show(BaseModel): name = CharField() class Season(BaseModel): show = ForeignKeyField(Show, related_name='seasons') season_number = IntegerFiel

    4熱度

    1回答

    假設我們有這三種模型。 class Item(BaseModel): title = CharField() class User(BaseModel): name = CharField() class UserAnswer(BaseModel): user = ForeignKeyField(User, 'user_answers') item

    3熱度

    1回答

    我正在爲基於Flask的項目使用Flask-Admin。其中,我有一些模型(使用peewee),其中主鍵是用戶設置的,例如的username。但是Flask-Admin不在模型的創建/編輯頁面中顯示這些字段。 現在,當我嘗試創建一個新用戶時,「保存」按鈕給出一個peewee.UserDoesNotExist錯誤,並且「保存&添加」說「記錄成功創建」兩次,但實際上沒有做任何事情。 我已經擴展save

    0熱度

    1回答

    我將以文檔中的示例來解釋它。 class Student(BaseModel): name = CharField() class Course(BaseModel): name = CharField() students = ManyToManyField(Student, related_name='courses') StudentCourse = C

    0熱度

    1回答

    我使用的(優秀)Peewee ORM我的查詢需要在Python,我現在想下面的查詢轉換: select t1.created, t1.property_id, t1.requesting_user_id, t1.type, t1.response from pdr t1 inner join ( select max(id) as id, property_id, requesting