You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a shortcut for admin inlines - pick up when inlines contains a bare Model, or a model class name, and create a basic inline for it.
I'm going to say inline options are out of scope. I can think of lots of ways to implement it, but the main goals of this project are to streamline the simplest option and let you knock out prototypes quickly and cleanly by reducing boilerplate. Trying to support inline options in a decorator would make it more complicated to use and implement, and make the admin decorator harder to read.
In that spirit, I think it'll make sense to use a StackedInline with no option to override - it scales better than Tabular, so is a better default. If someone wants a Tabular they (a) know about it, and (b) they can write it out manually, it's only 4 lines.
I did wonder if adding this could confuse newcomers, but there's already a lot of special stuff in nanodjango, and convert will show them the correct way.
class SubThing(models.Model):
thing = models.ForeignKey("Thing")
name = models.CharField(max_length=255)
@app.admin(inlines=[SubThing, "OtherSubThing"])
class Thing(models.Model):
name = models.CharField(max_length=255)
class OtherSubThing(models.Model):
thing = models.ForeignKey("Thing")
name = models.CharField(max_length=255)
Inlines will be defined and converted as:
class SubThingInline(admin.StackedInline):
model = SubThing
extra = 1
The text was updated successfully, but these errors were encountered:
Add a shortcut for admin inlines - pick up when
inlines
contains a bareModel
, or a model class name, and create a basic inline for it.I'm going to say inline options are out of scope. I can think of lots of ways to implement it, but the main goals of this project are to streamline the simplest option and let you knock out prototypes quickly and cleanly by reducing boilerplate. Trying to support inline options in a decorator would make it more complicated to use and implement, and make the admin decorator harder to read.
In that spirit, I think it'll make sense to use a
StackedInline
with no option to override - it scales better than Tabular, so is a better default. If someone wants a Tabular they (a) know about it, and (b) they can write it out manually, it's only 4 lines.I did wonder if adding this could confuse newcomers, but there's already a lot of special stuff in nanodjango, and
convert
will show them the correct way.Inlines will be defined and converted as:
The text was updated successfully, but these errors were encountered: