title: django version 1.8 'ForeignKey' object has no attribute
body: <p>In my models.py I have 3 classes </p>
  
  <p>Project
  Finding
  FindingType</p>
  
  <p>Relationship between entities:</p>
  
  <p>Project can have 0 to  N Finding. Each Finding has one Finding type.</p>
  
  <pre><code>class Project(models.Model):
  completed_date = models.DateField(blank=True, null=True)
  .. and some other attributes
  
  class RA_Finding_type(models.Model):
  finding_title = models.CharField(max_length=40)
  finding_desc = models.TextField()
  remediation_desc = models.TextField()
  trc_control_number = models.TextField()
  display = models.BooleanField(blank=True)
  
  class RA_Finding(models.Model):
  project = models.ForeignKey(Project)
  if (not project.completed_date):      # Error here.
     finding_type = models.ForeignKey(RA_Finding_type, limit_choices_to={'display': True},verbose_name='Weakness Type')
  else:
     finding_type = models.ForeignKey(RA_Finding_type, limit_choices_to={'display': False},verbose_name='Weakness Type')
  </code></pre>
  
  <p>... other attributes</p>
  
  <p>In admin.py</p>
  
  <pre><code>class ProjectAdmin(admin.ModelAdmin):
   form = ProjectAdminForm  # For user sort...
  
   readonly_fields = ('id', ... others)
  
   inlines = [
              FindingInline,.. other inlines
  
             ]
  
  class FindingInline(admin.StackedInline):
   model = RA_Finding
   def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
       field = super(FindingInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
       if db_field.name == 'project':
           if request._obj_ is not None:
               field.queryset = field.queryset.filter(id__exact = request._obj_.pk)
           else:
               field.queryset = field.queryset.none()
       return field
  
   extra = 1
  
   fieldsets = (
       (None, {
          'fields': ('finding_type',
                    ... other fields
                    )
       })),
  </code></pre>
  
  <p>I want to populate finding_type attribute based on completed date.  This is primary for legacy data. Requirement is - for projects with completed date,  display all the finding types else only display finding type where display is set to true.  When I try to do this, I get an error -  'ForeignKey' object has no attribute.  Is there a way to achieve this in Django?  Appreciate all help.</p>