Issue: How to enter the admin interface?
Author: kramer65
State: closed
Created: 2014-10-21 17:05:05

I'm trying to get the peewee admin up and running. For this I followed the simple four step getting started guide here: http://flask-peewee.readthedocs.org/en/latest/admin.html

And after implementing the four steps and having my flask app up and running I'm kinda lost. I managed to figure out that I had to go to mydomain.com/admin (could have been mentioned there .. :) ), but I now need to insert a username and password. Since I never defined a username and password anywhere I wouldn't know what to use. I do have user logins on my website using flask-login and flask-oauthlib to authenticate with LinkedIn, but I figured that the Peewee admin doesn't assume any User model to be defined or login system incorporated in the app.

So in the end I just tried something random and hit "Log In", which caused it to end in an error:

```
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Library/Python/2.7/site-packages/flask_peewee/auth.py", line 189, in login
    form.password.data,
  File "/Library/Python/2.7/site-packages/flask_peewee/auth.py", line 142, in authenticate
    user = active.where(self.User.username==username).get()
  File "build/bdist.macosx-10.9-intel/egg/peewee.py", line 2390, in get
    return clone.execute().next()
  File "build/bdist.macosx-10.9-intel/egg/peewee.py", line 2431, in execute
    self._qr = ResultWrapper(model_class, self._execute(), query_meta)
  File "build/bdist.macosx-10.9-intel/egg/peewee.py", line 2127, in _execute
    return self.database.execute_sql(sql, params, self.require_commit)
  File "build/bdist.macosx-10.9-intel/egg/peewee.py", line 2732, in execute_sql
    self.commit()
  File "build/bdist.macosx-10.9-intel/egg/peewee.py", line 2601, in __exit__
    reraise(new_type, new_type(*exc_value.args), traceback)
  File "build/bdist.macosx-10.9-intel/egg/peewee.py", line 2724, in execute_sql
    cursor.execute(sql, params or ())
OperationalError: no such column: t1.username
```

So from this I think that it does actually try to use my User class (which doesn't have a username defined because it uses LinkedIn authentication).

Does anybody know how I can get the peewee admin working? All tips are welcome!


```
  File "/Library/Python/2.7/site-packages/flask_peewee/auth.py", line 142, in authenticate
    user = active.where(self.User.username==username).get()
```

You may need to implement your own `Auth` class providing an `authenticate()` method which will ensure that the requesting user is authenticated. This is not really a peewee question, so I am closing. Feel free to reopen in `flask-peewee`.