Skip to content

Commit 0e68103

Browse files
author
Kyle J. Roux
authored
Update README.md
1 parent 456db5f commit 0e68103

File tree

1 file changed

+61
-58
lines changed

1 file changed

+61
-58
lines changed

README.md

Lines changed: 61 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,25 @@ _to see this in a real world example take a look at my other projects_ [Flask-Cm
2222

2323
- basemodels.py
2424
- with a sqlalchemy compatible BaseMixin class
25-
- provides many useful CRUD operations, IE: model.save(), model.delete()
26-
- `BaseMixin` generates `__tablename__` automaticlly
27-
- `BaseMixin` adds an auto incrementing `id` field, as the primary_key to each model
28-
- `BaseMixin.session` is current model classes session
29-
- `BaseMixin.engine` is the current db engine
30-
- `BaseMixin.query` is the models sqlalchemy query from its session
31-
- `BaseMixin.get_all()` `->` function to return all of a model
32-
- `BaseMixin.get(*args,**kwargs)` `->` get single model by attr values, mainly for id=x
25+
- provides many useful CRUD operations, IE: model.save(), model.delete()
26+
- `BaseMixin` generates `__tablename__` automaticlly
27+
- `BaseMixin` adds an auto incrementing `id` field, as the primary_key to each model
28+
- `BaseMixin.session` is current model classes session
29+
- `BaseMixin.engine` is the current db engine
30+
- `BaseMixin.query` is the models sqlalchemy query from its session
31+
- `BaseMixin.get_all()` `->` function to return all of a model
32+
- `BaseMixin.get(*args,**kwargs)` `->` get single model by attr values, mainly for id=x
3333

3434
- baseviews.py
3535
- with a BaseView class that is subclassed from Flask.views.MethodView to allow easy definition of view responses to get and post requests.
3636
- BaseView also has many builtin helpers/imports to speed development, ie:
37-
- BaseView.render() calls render_template(BaseView._template,**BaseView._context) easily define either or both in the class variable
38-
section of the class and then add,change/ w/e based on logic that happens during request processing.
39-
example:
40-
41-
```python
37+
- BaseView.render() calls:
38+
`render_template(BaseView._template,**BaseView._context)`
39+
easily define either or both in the class variable
40+
section of the class and then add or change whatever you need to
41+
ie: maybe based on logic that happens during request processing.
42+
for example:
43+
```python
4244
class ExampleView(BaseView):
4345
_context = {
4446
'some_flag':True,
@@ -49,61 +51,61 @@ _to see this in a real world example take a look at my other projects_ [Flask-Cm
4951
self._context['new_flag'] = new_flag
5052
self._context['some_flag'] = False
5153
return self.render()
52-
```
53-
- <kbd>BaseView.redirect(endpoint)</kbd>
54-
is a reimplementation of <code>flask.helpers.redirect</code> which allows you to directly enter the
55-
endpoint, so you dont have to run it through <code>url_for()</code> first.
56-
57-
- <pre>BaseView.get_env()</pre> returns the current jinja2_env
54+
```
55+
56+
- `BaseView.redirect(endpoint)`
57+
is a reimplementation of `flask.helpers.redirect` which allows you to directly enter the
58+
endpoint, so you dont have to run it through `url_for()` first.
5859

60+
- `BaseView.get_env()` -> returns the current jinja2_env
5961

60-
- <pre>BaseView.form_validated()</pre> returns true if all forms validate
62+
- `BaseView.form_validated()` -> returns true if all forms validate
6163

6264
- __namespaces imported into BaseView__:
63-
BaseView.flash == flask.flash
65+
`BaseView.flash == flask.flash`
6466

6567

6668

6769

6870
- many builtin template globals(context_processors) to use.
6971
ie:
7072

71-
- get_block(block_id) <-- requires use of flask.ext.xxl.apps.blog
72-
* add blocks of html/jinja2/template helpers into the db and access from within templates
73-
great for things like header navs or sidebar widgets
73+
- `get_block(block_id)` <-- requires use of flask.ext.xxl.apps.blog
74+
* add blocks of html/jinja2/template helpers
75+
into the db and access from within templates
76+
great for things like header navs or sidebar widgets
7477

75-
- get_icon(icon_name,icon_lib) <-- requires use of flask.ext.xxl.apps.blog
76-
* flask.ext.xxl.apps.blog comes with 8 icon librarys!!!
77-
- Glyphicon
78-
- Font Awesome
79-
- Mfg_Labs
80-
- Elusive icons
81-
- Genericons
82-
- and more ...
83-
access any icon anywhere in your templates! even from cms blocks!!!
78+
- `get_icon(icon_name,icon_lib)` <-- requires use of flask.ext.xxl.apps.blog
79+
* flask.ext.xxl.apps.blog comes with 8 icon librarys!!!
80+
- Glyphicon
81+
- Font Awesome
82+
- Mfg_Labs
83+
- Elusive icons
84+
- Genericons
85+
- and more ...
86+
access any icon anywhere in your templates! even from cms blocks!!!
8487

85-
- get_model(model_name,blueprint_name)
86-
* access any model class from any template (currently only supports sqlalchemy models)
88+
- `get_model(model_name,blueprint_name)`
89+
* access any model class from any template (currently only supports sqlalchemy models)
8790

88-
- get_button(name)
89-
* create buttons in the cms and access from within templates
90-
91+
- `get_button(name)`
92+
* create buttons in the cms and access from within templates
9193

92-
- AppFactory class with many hooks into settings file (makes use of settings file similar to django)
93-
- settings like:
94-
- CONTEXT_PROCESSORS
95-
- TEMPLATE_FILTERS
96-
- URL_ROUTE_MODULES
97-
- INSTALLED_BLUEPRINTS etc..
94+
- AppFactory class with many hooks into settings file (makes use of settings file similar to django)
95+
- settings like:
96+
- CONTEXT_PROCESSORS
97+
- TEMPLATE_FILTERS
98+
- URL_ROUTE_MODULES
99+
- INSTALLED_BLUEPRINTS etc..
98100

99-
- new revamped url routing scheme, use a urls.py file in each blueprint to
100-
define the url routes for the blueprint. reference the blueprint and the url
101-
route module in the settings file to registar onto the app upon instantiation.
101+
- new revamped url routing scheme, use a urls.py file in each blueprint to
102+
define the url routes for the blueprint. reference the blueprint and the url
103+
route module in the settings file to registar onto the app upon instantiation.
102104

103-
define routes like this:
105+
define routes like this:
104106

105-
file: urls.py
106-
```python
107+
file: urls.py
108+
```python
107109
from blueprint import blueprint
108110
from .views import ViewName,SecondView
109111

@@ -114,17 +116,18 @@ _to see this in a real world example take a look at my other projects_ [Flask-Cm
114116
)
115117
]
116118
```
117-
it basicly is like using app.add_url_rule() method, you
118-
just dont have to add <code>view_func=ViewName.as_view(endpoint)</code> or at least the
119-
<code>view_func=</code> part.
119+
it basicly is like using `app.add_url_rule()` method, you
120+
just dont have to add `view_func=ViewName.as_view(endpoint)`
121+
or at least the `view_func=` part.
120122

121123

122-
- easily start a new project or extend an old one with the flaskxxl-manage.py command line helper tool
123-
- to start a project from scratch
124-
<kbd>$ flaskxxl-manage.py start-project</kbd>
124+
- easily start a new project or extend an old one
125+
with the flaskxxl-manage.py command line helper tool
126+
- to start a project from scratch
127+
`$ flaskxxl-manage.py start-project`
125128

126-
- to add to an existing project
127-
<kbd>$ flaskxxl-manage.py start-blueprint</kbd>
129+
- to add to an existing project
130+
`$ flaskxxl-manage.py start-blueprint`
128131

129132

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

0 commit comments

Comments
 (0)