Ticket #9539: models.py

File models.py, 613 bytes (added by nbstrite, 6 years ago)

this models.py file will recreate the IE popup issue in the django admin.

Line 
1from django.db import models
2from django.contrib import admin
3
4class Person(models.Model):
5    name = models.CharField(max_length=10)
6
7class Relationship(models.Model):
8    parent = models.ForeignKey(Person, related_name='parents')
9    child = models.ForeignKey(Person, related_name='children')
10
11class RelationshipInline(admin.TabularInline):
12    model = Relationship
13    fk_name = 'parent'
14    raw_id_fields = ['child']
15
16class PersonAdmin(admin.ModelAdmin):
17    fields = ['name']
18    inlines = [RelationshipInline]
19
20admin.site.register(Person, PersonAdmin)
21admin.site.register(Relationship)
Back to Top