Changes between Initial Version and Version 1 of Ticket #31174


Ignore:
Timestamp:
Jan 16, 2020, 8:57:21 PM (5 years ago)
Author:
Jian Dai
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31174 – Description

    initial v1  
    44
    55I think it should be "height: inherit"
     6
     7* models.py
     8
     9{{{
     10from django.db import models
     11
     12
     13# Create your models here.
     14class Parent(models.Model):
     15    name = models.CharField(max_length=128, blank=True, null=True)
     16
     17
     18class Children(models.Model):
     19    name = models.CharField(max_length=128, blank=True, null=True)
     20    parent = models.ForeignKey(Parent, on_delete=models.CASCADE)
     21
     22}}}
     23
     24* admin.py
     25
     26{{{
     27from django.contrib import admin
     28
     29from . import models
     30
     31
     32# Register your models here.
     33
     34class ChildrenInline(admin.TabularInline):
     35    model = models.Children
     36
     37
     38@admin.register(models.Parent)
     39class ParentAdmin(admin.ModelAdmin):
     40    inlines = [ChildrenInline, ]
     41}}}
Back to Top