Individual Form Fields In Jinja2 - Flask-Admin
On your edit and create templates in Flask-Admin, you can print individual form fields like this (the field’s name is location):
{{ form.location }}
On your edit and create templates in Flask-Admin, you can print individual form fields like this (the field’s name is location):
{{ form.location }}
I was finally able to get the request to go through by adding a header saying it’s json format. Here’s an example:
requestbody = """
{
"end": {
"dateTime": "2014-05-18T01:35:00Z"
},
"start": {
"dateTime": "2014-05-18T01:35:00Z"
},
"description": "test2",
"location": "test venue",
"summary": "test2"
}
"""
response = authomatic.access(credentials, url, method='POST', headers={'Content-Type': 'application/json'}, body=requestbody)
In Flask-Admin, you can override the “on_model_change” function to to automatically populate a “modified_by” field in your model.
class LocationView(ModelView):
def on_model_change(self, form, model):
model.user_id = g.user.id
admin = Admin(app)
admin.add_view(LocationView(Location, db.session, name="Locations"))
Those do a lot of the work of starting a new Flask project for you.
With cookiecutter flask, all you need to do to build a new project is: cookiecutter https://github.com/sloria/cookiecutter-flask.git
As a warning, cookiecutter flask and overholt include a lot of stuff. I ended up not using it because it was too much work to change everything to work with oAuth.
Remove the index column from a Pandas CSV export (StackOverflow)
I created an app that allows you to upload a pdf and it returns a copy of your PDF with the page order reversed. The code is here: https://github.com/pawl/pdfreverse
Initially when I googled how to do this in Adobe Acrobat, the first few results had fairly complicated solutions. After I made the app, I ended up finding an easier way to do it in Adobe (in the 6th from the top Google result on “reverse pdf order acrobat”…):

Oh well, it was a fun project.
While tested out Discourse, I only found a few negative things:
docs/MAILING-LIST-SETUP.md in their repo) has since been removed, so this links to their current mailing list mode doc instead.As a forum, this beats the crap out of PhpBB, but as a mailing list it’s not a clear winner over Google Groups yet. It’s open source, has a better web interface, and the “Categories” are a cool feature for keeping all the lists in the same place. But, the “email in” functionality was too recently implemented, and it might take a few months before it’s as polished as Google Groups.
It’s going to be a very tempting replacement if they add default settings for user preferences.
Screenshots:





I was getting this error when trying to connect to a sybase database using Microsoft’s odbc driver by using the connection string shown in the SqlAlchemy examples:
DBAPIError: (Error) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)') None None
The following code worked to connect:
import pyodbc, sqlalchemy
def connect():
return pyodbc.connect('DSN=<dsn name>;UID=<username>;PWD=<password>')
srcEngine = sqlalchemy.create_engine('sybase+pyodbc://', creator=connect, echo=True)
I was getting this error message because docker was refusing to start: Cannot connect to the Docker daemon. Is ‘docker -d’ running on this host?
This issue was occurring because my kernel was refusing to upgrade, because I was on a VPS. (you need to get your VPS provider to upgrade it for you)
Run uname -r, if it returns something like this: 2.6.32-042stab084.20 That’s probably the reason why docker isn’t starting. Your kernel isn’t compatible.
If you’re not on a VPS and can upgrade your kernel, try instructions on this page: Install Docker Engine on Ubuntu
I was getting this error message while I was trying to upgrade the kernel on my VPS:
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.8.0-34-generic.postrm line 328.
dpkg: error processing linux-image-3.8.0-34-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-3.8.0-34-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
You might not be able to upgrade the kernel on your VPS. Contact your VPS provider and get them to upgrade the kernel for you.