from django.contrib import admin

from .models import Person, Residence, RelationshipType, Relationship

admin.site.register(Person)
admin.site.register(Residence)
admin.site.register(RelationshipType)
admin.site.register(Relationship)


from django.contrib import admin

from .models import Person, Residence, RelationshipType, Relationship


class ResidenceInline(admin.TabularInline):
    '''Inline class for Residence'''
    model = Residence


class PersonAdmin(admin.ModelAdmin):
    inlines = [
        ResidenceInline
    ]


admin.site.register(Person, PersonAdmin)
admin.site.register(RelationshipType)
admin.site.register(Relationship)

Add residence as an inline to person/people
Add residence as an inline to person/people

  from django.contrib import admin
  
  from .models import Person, Residence, RelationshipType, Relationship
  
+ 
+ class ResidenceInline(admin.TabularInline):
+     '''Inline class for Residence'''
+     model = Residence
+ 
+ 
+ class PersonAdmin(admin.ModelAdmin):
+     inlines = [
+         ResidenceInline
+     ]
+ 
+ 
- admin.site.register(Person)
+ admin.site.register(Person, PersonAdmin)
- admin.site.register(Residence)
  admin.site.register(RelationshipType)
  admin.site.register(Relationship)
  
- 
Add residence as an inline to person/people
## Code Before:
from django.contrib import admin

from .models import Person, Residence, RelationshipType, Relationship

admin.site.register(Person)
admin.site.register(Residence)
admin.site.register(RelationshipType)
admin.site.register(Relationship)


## Instruction:
Add residence as an inline to person/people
## Code After:
from django.contrib import admin

from .models import Person, Residence, RelationshipType, Relationship


class ResidenceInline(admin.TabularInline):
    '''Inline class for Residence'''
    model = Residence


class PersonAdmin(admin.ModelAdmin):
    inlines = [
        ResidenceInline
    ]


admin.site.register(Person, PersonAdmin)
admin.site.register(RelationshipType)
admin.site.register(Relationship)
