Skip to content

Commit 14abaf5

Browse files
committed
Merge branch 'master' of github.com:jstacoder/flask-xxl
Conflicts: setup.py
2 parents 3587532 + 93b526b commit 14abaf5

27 files changed

+508
-330
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,19 @@ _to see this in a real world example take a look at my other projects_ [Flask-Cm
1313

1414
##What this provides:
1515

16+
- Installable blueprints
17+
- any blueprints listed in your settings under `BLUEPRINTS` will be imported and registered on your app and if that blueprint is a package any files it contains named `models.py` or `views.py` will be imported as well, so no more need to manually import your views and models giving odd errors if you dont do it in the exact correct order!!
18+
1619
- basemodels.py
17-
- with a BaseMixin class that provides many useful CRUD operations, IE: model.save(), model.delete()
20+
- with a sqlalchemy compatible BaseMixin class
21+
- provides many useful CRUD operations, IE: model.save(), model.delete()
22+
- `BaseMixin` generates `__tablename__` automaticlly
23+
- `BaseMixin` adds an auto incrementing `id` field, as the primary_key to each model
24+
- `BaseMixin.session` is current model classes session
25+
- `BaseMixin.engine` is the current db engine
26+
- `BaseMixin.query` is the models sqlalchemy query from its session
27+
- `BaseMixin.get_all()` `->` function to return all of a model
28+
- `BaseMixin.get(*args,**kwargs)` `->` get single model by attr values, mainly for id=x
1829

1930
- baseviews.py
2031
- with a BaseView class that is subclassed from Flask.views.MethodView to allow easy definition of view responses to get and post requests.
@@ -114,3 +125,4 @@ _to see this in a real world example take a look at my other projects_ [Flask-Cm
114125

115126
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/jstacoder/flask-xxl/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
116127

128+
for more fun checkout the [wiki](https://github.com/jstacoder/flask-xxl/wiki)

flask_xxl/apps/admin/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
url_prefix='/admin')
88

99

10-
from views import *

flask_xxl/apps/admin/models.py

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
from basemodels import BaseMixin
1+
import sqlalchemy as sa
2+
from ...basemodels import BaseMixin
23
from LoginUtils import check_password, encrypt_password
3-
from ext import db
4+
from ...baseviews import is_verbose
45

5-
for attr in dir(db):
6-
globals()[attr] = getattr(db,attr)
76

7+
if is_verbose():
8+
print 'importing flask_xxl.apps.admin.models as ',__name__
89

9-
class Setting(BaseMixin,Model):
10-
__tablename__ = 'settings'
1110

12-
name = Column(String(255),nullable=False,unique=True)
13-
setting_type_id = Column(Integer,ForeignKey('types.id'))
14-
setting_type = relationship('Type',backref=backref(
11+
class Setting(BaseMixin):
12+
13+
name = sa.Column(sa.String(255),nullable=False,unique=True)
14+
setting_type_id = sa.Column(sa.Integer,sa.ForeignKey('types.id'))
15+
setting_type = sa.orm.relationship('Type',backref=sa.orm.backref(
1516
'settings',lazy='dynamic'))
16-
default = Column(String(255))
17-
value = Column(String(255))
17+
default = sa.Column(sa.String(255))
18+
value = sa.Column(sa.String(255))
1819

1920
@property
2021
def widget(self):
@@ -23,27 +24,25 @@ def widget(self):
2324
else:
2425
return ''
2526

26-
class Type(BaseMixin,Model):
27-
__tablename__ = 'types'
27+
class Type(BaseMixin):
2828

29-
name = Column(String(255),nullable=False)
30-
widgets = relationship('Widget',backref=backref(
29+
name = sa.Column(sa.String(255),nullable=False)
30+
widgets = sa.orm.relationship('Widget',backref=sa.orm.backref(
3131
'type'),lazy='dynamic')
32-
html = Column(Text)
33-
field_type = Column(String(255))
34-
required = Column(Boolean,default=False)
35-
data_type = Column(String(255))
32+
html = sa.Column(sa.Text)
33+
field_type = sa.Column(sa.String(255))
34+
required = sa.Column(sa.Boolean,default=False)
35+
data_type = sa.Column(sa.String(255))
3636

3737
def __repr__(self):
3838
return self.name or ''
3939

40-
class Widget(BaseMixin,db.Model):
41-
__tablename__ = 'widgets'
40+
class Widget(BaseMixin):
4241

43-
name = Column(String(255),nullable=False)
44-
title = Column(String(255))
45-
content = Column(Text,nullable=False)
46-
type_id = Column(Integer,ForeignKey('types.id'))
42+
name = sa.Column(sa.String(255),nullable=False)
43+
title = sa.Column(sa.String(255))
44+
content = sa.Column(sa.Text,nullable=False)
45+
type_id = sa.Column(sa.Integer,sa.ForeignKey('types.id'))
4746

4847
def __repr__(self):
4948
return self.name

flask_xxl/apps/auth/new/__init__.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

flask_xxl/apps/auth/new/forms.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

flask_xxl/apps/auth/new/models.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

flask_xxl/apps/auth/new/templates/404.html

Lines changed: 0 additions & 6 deletions
This file was deleted.

flask_xxl/apps/auth/new/templates/500.html

Lines changed: 0 additions & 6 deletions
This file was deleted.

flask_xxl/apps/auth/new/templates/base.html

Lines changed: 0 additions & 50 deletions
This file was deleted.

flask_xxl/apps/auth/new/templates/login.html

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)