in modeladmin - show a field to edit only if superuser

2009-10-13 Thread Sergio A.

I'd like to show for editing the 'owner' field only to superuser; I'm
using django 1.0:

class ProductAdmin(admin.ModelAdmin):
form = ProductForm
 
fieldsets = [

('Product Identification', {'fields': ['owner', 'code', ...),
('Product Description', {'fields': ['...])
   ...
   ]


how can this be addressed?

Thanks, Sergio
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



how to get back to a view requiring login

2009-10-11 Thread Sergio A.

I've three views each with different URL. They are visible to logged
in users.
If a non-logged user tries to access a URL requiring login, I'm able
to redirect it to the login page.

What I'm missing is how to go back to the initial page, once the user
log in the system.


Cheers, Sergio
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: in admin interface - how to edit/show data based on ownership/not ownership

2009-06-14 Thread Sergio A.

I found where to work on. The render_change_form function in the
options.py file where the render_change_form is invoked.
All the information seem to be available in that context.

Sergio

On Jun 14, 2:42 pm, "Sergio A."  wrote:
> I need to identify where to overwrite the template selection, and in
> that place, if I can get current user.
> I have not found a proper solution yet.
>
> Sergio
>
> On Jun 11, 10:32 pm, phoebebright  wrote:
>
> > This post might help 
> > -http://groups.google.com/group/django-users/browse_thread/thread/c84d...
> > Not exactly what you want but might give you some ideas.
>
> > On Jun 11, 7:36 pm, "Sergio A."  wrote:
>
> > > Hello,
>
> > > in this blog post:
>
> > >http://www.b-list.org/weblog/2008/dec/24/admin/
>
> > > it is explained how to list only data that someone owns and restrict
> > > edit permission.
> > > What I'd like to do is to list all the data, but let users change only
> > > those owned, while showing the rest for reading.
>
> > > This means that I should be able to compare logged user to the data
> > > owner and then select a proper template (to change/present) data.
>
> > > Any example on how to do this in the admin module?
>
> > > Thanks, Sergio
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: in admin interface - how to edit/show data based on ownership/not ownership

2009-06-14 Thread Sergio A.


I need to identify where to overwrite the template selection, and in
that place, if I can get current user.
I have not found a proper solution yet.

Sergio


On Jun 11, 10:32 pm, phoebebright  wrote:
> This post might help 
> -http://groups.google.com/group/django-users/browse_thread/thread/c84d...
> Not exactly what you want but might give you some ideas.
>
> On Jun 11, 7:36 pm, "Sergio A."  wrote:
>
> > Hello,
>
> > in this blog post:
>
> >http://www.b-list.org/weblog/2008/dec/24/admin/
>
> > it is explained how to list only data that someone owns and restrict
> > edit permission.
> > What I'd like to do is to list all the data, but let users change only
> > those owned, while showing the rest for reading.
>
> > This means that I should be able to compare logged user to the data
> > owner and then select a proper template (to change/present) data.
>
> > Any example on how to do this in the admin module?
>
> > Thanks, Sergio
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



in admin interface - how to edit/show data based on ownership/not ownership

2009-06-11 Thread Sergio A.

Hello,

in this blog post:

http://www.b-list.org/weblog/2008/dec/24/admin/

it is explained how to list only data that someone owns and restrict
edit permission.
What I'd like to do is to list all the data, but let users change only
those owned, while showing the rest for reading.

This means that I should be able to compare logged user to the data
owner and then select a proper template (to change/present) data.

Any example on how to do this in the admin module?

Thanks, Sergio
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: select template for adminform based on type of user

2009-06-02 Thread Sergio A.

any hint on this issue?

Thanks, Sergio

On May 29, 12:51 am, "Sergio A."  wrote:
> Dear all,
>
> Is it possible to select the template to be applied to an admin form
> based on the logged user?
> In particular, I've two cases:
>
> - if super user, a certain template should be used
> - if not a super user, but the owner of the data, then another
> template should be used
> - if not a super user, but the owner of the data, then a third option
> template should be used
>
> I understood that probably the get_form is the right place where to
> work, but not sure if this can be done.
>
> Thanks for your support, Sergio
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



select template for adminform based on type of user

2009-05-28 Thread Sergio A.

Dear all,

Is it possible to select the template to be applied to an admin form
based on the logged user?
In particular, I've two cases:

- if super user, a certain template should be used
- if not a super user, but the owner of the data, then another
template should be used
- if not a super user, but the owner of the data, then a third option
template should be used

I understood that probably the get_form is the right place where to
work, but not sure if this can be done.

Thanks for your support, Sergio
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: has_add_permission() isn't working properly

2009-05-17 Thread Sergio A.


here it is: http://code.djangoproject.com/ticket/11136

hope this will be considered, since it improves the user experience.

Thanks for your feedback, Sergio



On May 18, 12:19 am, Alex Gaynor  wrote:
> On Sun, May 17, 2009 at 5:15 PM, Karen Tracey  wrote:
> > On Sun, May 17, 2009 at 5:34 PM, Sergio A. 
> > wrote:
>
> >> the issue seems not to be totally solved by the patch.
>
> >> If I have two classes A and B
> >> class A has a field being a foreign key to a B class field
> >> in the admin, when I add an A element, I see the '+' button on the
> >> foreign key field to B even though I do not have the rights to create
> >> a B element.
> >> Therefore I see a pop-up with permission denied.
>
> >> How to fix this?
>
> > That's a slightly different problem, and will need its own ticket.  Despite
> > superficial similarity, hose "add another" links on the add/change pages for
> > an object are coming from completely different code than the other problem
> > mentioned in this thread.  Specifically, they are added by the
> > RelatedFieldWidgetWrapper.  From a quick look I'm not sure this one is going
> > to be easy to fixI don't know that the widget wrapper has the necessary
> > information to decide whether to include that link.  But you could open a
> > ticket for someone to take a closer look.
>
> > Karen
>
> The widget doesn't really have the necessary info there.  Specfically it
> needs the logged in user (or at least the computed info about them), however
> it's not going to have that since there's no way for the render() method to
> get that since it's not a part of the forms library.  The best you could do
> is to pass it the widget constructor, which will be ok because of how we use
> the widgets in the admin, which will require a little bit of
> re-architecting.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: has_add_permission() isn't working properly

2009-05-17 Thread Sergio A.


the issue seems not to be totally solved by the patch.

If I have two classes A and B
class A has a field being a foreign key to a B class field
in the admin, when I add an A element, I see the '+' button on the
foreign key field to B even though I do not have the rights to create
a B element.
Therefore I see a pop-up with permission denied.

How to fix this?

Cheers, Sergio

On Mar 25, 7:14 pm, Alex Gaynor  wrote:
> 2009/3/25 João Olavo Baião de Vasconcelos 
>
>
>
> > On Wed, Mar 25, 2009 at 10:25 AM, Karen Tracey  wrote:
>
> >> Probably a missed bit from when this was fixed for the other pages, see
> >> ticket #5447:
>
> > Thanks a lot, Karen. I opened a new ticket:
> >http://code.djangoproject.com/ticket/10624#preview(they said in #5447 to
> > create a new one if an issue remains).
>
> >>http://code.djangoproject.com/ticket/5447
>
> >> In a quick look I don't see a ticket for this one, so if you get a chance
> >> it would be useful if you could write it up so it's not forgotten.
>
> >> Karen
>
> > --
> > João Olavo Baião de Vasconcelos
> > Bacharel em Ciência da Computação
> > Analista de Sistemas - Infraestrutura
> > joaoolavo.wordpress.com
>
> I've closed this as a dupe of #9036, as you can see the issue is that the
> has_add_permission method isn't ever called.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---