Skip to content

Commit 691cc5f

Browse files
committed
Fixed a bug with inline fk_name field. Added pydantic as dependency.
1 parent b612032 commit 691cc5f

8 files changed

Lines changed: 60 additions & 49 deletions

File tree

docs/index.html

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ <h4 class="title">FastAdmin</h4>
181181
<li class="nav-item">
182182
<a class="nav-link" href="#changelog">Changelog</a>
183183
<ul class="nav flex-column">
184+
<li class="nav-item">
185+
<a class="nav-link" href="#v0_1_24">v0.1.24</a>
186+
</li>
184187
<li class="nav-item">
185188
<a class="nav-link" href="#v0_1_23">v0.1.23</a>
186189
</li>
@@ -209,7 +212,7 @@ <h1>Documentation</h1>
209212
<div class="row">
210213
<div class="col-sm-6 col-lg-4">
211214
<ul class="list-unstyled">
212-
<li><strong>Version:</strong> 1.1.23</li>
215+
<li><strong>Version:</strong> 1.1.24</li>
213216
<li>
214217
<strong>Author:</strong>
215218
<a href="mailto:[email protected]" target="_blank"
@@ -224,7 +227,7 @@ <h1>Documentation</h1>
224227
<strong class="font-weight-700">Created:</strong> 7 March,
225228
2023
226229
</li>
227-
<li><strong>Updated:</strong> 16 March, 2023</li>
230+
<li><strong>Updated:</strong> 25 March, 2023</li>
228231
</ul>
229232
</div>
230233
</div>
@@ -1257,7 +1260,7 @@ <h3>InlineModelAdmin options</h3>
12571260
# The name of the foreign key on the model.
12581261
# In most cases this will be dealt with automatically, but fk_name must be specified explicitly
12591262
# if there are more than one foreign key to the same parent model.
1260-
fk_name: str
1263+
fk_name: str | None = None
12611264

12621265
# This controls the maximum number of forms to show in the inline.
12631266
# This doesn't directly correlate to the number of objects, but can if the value is small enough.
@@ -1320,7 +1323,6 @@ <h3>ForeignKey fields</h3>
13201323

13211324
class FriendshipInline(TortoiseInlineModelAdmin):
13221325
model = Friendship
1323-
fk_name = "to_person"
13241326

13251327
class PersonAdmin(TortoiseModelAdmin):
13261328
inlines = (
@@ -1353,6 +1355,18 @@ <h2>Changelog</h2>
13531355
<hr class="small-divider" />
13541356
<!-- <p class="alert alert-info mb-5"> For Future Updates Follow Us <a target="_blank" href="http://themeforest.net/user/harnishdesign?ref=HarnishDesign">@themeforest</a> / <a target="_blank" href="http://facebook.com/harnishdesign">@facebook</a> / <a target="_blank" href="http://twitter.com/harnishdesign">@twitter</a> / <a target="_blank" href="https://dribbble.com/harnishdesign">@Dribbble</a></p> -->
13551357

1358+
<h3 id="v0_1_24">
1359+
Version 0.1.24
1360+
<small class="text-muted">(25 March, 2024)</small>
1361+
</h3>
1362+
<ul class="changelog">
1363+
<li>
1364+
Fixed a bug with inline fk_name field. Added pydantic as
1365+
dependency.
1366+
</li>
1367+
</ul>
1368+
<hr class="small-divider" />
1369+
13561370
<h3 id="v0_1_23">
13571371
Version 0.1.23
13581372
<small class="text-muted">(16 March, 2023)</small>

examples/djangoorm/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def authenticate(self, username, password):
8989
class DjangoEventInlineModelAdmin(DjangoInlineModelAdmin):
9090
model = Event
9191
model_name_prefix = "django"
92-
fk_name = "tournament"
9392

9493

9594
@register(Tournament)

examples/ponyorm/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def authenticate(self, username, password):
111111
class PonyORMEventInlineModelAdmin(PonyORMInlineModelAdmin):
112112
model = Event
113113
model_name_prefix = "ponyorm"
114-
fk_name = "tournament"
115114

116115

117116
@register(Tournament)

examples/sqlalchemy/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ class SqlAlchemyEventInlineModelAdmin(SqlAlchemyInlineModelAdmin):
130130
model_name_prefix = "sqlalchemy"
131131

132132
model = Event
133-
fk_name = "tournament"
134133

135134

136135
# NOTE: provide sqlalchemy_sessionmaker as second parameter for your usage

examples/tortoiseorm/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ async def authenticate(self, username, password):
9191
class TortoiseORMEventInlineModelAdmin(TortoiseInlineModelAdmin):
9292
model = Event
9393
model_name_prefix = "tortoiseorm"
94-
fk_name = "tournament"
9594

9695

9796
@register(Tournament)

fastadmin/models/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ class InlineModelAdmin(BaseModelAdmin):
465465
# The name of the foreign key on the model.
466466
# In most cases this will be dealt with automatically, but fk_name must be specified explicitly
467467
# if there are more than one foreign key to the same parent model.
468-
fk_name: str
468+
fk_name: str | None = None
469469

470470
# This controls the maximum number of forms to show in the inline.
471471
# This doesn’t directly correlate to the number of objects, but can if the value is small enough.

poetry.lock

Lines changed: 39 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "fastadmin"
3-
version = "0.1.23"
3+
version = "0.1.24"
44
description = ""
55
authors = ["Seva D <[email protected]>"]
66
license = "MIT"
@@ -29,6 +29,7 @@ jinja2 = "^3.1.2"
2929
pyjwt = "^2.6.0"
3030
python-dotenv = "^1.0.0"
3131
asgiref = "^3.6.0"
32+
pydantic = "^1.10.7"
3233

3334
fastapi = { version = "^0.92.0", optional = true }
3435
flask = { version = "^2.2.3", optional = true }

0 commit comments

Comments
 (0)