djangosnippets.org: Latest snippets tagged with '1.0'http://djangosnippets.org/tags/10/2008-09-10T18:18:04.587808-05:00Bind Administration
2008-09-10T18:18:04.587808-05:00ashcrowhttp://djangosnippets.org/snippets/1043/<p>Binds $Model to $ModelAdmin without having to specify each binding manually. The ModelAdmins <strong>must</strong> have the same name as the model (as well as same case) with Admin appended.</p>
<p>Example:
from django.db import models</p>
<pre><code>class SomeModel(models.Model):
name = models.CharField(max_length=255)
class AnotherModel(models.Model):
name = models.CharField(max_length=255)
# bind administration
bind_administration('myproject.myapp.models', 'myproject.myapp.admin')
</code></pre>
Freely redistributable