title: Django: AttributeError: type object 'MyAppConfig' has no attribute 'rpartition'
body: <p>I am trying to add <code>view_amodel</code> permission to my models. I decided to add the permission after migration. So I made following approach.</p>
  
  <p>At an_app/<strong>init</strong>.py</p>
  
  <pre><code>from an_app.apps import MyAppConfig
  default_app_config = MyAppConfig
  </code></pre>
  
  <p>At an_app/apps.py</p>
  
  <pre><code>from django.apps import AppConfig
  from django.db.models.signals import post_migrate
  from django.contrib.contenttypes.models import ContentType
  from django.contrib.auth.models import Permission
  
  def add_view_permissions(sender, **kwargs):
      """
      This syncdb hooks takes care of adding a view permission too all our
      content types.
      """
      # for each of our content types
      for content_type in ContentType.objects.all():
          # build our permission slug
          codename = "view_%s" % content_type.model
  
          # if it doesn't exist..
          if not Permission.objects.filter(content_type=content_type, codename=codename):
              # add it
              Permission.objects.create(content_type=content_type,
                                        codename=codename,
                                        name="Can view %s" % content_type.name)
              print "Added view permission for %s" % content_type.name
  
  
  class MyAppConfig(AppConfig):
      def ready(self):
          post_migrate.connect(add_view_permissions, sender=self)
  </code></pre>
  
  <p>When I do <code>python manage.py migrate</code>, I get following error,</p>
  
  <p><code>AttributeError: type object 'MyAppConfig' has no attribute 'rpartition'
  </code></p>
  
  <p>How to solve it.</p>