Re: Detecting form mode in admin (create, edit, delete)

2011-04-18 Thread Sithembewena Lloyd Dube
Hey Mengu,

Thanks for the input. I have checked out teh documentation and seen that I
can use the boolean 'change', which is an argument passed to save_model.
It specifies whether or not the current request is an edit or not. :)

Thanks!

On Mon, Apr 18, 2011 at 3:05 PM, Mengu  wrote:

> sorry, accidentally posted.
>
> well, that could be done via javascript. :)
> http://localhost:8000/admin/testapp/testmodel/2/ - means i'm updating
> http://localhost:8000/admin/testapp/testmodel/add/ - means i'm adding
>
> if (document.location.href.indexOf("/add/") == -1) {
> // do not let update.
> }
>
> On Apr 18, 3:56 pm, Mengu  wrote:
> > well, that could be done via javascript. :)
> >
> > http://localhost:8000/admin/testapp/testmodel/2/- means i'm
> updatinghttp://localhost:8000/admin/testapp/testmodel/add/- means i'm adding
> >
> > if (document.location.href.indexOf("/add/") != -1) {
> >
> > }
> >
> > On Apr 18, 2:50 pm, Sithembewena Lloyd Dube  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > @Mengu, yes, precisely :)
> >
> > > On Mon, Apr 18, 2011 at 1:20 PM, Mengu  wrote:
> > > > you mean like if a new object is being added or edited in the admin?
> >
> > > > On Apr 18, 1:58 pm, Sithembewena Lloyd Dube 
> wrote:
> > > > > Hi all,
> >
> > > > > I wish to find out how I can detect current form mode in admin.py.
> What I
> > > > am
> > > > > trying to do is to stop users changing a dropdown's selection when
> in
> > > > edit
> > > > > mode.
> >
> > > > > Any ideas?
> >
> > > > > Thanks.
> >
> > > > > --
> > > > > Regards,
> > > > > Sithembewena Lloyd Dube
> >
> > > > --
> > > > 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.
> >
> > > --
> > > Regards,
> > > Sithembewena Lloyd Dube
>
> --
> 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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
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: Detecting form mode in admin (create, edit, delete)

2011-04-18 Thread Mengu
sorry, accidentally posted.

well, that could be done via javascript. :)
http://localhost:8000/admin/testapp/testmodel/2/ - means i'm updating
http://localhost:8000/admin/testapp/testmodel/add/ - means i'm adding

if (document.location.href.indexOf("/add/") == -1) {
// do not let update.
}

On Apr 18, 3:56 pm, Mengu  wrote:
> well, that could be done via javascript. :)
>
> http://localhost:8000/admin/testapp/testmodel/2/- means i'm 
> updatinghttp://localhost:8000/admin/testapp/testmodel/add/- means i'm adding
>
> if (document.location.href.indexOf("/add/") != -1) {
>
> }
>
> On Apr 18, 2:50 pm, Sithembewena Lloyd Dube  wrote:
>
>
>
>
>
>
>
> > @Mengu, yes, precisely :)
>
> > On Mon, Apr 18, 2011 at 1:20 PM, Mengu  wrote:
> > > you mean like if a new object is being added or edited in the admin?
>
> > > On Apr 18, 1:58 pm, Sithembewena Lloyd Dube  wrote:
> > > > Hi all,
>
> > > > I wish to find out how I can detect current form mode in admin.py. What 
> > > > I
> > > am
> > > > trying to do is to stop users changing a dropdown's selection when in
> > > edit
> > > > mode.
>
> > > > Any ideas?
>
> > > > Thanks.
>
> > > > --
> > > > Regards,
> > > > Sithembewena Lloyd Dube
>
> > > --
> > > 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.
>
> > --
> > Regards,
> > Sithembewena Lloyd Dube

-- 
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: Detecting form mode in admin (create, edit, delete)

2011-04-18 Thread Mengu
well, that could be done via javascript. :)

http://localhost:8000/admin/testapp/testmodel/2/ - means i'm updating
http://localhost:8000/admin/testapp/testmodel/add/ - means i'm adding

if (document.location.href.indexOf("/add/") != -1) {

}

On Apr 18, 2:50 pm, Sithembewena Lloyd Dube  wrote:
> @Mengu, yes, precisely :)
>
>
>
>
>
>
>
>
>
> On Mon, Apr 18, 2011 at 1:20 PM, Mengu  wrote:
> > you mean like if a new object is being added or edited in the admin?
>
> > On Apr 18, 1:58 pm, Sithembewena Lloyd Dube  wrote:
> > > Hi all,
>
> > > I wish to find out how I can detect current form mode in admin.py. What I
> > am
> > > trying to do is to stop users changing a dropdown's selection when in
> > edit
> > > mode.
>
> > > Any ideas?
>
> > > Thanks.
>
> > > --
> > > Regards,
> > > Sithembewena Lloyd Dube
>
> > --
> > 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.
>
> --
> Regards,
> Sithembewena Lloyd Dube

-- 
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: Detecting form mode in admin (create, edit, delete)

2011-04-18 Thread Sithembewena Lloyd Dube
@Mengu, yes, precisely :)

On Mon, Apr 18, 2011 at 1:20 PM, Mengu  wrote:

> you mean like if a new object is being added or edited in the admin?
>
> On Apr 18, 1:58 pm, Sithembewena Lloyd Dube  wrote:
> > Hi all,
> >
> > I wish to find out how I can detect current form mode in admin.py. What I
> am
> > trying to do is to stop users changing a dropdown's selection when in
> edit
> > mode.
> >
> > Any ideas?
> >
> > Thanks.
> >
> > --
> > Regards,
> > Sithembewena Lloyd Dube
>
> --
> 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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
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: Detecting form mode in admin (create, edit, delete)

2011-04-18 Thread Mengu
you mean like if a new object is being added or edited in the admin?

On Apr 18, 1:58 pm, Sithembewena Lloyd Dube  wrote:
> Hi all,
>
> I wish to find out how I can detect current form mode in admin.py. What I am
> trying to do is to stop users changing a dropdown's selection when in edit
> mode.
>
> Any ideas?
>
> Thanks.
>
> --
> Regards,
> Sithembewena Lloyd Dube

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



Detecting form mode in admin (create, edit, delete)

2011-04-18 Thread Sithembewena Lloyd Dube
Hi all,

I wish to find out how I can detect current form mode in admin.py. What I am
trying to do is to stop users changing a dropdown's selection when in edit
mode.

Any ideas?

Thanks.

-- 
Regards,
Sithembewena Lloyd Dube

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