Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
acfb7ba6
Commit
acfb7ba6
authored
Oct 30, 2016
by
Serge S. Koval
Committed by
GitHub
Oct 30, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1386 from pawl/example_py3_compat
fix python3 compatibility in sqla examples without future
parents
2313bb05
0dda3ff6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
7 deletions
+1
-7
app.py
examples/sqla/app.py
+0
-6
app2.py
examples/sqla/app2.py
+1
-1
No files found.
examples/sqla/app.py
View file @
acfb7ba6
...
...
@@ -2,7 +2,6 @@ import os
import
os.path
as
op
from
flask
import
Flask
from
flask_sqlalchemy
import
SQLAlchemy
from
future.utils
import
python_2_unicode_compatible
from
wtforms
import
validators
...
...
@@ -26,7 +25,6 @@ db = SQLAlchemy(app, session_options=session_options)
# Create models
@
python_2_unicode_compatible
class
User
(
db
.
Model
):
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
first_name
=
db
.
Column
(
db
.
String
(
100
))
...
...
@@ -45,7 +43,6 @@ post_tags_table = db.Table('post_tags', db.Model.metadata,
)
@
python_2_unicode_compatible
class
Post
(
db
.
Model
):
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
title
=
db
.
Column
(
db
.
String
(
120
))
...
...
@@ -61,7 +58,6 @@ class Post(db.Model):
return
self
.
title
@
python_2_unicode_compatible
class
Tag
(
db
.
Model
):
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
name
=
db
.
Column
(
db
.
Unicode
(
64
))
...
...
@@ -70,7 +66,6 @@ class Tag(db.Model):
return
self
.
name
@
python_2_unicode_compatible
class
UserInfo
(
db
.
Model
):
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
...
...
@@ -84,7 +79,6 @@ class UserInfo(db.Model):
return
'
%
s -
%
s'
%
(
self
.
key
,
self
.
value
)
@
python_2_unicode_compatible
class
Tree
(
db
.
Model
):
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
name
=
db
.
Column
(
db
.
String
(
64
))
...
...
examples/sqla/app2.py
View file @
acfb7ba6
...
...
@@ -28,7 +28,7 @@ class Car(db.Model):
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
,
autoincrement
=
True
)
desc
=
db
.
Column
(
db
.
String
(
50
))
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
self
.
desc
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment