Questions tagged [flask-peewee]

A flask web framework extension that provides a layer of integration between flask and the peewee orm.

Website for Flask-Peewee: https://flask-peewee.readthedocs.io/en/latest/

Website for the peewee ORM: https://peewee.readthedocs.io/en/latest/

104 questions
0
votes
1 answer

Peewee creates mutiple records (on flask app)

I have a simple statement, Points.create(user=bt.user,match=m,value=2,datecreated=date.today()) I expect it to create one record but sometimes it creates mutliple records. Not sure what's going on. Complete code is like below: from utils.models…
Aravind
  • 550
  • 7
  • 17
0
votes
1 answer

Show ForeignKeyField directly in Flask-Peewee

I have set up an API using the Flask-Peewee API library: class ActivityResource(RestResource): exclude = ('id', 'course') class CourseResource(RestResource): exclude = ('id') class SessionResource(RestResource): def get_query(self): …
Ben
  • 1,561
  • 4
  • 21
  • 33
0
votes
2 answers

How to filter a query in flask-peewee by URL?

I'd like to run the following query by flask-peewee, merchant_name LIKE 'seaside%' SELECT * FROM `merchant_details` WHERE `merchant_name` LIKE 'seaside%' Here is the return JSON of the below URL and I need to filter the merhcnat_name…
Alireza Seifi
  • 135
  • 3
  • 11
0
votes
1 answer

Generate select with optgroup in Peewee

I have the following models in a flask application with the Peewee ORM: class Course(db.Model): name = CharField() class Activity(db.Model): course = ForeignKeyField(Course) name = CharField() I want to generate a multiple select…
Ben
  • 1,561
  • 4
  • 21
  • 33
-1
votes
1 answer

Convert SQL query to peewee

I need convert a SQL query to peewee instructions. My SQL is: parts_test = db.execute(''' SELECT tokenID, rewardCount FROM Loot INNER JOIN Quests ON Loot.questID = Quests.questID INNER JOIN Rewards ON Loot.rewardID =…
-1
votes
1 answer

NOT NULL constraint failed: Time.start peewee

I'm trying to create a tables in Flask app. For creating DB I use peewee library. When run func, I receive an error: NOT NULL constraint failed: Time.start Can some one explain how to insert data in to database correctly models.py from peewee import…
DmitryTok
  • 1
  • 4
-1
votes
1 answer

How to display the recipe with the highest like- Python Flask with Peewee

I am new to flask and I have created a flask api where user can upload recipe and also like recipes. To get the top recipe, I want sort recipe by the highest number of likes. @app.route('/top_recipe', methods=['GET']) def top_recipe(): recipes =…
dulla
  • 1
-1
votes
1 answer

Peewee error on model.create() [ Proxy ]

Hello. When i'm trying to create new record in model, i'm getting AttributeError: 'dict' object has no attribute 'compiler' Possible, that i'm getting this error because using Proxy class, but can't find mistake in my code. init.py from flask…
Chemoday
  • 191
  • 1
  • 8
-1
votes
1 answer

How to init db in Peewee?

I'm new in Flask stack. I need to run some project. I created virtualenv and installed all…
maximkalga
  • 59
  • 1
  • 6
-1
votes
1 answer

How to create a Object that has PrimaryKeyField and ForeignKeyField ? Python Flask PeeWee

the classes: class User(flask_db.Model, UserMixin): id = PrimaryKeyField() social_id = CharField(null=False, unique=True) nickname = CharField(null=False) email = CharField(null=True) class Feed(flask_db.Model): id =…
Igna94
  • 75
  • 2
  • 8
-2
votes
1 answer

Peewee ORM inserts blank value for a column

I've been trying to use peewee orm to insert values to db for my project, problem is that it inserts a blank value for one of the columns for seemingly no reason, I have a for loop inserting these values and it only ignores the url value, heres my…
neophyte88_
  • 1
  • 1
  • 2
-2
votes
1 answer

How to select column items of a table from a table with matching id in table referenced

I have two tables: select * from patient WHERE name = 'Dharam'; +----+--------+----------+---------------+-----+--------+ | id | name | townCity | contactnumber | age | gender | +----+--------+----------+---------------+-----+--------+ | 5 |…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
-2
votes
1 answer

Querying flask-peewee REST API by datetime

I'm using flask-peewee, and I'm trying to run a query and filter by a DateTime field. However something like this does not seem to work: http://127.0.0.1:5000/api/obj/?group=1&at_date=Thu,%2021%20Jul%202016%2012:28:29%20GMT Nor do the other formats…
KimiNewt
  • 501
  • 3
  • 14
-2
votes
1 answer

Get weekly information about transactions

I have a simple website made with Flask and Peewee as the ORM that annotates the drinks everyone in the office gets to then, once a week or so, check who drink what, how much and when. I have a simple table named orders that looks like this: Orders…
Leandro Poblet
  • 1,424
  • 1
  • 14
  • 19
1 2 3 4 5 6
7