alright, I´ve been trying to implement the most basic functionality
and here´s what I came up with. Please note that this is just a draft
in order to explain what I´ve been talking about. It works ok, but it
probably can be done better.

thanks,
patrick

– SETTINGS.PY

    ADMIN_COLLECTIONS = [
        {
            'name': 'Main Content',
            'classes': 'highlight',
            'show_apps': True,
            'apps': ['movies', 'stars', 'trailer']
        },
        {
            'name': 'User Management',
            'show_apps': False,
            'apps': ['auth', 'grappelli']
        }
    ]

– SITES.PY

        for collection in ADMIN_COLLECTIONS:
            app_list = []
            for app in collection['apps']:
                app_list.append(app_dict[app])
            collection['app_list'] = app_list

        context = {
            'title': _('Site administration'),
            'app_list': app_list,
            'collection_list': ADMIN_COLLECTIONS,
            'root_path': self.root_path,
        }

– INDEX.HTML:

    {% for collection in collection_list %}
        <div class="module">
        <table summary="{% blocktrans with app.name as name %}Models
available in the {{ name }} application.{% endblocktrans %}">
        <caption><a href="{{ app.app_url }}" class="section">{%
blocktrans with collection.name as name %}{{ name }}{% endblocktrans %}
</a></caption>
        {% for app in collection.app_list %}
            {% if collection.show_apps %}
                <tr>
                    <th>{{ app.name }}</th>
                </tr>
            {% endif %}
            {% for model in app.models %}
                <tr>
                {% if model.perms.change %}
                    <th scope="row"><a href="{{ model.admin_url }}">
{{ model.name }}</a></th>
                {% else %}
                    <th scope="row">{{ model.name }}</th>
                {% endif %}

                {% if model.perms.add %}
                    <td><a href="{{ model.admin_url }}add/"
class="addlink">{% trans 'Add' %}</a></td>
                {% else %}
                    <td>&nbsp;</td>
                {% endif %}

                {% if model.perms.change %}
                    <td><a href="{{ model.admin_url }}"
class="changelink">{% trans 'Change' %}</a></td>
                {% else %}
                    <td>&nbsp;</td>
                {% endif %}
                </tr>
            {% endfor %}
        {% endfor %}
        </table>
        </div>
    {% endfor %}


On 4 Sep., 15:52, patrickk <patr...@vonautomatisch.at> wrote:
> On 4 Sep., 15:30, Russell Keith-Magee <freakboy3...@gmail.com> wrote:
>
>
>
> > On Fri, Sep 4, 2009 at 8:37 PM, patrickk<patr...@vonautomatisch.at> wrote:
>
> > > fair enough.
>
> > > I don´t have a problem with just seperating INSTALLED_APPS from
> > > ADMIN_APPS within the settings-file. I just thought another admin-file
> > > is nicer (but that´s not the key argument of my proposal).
>
> > > INSTALLED_APPS = (
> > >    'django.contrib.auth',
> > >    'django.contrib.contenttypes',
> > >    'django.contrib.sessions',
> > >    'django.contrib.sites',
> > >    'django.contrib.admin',
> > >    'movies',
> > >    'stars',
> > >    'cinemas',
> > >    'games',
> > >    'promos',
> > >    'polls',
> > >    'festivals',
> > >    'trailer',
> > >    'user',
> > >    'registration',
> > >    'voting',
> > >    'django.contrib.comments',
> > >    'custom_tags',
> > >    'mediadata',
> > >    'stats',
> > >    'newsletter',
> > > )
>
> > > ADMIN_APPS = (
> > >    (_('User Management'), {
> > >        'apps': ('django.contrib.auth', 'registration', 'user',)
> > >    }),
> > >    (_('Main Content'), {
> > >        'apps': ('movies', 'stars', 'cinemas', 'festivals',
> > > 'trailer',)
> > >    }),
> > >    (_('Games'), {
> > >        'apps': ('games', 'promos', 'polls',)
> > >    }),
> > >    (_('Voting/Comments'), {
> > >        'classes': ('collapsed',),
> > >        'apps': ('voting', 'comments',)
> > >    }),
> > >    (_('Extras'), {
> > >        'classes': ('collapsed',),
> > >        'apps': ('mediadata', 'stats', 'newsletter',)
> > >    }),
> > > )
>
> > > if you need more details, please let me know.
>
> > Well, for starters, some clarification would help.
>
> > Are we talking about an alternate organization for models in the admin
> > so you're not bound to app-based categories, or are we talking about
> > some higher level organization?
>
> > Your example puts django.contrib.auth into the 'User Management'
> > collection - is that indicating that all the apps in auth should be
> > shown in "User Management", or that there is a "User Management"
> > super-group that contains the auth group that contains the auth
> > applications?
>
> I´d personally replace the group "Auth" with the group "User
> Management".
> the reason is that "Auth" is an application (something which is - IMHO
> - irrelevant for an editor to know/see).
>
> that said, I can also think of putting the group "Auth" within the
> super-group "User Management". however, I don´t think that´s necessary
> and makes the admin index page more complicated.
>
> > Your language is particularly confusing in this regard - it isn't
> > clear when you say 'apps' if you actually mean 'models'.
>
> sorry. trying to concentrate on the right terms a bit more.
>
> > Secondly, why would this be included in settings.py (or a top level
> > admin.py for that matter)? Admin registrations are currently
> > distributed across the apps in the entire project - why is there a
> > need to pull this into a single location?
>
> the only reason I can think of is to change the order of collections
> (see below).
>
> > Couldn't this be achieved by registering a model with a particular
> > "app collection" (with the default being the collection formed by the
> > app containing the model)?
>
> from my point of view this leads to the problem of sorting the "app
> collections". how would you achieve that? e.g., if I want "User
> Management" to be shown as the first collection (independent of the
> collections name)?
>
> moreover, it´d be nice (at least from a theoretical point of view) to
> assign an app (or model) to more than one collection.
>
> regards,
> patrick
>
> > i.e., to create a "User Management" group, and put "user" in it:
>
> > class UserManagement(AdminGroup):
> >     label = "UserManagement"
>
> > class UserAdmin(ModelAdmin):
> >    ...
> > class UserAdmin(ModelAdmin):
> >    ...
>
> > admin.site.register(User, UserAdmin, group=UserManagement)
>
> > Yours,
> > Russ Magee %-)
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to