Skip to content

Commit 8fb42bb

Browse files
authored
Merge pull request #16 from jowilf/release/0.2.1
✨ Release 0.2.1
2 parents 60a1762 + c28688b commit 8fb42bb

File tree

12 files changed

+58
-41
lines changed

12 files changed

+58
-41
lines changed

CHANGELOG.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,22 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
66
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.1] - 2022-09-19
9+
10+
---
11+
12+
### Fixed
13+
14+
* Fix SearchBuilder not working with dates (SQLAlchemy) by @jowilf in https://github.com/jowilf/starlette-admin/pull/15
15+
16+
**Full Changelog**: https://github.com/jowilf/starlette-admin/compare/0.2.0...0.2.1
17+
18+
819
## [0.2.0] - 2022-09-14
920

1021
---
1122

12-
### Added
23+
### Changed
1324

1425
* Date & Time input now use Flatpickr by @jowilf in https://github.com/jowilf/starlette-admin/pull/10
1526

README.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ SQLAlchemy integration
8686
from sqlalchemy import Column, Integer, String, create_engine
8787
from sqlalchemy.ext.declarative import declarative_base
8888
from starlette.applications import Starlette
89+
8990
from starlette_admin.contrib.sqla import Admin, ModelView
9091

9192
Base = declarative_base()
92-
engine = create_engine(
93-
"sqlite:///test.db", connect_args={"check_same_thread": False}
94-
)
93+
engine = create_engine("sqlite:///test.db", connect_args={"check_same_thread": False})
9594

9695

9796
class Post(Base):
@@ -101,15 +100,15 @@ class Post(Base):
101100
title = Column(String)
102101

103102

104-
class PostAdmin(ModelView, model=Post):
103+
class PostView(ModelView, model=Post):
105104
pass
106105

107106

108107
Base.metadata.create_all(engine)
109108
app = Starlette()
110109

111110
admin = Admin(engine)
112-
admin.add_view(PostAdmin)
111+
admin.add_view(PostView)
113112
admin.mount_to(app)
114113
```
115114

@@ -127,14 +126,14 @@ class Post(mongoengine.Document):
127126
title = mongoengine.StringField(min_length=3, required=True)
128127

129128

130-
class PostAdmin(ModelView, document=Post):
129+
class PostView(ModelView, document=Post):
131130
pass
132131

133132

134133
app = Starlette()
135134

136135
admin = Admin()
137-
admin.add_view(PostAdmin)
136+
admin.add_view(PostView)
138137
admin.mount_to(app)
139138
```
140139
Access your admin interface in your browser at http://localhost:8000/admin

docs/changelog.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
66
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.1] - 2022-09-19
9+
10+
---
11+
12+
### Fixed
13+
14+
* Fix SearchBuilder not working with dates (SQLAlchemy) in [#15](https://github.com/jowilf/starlette-admin/pull/15)
15+
16+
817
## [0.2.0] - 2022-09-14
918

1019
---
1120

12-
### Added
21+
### Changed
1322

1423
* Date & Time input now use Flatpickr in [#10](https://github.com/jowilf/starlette-admin/pull/10)
1524

docs/index.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,11 @@ SQLAlchemy integration
8686
from sqlalchemy import Column, Integer, String, create_engine
8787
from sqlalchemy.ext.declarative import declarative_base
8888
from starlette.applications import Starlette
89+
8990
from starlette_admin.contrib.sqla import Admin, ModelView
9091

9192
Base = declarative_base()
92-
engine = create_engine(
93-
"sqlite:///test.db", connect_args={"check_same_thread": False}
94-
)
93+
engine = create_engine("sqlite:///test.db", connect_args={"check_same_thread": False})
9594

9695

9796
class Post(Base):
@@ -101,15 +100,15 @@ class Post(Base):
101100
title = Column(String)
102101

103102

104-
class PostAdmin(ModelView, model=Post):
103+
class PostView(ModelView, model=Post):
105104
pass
106105

107106

108107
Base.metadata.create_all(engine)
109108
app = Starlette()
110109

111110
admin = Admin(engine)
112-
admin.add_view(PostAdmin)
111+
admin.add_view(PostView)
113112
admin.mount_to(app)
114113
```
115114

@@ -127,14 +126,14 @@ class Post(mongoengine.Document):
127126
title = mongoengine.StringField(min_length=3, required=True)
128127

129128

130-
class PostAdmin(ModelView, document=Post):
129+
class PostView(ModelView, document=Post):
131130
pass
132131

133132

134133
app = Starlette()
135134

136135
admin = Admin()
137-
admin.add_view(PostAdmin)
136+
admin.add_view(PostView)
138137
admin.mount_to(app)
139138
```
140139
Access your admin interface in your browser at http://localhost:8000/admin

docs/tutorial/configurations/modelview.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ and your admin views like this
5050
from starlette_admin.contrib.sqla import Admin, ModelView
5151

5252

53-
class PostAdmin(ModelView, model=Post):
53+
class PostView(ModelView, model=Post):
5454
pass
5555

5656

5757
app = Starlette()
5858

5959
admin = Admin(engine)
60-
admin.add_view(PostAdmin)
60+
admin.add_view(PostView)
6161
admin.mount_to(app)
6262
```
6363
=== "MongoEngine"
@@ -67,14 +67,14 @@ and your admin views like this
6767
from starlette_admin.contrib.mongoengine import Admin, ModelView
6868

6969

70-
class PostAdmin(ModelView, document=Post):
70+
class PostView(ModelView, document=Post):
7171
pass
7272

7373

7474
app = Starlette()
7575

7676
admin = Admin()
77-
admin.add_view(PostAdmin)
77+
admin.add_view(PostView)
7878
admin.mount_to(app)
7979
```
8080
## Metadata
@@ -107,14 +107,14 @@ or give the attribute, and it will automatically convert into StarletteAdmin Fie
107107
from .sqla_model import Post, engine
108108

109109

110-
class PostAdmin(ModelView, model=Post):
110+
class PostView(ModelView, model=Post):
111111
fields = ["id", "title", Post.content, TagsField("tags", label="Tags")]
112112

113113

114114
app = Starlette()
115115

116116
admin = Admin(engine)
117-
admin.add_view(PostAdmin)
117+
admin.add_view(PostView)
118118
admin.mount_to(app)
119119
```
120120

@@ -128,14 +128,14 @@ or give the attribute, and it will automatically convert into StarletteAdmin Fie
128128
from .mongoengine_model import Post
129129

130130

131-
class PostAdmin(ModelView, document=Post):
131+
class PostView(ModelView, document=Post):
132132
fields = ["id", Post.title, TextAreaField("content"), "tags"]
133133

134134

135135
app = Starlette()
136136

137137
admin = Admin()
138-
admin.add_view(PostAdmin)
138+
admin.add_view(PostView)
139139
admin.mount_to(app)
140140

141141
```
@@ -154,7 +154,7 @@ The options are:
154154

155155
!!! Example
156156
```Python
157-
class PostAdmin(ModelView, model=Post):
157+
class PostView(ModelView, model=Post):
158158
exclude_fields_from_list = [Post.content]
159159
```
160160

@@ -167,7 +167,7 @@ Two options are available to specify which fields can be sorted or searched.
167167

168168
!!! Example
169169
```Python
170-
class PostAdmin(ModelView, model=Post):
170+
class PostView(ModelView, model=Post):
171171
sortable_fields = [Post.id, Post.title]
172172
searchable_fields = [Post.id, Post.title, Post.tags]
173173
```
@@ -182,7 +182,7 @@ exports are `['csv', 'excel', 'pdf', 'print']`. All of them are activated by def
182182

183183
!!! Example
184184
```Python
185-
class PostAdmin(ModelView, model=Post):
185+
class PostView(ModelView, model=Post):
186186
export_fields = [Post.id, Post.content, Post.tags]
187187
export_types = ["csv", "excel"]
188188
```
@@ -199,7 +199,7 @@ The pagination options in the list page can be configured. The available options
199199

200200
!!! Example
201201
```Python
202-
class PostAdmin(ModelView, model=Post):
202+
class PostView(ModelView, model=Post):
203203
page_size = 5
204204
page_size_options = [5, 10, 25, 50, -1]
205205
```
@@ -214,6 +214,6 @@ The template files are built using Jinja2 and can be completely overridden in th
214214

215215
!!! Example
216216
```Python
217-
class PostAdmin(ModelView, model=Post):
217+
class PostView(ModelView, model=Post):
218218
detail_template = "post_detail.html"
219219
```

docs_src/index/mongoengine_model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ class Post(mongoengine.Document):
1010
title = mongoengine.StringField(min_length=3, required=True)
1111

1212

13-
class PostAdmin(ModelView, document=Post):
13+
class PostView(ModelView, document=Post):
1414
pass
1515

1616

1717
app = Starlette()
1818

1919
admin = Admin()
20-
admin.add_view(PostAdmin)
20+
admin.add_view(PostView)
2121
admin.mount_to(app)

docs_src/index/sqla_model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ class Post(Base):
1414
title = Column(String)
1515

1616

17-
class PostAdmin(ModelView, model=Post):
17+
class PostView(ModelView, model=Post):
1818
pass
1919

2020

2121
Base.metadata.create_all(engine)
2222
app = Starlette()
2323

2424
admin = Admin(engine)
25-
admin.add_view(PostAdmin)
25+
admin.add_view(PostView)
2626
admin.mount_to(app)

docs_src/tutorial/configurations/modelview/mongoengine_admin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .mongoengine_model import Post
66

77

8-
class PostAdmin(ModelView, document=Post):
8+
class PostView(ModelView, document=Post):
99
fields = ["id", Post.title, TextAreaField("content"), "tags"]
1010
exclude_fields_from_list = [Post.content]
1111
searchable_fields = [Post.id, Post.title]
@@ -20,5 +20,5 @@ class PostAdmin(ModelView, document=Post):
2020
app = Starlette()
2121

2222
admin = Admin()
23-
admin.add_view(PostAdmin)
23+
admin.add_view(PostView)
2424
admin.mount_to(app)

docs_src/tutorial/configurations/modelview/sqla_admin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
from .sqla_model import Post, engine
66

77

8-
class PostAdmin(ModelView, model=Post):
8+
class PostView(ModelView, model=Post):
99
fields = ["id", "title", Post.content, TagsField("tags", label="Tags")]
1010

1111

1212
app = Starlette()
1313

1414
admin = Admin(engine)
15-
admin.add_view(PostAdmin)
15+
admin.add_view(PostView)
1616
admin.mount_to(app)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "starlette-admin"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
description = "Simple and extensible admin interface framework for Starlette/FastApi"
55
authors = ["Jocelin Hounon <hounonj@gmail.com>"]
66
license = "MIT"

starlette_admin/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.2.0"
1+
__version__ = "0.2.1"
22

33
from starlette_admin.base import BaseAdmin
44
from starlette_admin.fields import *

starlette_admin/contrib/sqla/admin.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,14 @@ def mount_to(self, app: Starlette) -> None:
4545

4646

4747
def _serve_file(request: Request) -> Response:
48-
from libcloud.storage.drivers.local import LocalStorageDriver
4948
from libcloud.storage.types import ObjectDoesNotExistError
5049
from sqlalchemy_file.storage import StorageManager
5150

5251
try:
5352
storage = request.path_params.get("storage")
5453
file_id = request.path_params.get("file_id")
5554
file = StorageManager.get_file(f"{storage}/{file_id}")
56-
if isinstance(file.object.driver, LocalStorageDriver):
55+
if file.object.driver.name == "Local Storage":
5756
"""If file is stored in local storage, just return a
5857
FileResponse with the fill full path."""
5958
return FileResponse(

0 commit comments

Comments
 (0)