title: Django: access the parent instance from the Inline model admin
body: <p>How can I access the parent instance from the inline model admin?</p>
  
  <p>My goal is to override the <code>has_add_permission</code> function based on the status of the parent instance. I don't want to allow to add a child if the status of the parent is different than 1.</p>
  
  <pre><code>class ChildInline(admin.TabularInline):
      model = Child
      form = ChildForm
  
      fields = (
          ...
      )
      extra = 0
  
      def has_add_permission(self, request):
          # Return True only if the parent has status == 1
          # How to get to the parent instance?
          #return True
  
  class ParentAdmin(admin.ModelAdmin):
      inlines = [ChildInline,]
  </code></pre>