Doh! You're absolutely right Malcom. Sorry, don't know why I didn't
see that before.

So, now that I have my lovely permission, I have a new problem...
I need the ability to let a user 'add' a story, even if they can't
'approve' one. So, I'm wondering where I should try to disable the
field? In the model, or in the change_form? I'm not very experienced
in customizing the admin, but am very eager to learn.

Kind regards,
Brandon

On Jul 21, 5:50 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2008-07-21 at 15:46 -0700, Brandon Taylor wrote:
> > Hi everyone,
>
> > I'm trying to enforce a customer permission on Add/Update. In my
> > model, I have defined the permission:
>
> > permissions = (
> >                        ('can_approve_stories','Can Approve Stories'),
> >         )
>
> > in my model.ModelAdmin I have:
>
> > def change_view(self, request, obj_id):
> >         if request.user.has_perm('can_approve_stories'):
> >             return super(StoryAdmin, self).change_view(request,
> > obj_id)
> >         else:
> >             raise PermissionDenied
>
> >     def add_view(self, request, obj_id):
> >         if request.user.has_perm('can_approve_stories'):
> >             return super(StoryAdmin, self).add_view(request, obj_id)
> >         else:
> >             raise PermissionDenied
>
> > The change_view permission is working. The add_view thrown an error:
>
> > TypeError at /admin/stories/story/add/
> > add_view() takes exactly 3 arguments (2 given)
>
> > Can someone please show me what I'm doing wrong?
>
> At a guess: if you're adding an object, passing in the object_id doesn't
> make a lot of sense (the object doesn't exist yet).
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to