title: In the Django admin is it possible to separate models into sub-models based on groups?
body: <p>I think this is easiest to understand as an example:</p>
  
  <p>I have models <code>Image</code> and <code>ImageType</code>, where and image has exactly one type. The parameters in <code>ImageType</code> would regulate image size, thumbnail size, etc., as photo gallery images might display differently from, say, profile pictures.</p>
  
  <p>I want profile images and gallery images to appear as separate models in the Django admin site. One option is to do something like this:</p>
  
  <pre><code>class ProfileImage (Image):
      pass
  
  class GalleryImage (Image):
      pass
  
  class ProfileImageAdmin (ImageAdmin):
      def queryset(self, request):
          qs = super(MyModelAdmin, self).queryset(request)
          return qs.filter(type='profile')
  
  class GalleryImageAdmin (ImageAdmin):
      def queryset(self, request):
          qs = super(MyModelAdmin, self).queryset(request)
          return qs.filter(type='gallery')
  
  admin.site.register(ProfileImage, ProfileImageAdmin)
  admin.site.register(GalleryImage, GalleryImageAdmin)
  </code></pre>
  
  <p>But besides having redundant code, that completely defeats the purpose of having a database to organize these in the first place. Another option is to lose my <code>Image</code> and <code>ImageType</code> models and create separate almost-identical tables for each type (i.e. <code>ProfileImage</code> and <code>GalleryImage</code>), but that is even worse, since that would require users to have access to the config files, which to my mind nearly defeats the purpose of a CMS.</p>
  
  <p>Is there any way I can do something like this?</p>
  
  <pre><code>admin.site.register(Image, ImageAdmin, group_by='type')
  </code></pre>
  
  <p>Alternatively, if this is impossible, does anybody have any suggestions for other ways I could tackle this? (For example, is there a way in python to dynamically create classes based on the database?)</p>
  
  <p>Cheers!
  Matt</p>