title: Django 1.8.3 - model field validation with related object
body: <p>For the following set of models (Foo, Bar), you could impose a cross-validation rule like the one in the Bar.clean of the following code snippet up to django 1.7.</p>
  
  <p>The same snippet throws a <code>RelatedObjectDoesNotExist</code> error in django 1.8.3.</p>
  
  <p>What is the new and improved way of achieving the same result in django 1.8.3?</p>
  
  <p>(I've included the admin.py code just to show how these models are being used.)</p>
  
  <h1>models.py</h1>
  
  <pre><code>from django.db import models
  from django.core.exceptions import ValidationError
  
  class Foo(models.Model):
     name = models.CharField("Name", blank=True, max_length=300)
  
  class Bar(models.Model):
     name = models.CharField("Name", blank=True, max_length=300)
     foo = models.ForeignKey('Foo', verbose_name='Foo')
  
     def clean(self):
        if self.name + self.foo.name != 'FooBar':
           raise ValidationError('Concatenation should be FooBar.')
  </code></pre>
  
  <h1>admin.py</h1>
  
  <pre><code>from django.contrib import admin
  import models
  
  class BarInline(admin.TabularInline):
      model = models.Bar
  
  class FooAdmin(admin.ModelAdmin):
      model = models.Foo
      inlines = [BarInline,]
  
  site = admin.site
  site.register(models.Foo,FooAdmin)
  </code></pre>