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
1
vote
1 answer

Peewee Flask Trying to Return Data from a BooleanField

I'm trying to return the confirmed BooleanField of a user in the UserTable model (so I can deny access to some routes later) with this code: models.py class UserTable(UserMixin, Model): email = CharField(unique=True) password = CharField() …
TomHill
  • 614
  • 1
  • 10
  • 26
1
vote
1 answer

Python PeeWee IntegerField - Default value of unix timestamp

I would like to manage timestamps in my database using seconds since epoch using a PeeWee IntegerField rather than a DateTimeField. I know that the field definition can take a default value using a callable, but I would need to do something like:…
curious-me
  • 71
  • 4
1
vote
1 answer

peewee: building a query programmatically

Is it possible (how?) to build a select query programmatically in peewee? The point is to add .where() clauses as needed.
Nucular
  • 683
  • 1
  • 5
  • 19
1
vote
1 answer

Flask-Peewee and User Creation doesn't work

I am currently working on my administration interface for a website. However, when I test adding a new user, I get the following traceback: Traceback (most recent call last): File…
Cody Dostal
  • 311
  • 1
  • 3
  • 13
1
vote
1 answer

How to edit flask-admin to support multi tenancy?

I'm using Flask-peewee, looking for a way to give permission to admins, I'd like to make a multi tenancy admin dashboard. I have made for displaying deals: class DealsAdmin(ModelAdmin): columns = ('deal_name', 'deal_desc', 'created_on') …
Alireza Seifi
  • 135
  • 3
  • 11
1
vote
1 answer

How to pass a string literal parameter to a peewee fn call

I've got a issue passing a string literal parameter to a SQL function using peewee's fn construct. I've got an object defined as: class User(BaseModel): computingID = CharField() firstName = CharField() lastName = CharField() role =…
BridgetG
  • 113
  • 1
  • 14
1
vote
1 answer

How to Reverse Foreign key in python Flask-peewee

I'm using Flask-peewee and there are two tables for categories and Subcategories,I'd like to make an api to list all subcategories Based on the category in JSON. (reverse foreign key) So if we have 5 main Categories & 20 Subcategories, we need to…
Alireza Seifi
  • 135
  • 3
  • 11
1
vote
2 answers

How to fetch a custom SELECT query in Flask?

I'd like to fetch this custom query on Flask-Peewee SELECT A.* , haversine('34.0160',' -118.4925', A.lat, A.long, 'MILES') AS dist FROM merchant_details A HAVING haversine('34.0160', '-118.4925', A.lat, A.long, 'MILES') <6000 I tried the following…
Alireza Seifi
  • 135
  • 3
  • 11
1
vote
1 answer

Make peewee admin work with flask security

I like both peewee and Flask security, and they both work well together, but I can't get the admin functionality of peewee to work. I am really not sure about how to do this, but I really want to use both together. I have tried a lot of things, but…
Ben
  • 1,561
  • 4
  • 21
  • 33
1
vote
0 answers

Flask login results in error on correct password (using peewee)

I'm currently trying to build an app by taking and adjusting parts of the example app included with the flask-peewee extension (code here). I can now register and show the login screen. When I enter incorrect login credentials, I get a message that…
kramer65
  • 50,427
  • 120
  • 308
  • 488
0
votes
1 answer

Peewee 1:n mapping duplicates in join

I have some peewee models with 1:n mapping and backrefs, like so: class Userr(BaseModel): rowId = BigAutoField(primary_key=True) userId = CharField() class UserName(BaseModel): rowId = BigAutoField(primary_key=True) name =…
Vedavyas Bhat
  • 2,068
  • 1
  • 21
  • 31
0
votes
2 answers

Peewee: how to pass raw SQL query parameter without apostrophes

Using Python & Peewee, I want to create a function that takes a SQL view name as an argument and returns its results. To avoid any unwanted SQL injections, I want to pass the view name as the SQL query parameter: def run_view_query(view_name: str): …
Przemek Baj
  • 426
  • 2
  • 5
  • 18
0
votes
1 answer

I have an api that manages likes and dislike for recipes but i keep getting error in my code

the Like api is supposed to check if the recipe has been liked before. If yes, it should delete and if no, it should add like to db but I get an error. @app.route("/like/", methods=['GET']) @jwt_required() def like(id): current_user =…
icanbe444
  • 11
  • 3
0
votes
1 answer

I have a log in API that is supposed to throw error when an invalid user is entered instead it throws error

@app.route('/login', methods=['POST']) def login(): if request.method == 'POST': username = request.form['username'] password = request.form['password'] if not username: return jsonify({'message':'Missing username'}), 400 …
icanbe444
  • 11
  • 3
0
votes
1 answer

How could double validation be added in marshmallow "fields"?(PeeWee)

I send requests to a RESTful API. Also I have a PeeWee model to keep the responses. I check the validations with Marshmallow. In the response body, there is a variable that is not certain data type(Integer or String). I want my PeeWee model have…
yasinkuyuk
  • 111
  • 1
  • 1
  • 4