Closed hdknr closed 6 years ago
models.py:
class StatusPerm(models.Model): status = models.ForeignKey( Status, related_name='perm_set', on_delete=models.CASCADE) status_from = models.ForeignKey( Status, related_name='permfrom_set', on_delete=models.CASCADE, null=True, blank=True, default=None) perm = models.ForeignKey( Permission, on_delete=models.CASCADE, )
admin.py:
class StatusPermInline(admin.TabularInline): model = models.StatusPerm exclude = [] extra = 0
fk_name を定義する
fk_name
class StatusPermInline(admin.TabularInline): model = models.StatusPerm exclude = [] extra = 0 fk_name = 'status'
models.py:
admin.py: