Dear Malcom,

thanks for your answer, but as I wrote in my first post altering
templates is not a satisfying solution for me. By altering templates I
have to define all permissions by hand. I thought it must be possible
to define permission - as for models - in the table
auth_permission...
By the way this had the advantage that people who have no permission
on a view don't see the link for that view on the admin interface...
If I add a view to admin by altering template every user will see the
link and if no permission is given the user will see a 'Not-Allowed-To-
See-Site'. I think this is frustrating for users. If I don't want that
I will have to define a lot of 'if user has permission then he can see
a link, else not' statements.

I hope you understand what's my problem

Greetz Robert

On 16 Feb., 00:09, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Sun, 2009-02-15 at 11:06 -0800, Robert wrote:
> > Hi,
>
> > how can I add views to the admin interface that
> > 1. they are also so 'well-integrated' in the admin interface like
> > models
> > 2. I can also define permissions for them like for a model
>
> Adding views to the admin is easy, since a view is just the target of a
> URL. So alter the admin template that you want to have the new link
> appear on. You don't have to modify the source, just create an
> overriding template in your project.
>
> If you use the filesystem loader to load the template (that is, set up a
> directory using TEMPLATE_DIRS), and if you haven't changed the default
> order of the TEMPLATE_LOADERS setting, any templates in TEMPLATE_DIRS
> will be loaded before app-specific templates. So you create, e.g,
> admin/index.html in a directory in TEMPLATE_DIRS and it will override
> the default admin one.
>
> Once you have added a new HTML link to the template that will trigger
> your view, you have to write a view for it. You add something to one of
> your URL Conf files to catch the URL (do this *before* any admin
> patterns are processed, so that your pattern is handled first) and send
> it off to the view you have written. That view will just be a normal
> Django view, so you can use the normal permission decorators on the view
> if you like.
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to