title: Django AutoSlugField across inherited models
body: <p>I'm wondering if you can have slugs unique across inherited models?</p>
  
  <p>I have three models, one base and two that extend it.</p>
  
  <p>The base has a unique <code>AutoSlugField</code> that is generated from the <code>name</code> field.</p>
  
  <p>The slug is on the <code>BaseModel</code> however if I save a <code>Hamster</code> and an <code>Elderberry</code> both with the same name then I get an <code>IntegrityError</code>.</p>
  
  <p>Clearly this is because the uniqueness is not enforced at the Base level but at the subclass level.  Has anyone got a good solution for this?</p>
  
  <p><code>BaseModel</code> is not <code>abstract</code> and needs to stay that way as I'm using the <a href="http://pypi.python.org/pypi/django-model-utils/1.1.0" rel="nofollow">'django-model-utils'</a> InheritanceManager. </p>
  
  <p><em>setup</em></p>
  
  <pre><code>Django==1.4.3
  django-extensions==1.0.2
  django-autoslug==1.6.1
  </code></pre>
  
  <p><em>models.py</em></p>
  
  <pre><code>class BaseModel(models.Model):
      name = models.CharField(max_length=255)
      slug = AutoSlugField(populate_from='name', unique=True, db_index=True)
      # ... other fields
  
      objects = InheritanceManager()
  
  class HamsterModel(BaseModel):
      useful_info = models.CharField(max_length=128)
      # ... other fields
  
  class ElderberryModel(BaseModel):
      pointless_info = models.CharField(max_length=128)
      # ... other fields
  </code></pre>
  
  <p><em>console</em></p>
  
  <pre><code>&gt;&gt;&gt; h = HamsterModel()
  &gt;&gt;&gt; h.name = 'One'
  &gt;&gt;&gt; h.save()
  &gt;&gt;&gt; h.slug
  u'one'
  &gt;&gt;&gt; e = ElderberryModel()
  &gt;&gt;&gt; e.name = 'One'
  &gt;&gt;&gt; e.save()
  Traceback (most recent call last):
    File "&lt;input&gt;", line 1, in &lt;module&gt;
    File "/home/blah/.envs/vfaces/local/lib/python2.7/site-packages/django/db/models/base.py", line 463, in save
  
      self.save_base(using=using, force_insert=force_insert, force_update=force_update)
    File "/home/blah/.envs/blah/local/lib/python2.7/site-packages/django/db/models/base.py", line 506, in save
  _base
      self.save_base(cls=parent, origin=org, using=using)
    File "/home/blah/.envs/blah/local/lib/python2.7/site-packages/django/db/models/base.py", line 551, in save
  _base
      result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
    File "/home/blah/.envs/blah/local/lib/python2.7/site-packages/django/db/models/manager.py", line 203, in _
  insert
      return insert_query(self.model, objs, fields, **kwargs)
    File "/home/blah/.envs/blah/local/lib/python2.7/site-packages/django/db/models/query.py", line 1593, in in
  sert_query
      return query.get_compiler(using=using).execute_sql(return_id)
    File "/home/blah/.envs/blah/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 912,
   in execute_sql
      cursor.execute(sql, params)
    File "/home/blah/.envs/blah/local/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in exe
  cute
      return self.cursor.execute(sql, params)
    File "/home/blah/.envs/blah/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 114,
   in execute
      return self.cursor.execute(query, args)
    File "/home/blah/.envs/vfaces/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 201, in execute
      self.errorhandler(self, exc, value)
    File "/home/blah/.envs/blah/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in default
  errorhandler
      raise errorclass, errorvalue
  IntegrityError: (1062, "Duplicate entry 'one' for key 'slug'")
  </code></pre>