Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Hide "Save and add another" in administration page [RSS Feed]

#1 June 14, 2010 12:59:31

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Hide "Save and add another" in administration page


Hi All,

I have some problems with the integrated user profile module.

When a user profile is going to be created, there are three buttons
below: "Save and add another", "Save and continue" and "Save".

But no matter which button I click, it will always enter the user
profile page. (I am not sure, if this is a bug of django module.)

What I want to do is just hide the other two buttons: "Save and add
another" and "Save and continue".

Is it possible to hide these two buttons?

BTW: Is it possible to hide the "is_staff" field in user profile page,
but leave this option with the same value as "is_superuser"?

Best regards



--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 14, 2010 13:30:49

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Hide "Save and add another" in administration page


The additional problem with "is_staff" has been solved.

I created an OverridenUserAdmin(UserAdmin):
""" This class overrides the default UserAdmin model """
def save_model(self, request, obj, form, change):
""" Overrides the value of is_staff by saving this model """
obj.is_staff = obj.is_superuser
obj.save()

admin.site.unregister(User)
admin.site.register(User, OverridenUserAdmin)



On Jun 14, 1:59 pm, stanleyxu2005 <sx.a...@googlemail.com> wrote:
> Hi All,
>
> I have some problems with the integrated user profile module.
>
> When a user profile is going to be created, there are three buttons
> below: "Save and add another", "Save and continue" and "Save".
>
> But no matter which button I click, it will always enter the user
> profile page. (I am not sure, if this is a bug of django module.)
>
> What I want to do is just hide the other two buttons: "Save and add
> another" and "Save and continue".
>
> Is it possible to hide these two buttons?
>
> BTW: Is it possible to hide the "is_staff" field in user profile page,
> but leave this option with the same value as "is_superuser"?
>
> Best regards

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 June 14, 2010 14:40:14

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Hide "Save and add another" in administration page


I have also found a hack in admin/templates/auth/user/add_user.html

The django developers have inserted the following line into this
template, so that no matter which button is clicked, the same action
will be executed.

<input type="hidden" name="_continue" value="1" />

I override this template and my problem is solved


On Jun 14, 1:59 pm, stanleyxu2005 <sx.a...@googlemail.com> wrote:
> Hi All,
>
> I have some problems with the integrated user profile module.
>
> When a user profile is going to be created, there are three buttons
> below: "Save and add another", "Save and continue" and "Save".
>
> But no matter which button I click, it will always enter the user
> profile page. (I am not sure, if this is a bug of django module.)
>
> What I want to do is just hide the other two buttons: "Save and add
> another" and "Save and continue".
>
> Is it possible to hide these two buttons?
>
> BTW: Is it possible to hide the "is_staff" field in user profile page,
> but leave this option with the same value as "is_superuser"?
>
> Best regards

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Hide "Save and add another" in administration page [RSS Feed]

Board footer

Moderator control

Enjoy the 15th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support