I want to generate several related Model objects at once that are linked in the model view via stacked.Inline
. I can create the objects in the admin view. However, when I go to the list view of the pipeline model I get:
'Pipeline' object has no attribute 'args'
I have pretty much the same setup working with other models, so I am not sure why it is not working in this case. It complains that 'Pipeline' has no args
model.py:
class Pipeline(models.Model):
config= models.OneToOneField('Config', on_delete=models.SET_NULL, null=True, parent_link=True)
class Config(models.Model):
args = models.CharField(max_length=256, null=True, default='-p -q -x -u -l -m -r')
pipeline = models.OneToOneField('Pipeline', on_delete=models.CASCADE, null=True, parent_link=False)
admin.py:
class ConfigInline(admin.StackedInline):
model = Config
class PipelineAdmin(admin.ModelAdmin):
inlines = [ConfigInline]
I did the database migrations.