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
24
votes
2 answers

Flask unable to read Authorization header on ElasticBeanstalk

I have deployed a Flask app to AWS ElasticBeanstalk. The app is unable to read the 'Authorization' header in requests. Error log reports: KeyError: 'HTTP_AUTHORIZATION' Error traced to: @application.before_request def before_request(): …
12
votes
1 answer

Flask-Admin ModelView custom validation?

I'm studying Flask-Admin combined with PeeWee Backend ModelView (but my question may be applied to SQLAlchemy backend too), and there are two things I could not find in the docs or examples: (1). When I my model has an unique field and I test/try to…
weeanon
  • 821
  • 10
  • 17
6
votes
3 answers

Can flask-peewee do migration?

I want to use flask peewee as ORM for a relational db (MySQL) but my problem is changes in structure of models... like adding new attributes for a model (this means columns in db). I want to know if I can do this automatically without writing SQL…
user3817928
  • 95
  • 1
  • 4
5
votes
1 answer

How to get ids from bulk inserting in Peewee?

How to get ids from bulk inserting in Peewee? I need to return inserted ids for create a new array of dict like this: a = [{"product_id": "inserted_id_1", "name": "name1"}, {"product_id": "inserted_id_2", "name": "name1"}] Then I need to insert…
user9377278
5
votes
1 answer

AttributeError: 'SelectQuery' object has no attribute 'is_active'

I'm trying to learn the Peewee ORM in combination with Flask by following the Flask Mega Tutorial. In part 5 of the tutorial I create a login using OpenID. After overcoming a bunch of hurdles already I now get an AttributeError in the function…
kramer65
  • 50,427
  • 120
  • 308
  • 488
3
votes
1 answer

Pagination with Flask and Peewee

I'm trying to paginate the results of a query in Flask using Peewee. I'm trying to use the function object_list from playhouse.flask_utils. You can see the example of object_list seems pretty straightforward and the following code is the one I'm…
gglasses
  • 826
  • 11
  • 30
3
votes
1 answer

How to use an authentication decorator from within a blueprint in flask

I would like to use the following basic authentication decorator in my blueprints: def requires_auth(func): @wraps(func) def decorated(*args, **kwargs): request_auth = request.authorization if not request_auth or not…
Chris Matta
  • 3,263
  • 3
  • 35
  • 48
2
votes
1 answer

How get number of rows from peewee database?

I only need to get the number of rows from the peewee database. I know that .count or .wrapped_count can be executed in a query. num_of_rows = Video.select().wrapped_count() I need to execute a select query to get the number of rows. Does it affect…
Jeeva
  • 3,975
  • 3
  • 23
  • 47
2
votes
1 answer

Flask Security Is using id instead of email in where clause

I am using flask security to login to my admin panel. It was using the email and password just fine, but recently the login is requiring the id instead of the email. As far as I know the default behavior is to use the email column. When…
Taylor Simpson
  • 940
  • 1
  • 10
  • 27
2
votes
1 answer

is there a way to set peewee fields via a mixin?

I'm trying to set up a reusable set of data models which I can include in multiple apps, something like this (I'm using users as an example here, but the actual one is a peewee backend for the Authlib library): # mixins.py class…
Hippo
  • 450
  • 8
  • 22
2
votes
1 answer

Peewee throws KeyError: 'f'

So I can't figure out what the error here is (I'm pretty sure I'm just doing something stupid). Any help would be appreciated. Here's models.py DATABASE = SqliteDatabase('social.db') class User(UserMixin, Model): username =…
deezpeeps
  • 114
  • 2
  • 10
2
votes
1 answer

Default value for peewee DoubleField doesn't get reflected in MySQL db

Use case: Want to store 0.0 as default value while no value is passed for a pewee's DoubleField. I wrote following code but didn't work for me. class MyRelation(peewee.Model): id = peewee.PrimaryKeyField() percentage =…
aquaman
  • 451
  • 5
  • 16
2
votes
2 answers

User Registration - Flask Security

Have been following Flask Security protocols for user registration and login form for flask blog-post type app, using ORM peewee. Login works like a charm though registration is posing issue. Related Question How to use Flask-Security register…
Manganese
  • 650
  • 5
  • 26
2
votes
1 answer

peewee IntegrityError: NOT NULL constraint failed: terms.sets_id

I have the below model and getting a IntegrityError: NOT NULL constraint failed: terms.sets_id error. I've checked other posts and the only thing I can find that should be causing it is that I'm not passing in all the parameters, but I declare five…
Rafa
  • 3,219
  • 4
  • 38
  • 70
2
votes
1 answer

AttributeError: 'list' object has no attribute '_meta'

Why does my code give me the error? AttributeError: 'list' object has no attribute '_meta' My Model.py Code import datetime from flask.ext.login import UserMixin from peewee import * DATABASE = SqliteDatabase('social.db') class User(UserMixin,…
Razik
  • 182
  • 5
  • 16
1
2 3 4 5 6 7