Add buttons to change_form

2009-09-04 Thread Sandra Django
Hi friends, I have a problem.
I want add buttons to change_form, and I did the same thing of Django, I
wrote a templatetags, but I have a doubt in the views. I want do something
as:
def newdescriptor(request):
   if request.method == 'POST':
form = CustomNewForm(request.POST)
if form.is_valid():
   if 'checked' in request.POST:
  new = Descriptor(term = form.cleaned_data['term'], note
= form.cleaned_data['note'])
  new.save()
  return HttpResponseRedirect('/admin/new/%s' % new.id)
   

I did this function, and it works, but I used it in my custom form
(CustomNewForm), and I have modify it for use it in change_form
In this case, "checked" is a button, Descriptor is a model, and term and
note are attributes. I create an instance of Descriptor when I press
"checked" button.
My doubt is how modify it for use it in chage_form? Because in this case, my
"form" is..?
Please, help, really I need do that.
Thanks

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



Add buttons to change_form

2009-09-03 Thread Sandra Django
Hi friends, I have a problem.
I want add buttons to change_form, and I did the same thing of Django, I
wrote a templatetags, but I have a doubt in the views. I want do something
as:
def newdescriptor(request):
   if request.method == 'POST':
form = CustomNewForm(request.POST)
if form.is_valid():
   if 'checked' in request.POST:
  new = Descriptor(term = form.cleaned_data['term'], note
= form.cleaned_data['note'])
  new.save()
  return HttpResponseRedirect('/admin/new/%s' % new.id)
   

I did this function, and it works, but I used it in my custom form
(CustomNewForm), and I have modify it for use it in change_form
In this case, "checked" is a button, Descriptor is a model, and term and
note are attributes. I create an instance of Descriptor when I press
"checked" button.
My doubt is how modify it for use it in chage_form? Because in this case, my
"form" is..?
Please, help, really I need do that.
Thanks

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



Add buttons to change_form

2009-09-03 Thread Sandra Django
Hi friends, I have a problem.
I want add buttons to change_form, and I did the same thing of Django, I
wrote a templatetags, but I have a doubt in the views. I want do something
as:
def newdescriptor(request):
   if request.method == 'POST':
form = CustomNewForm(request.POST)
if form.is_valid():
   if 'checked' in request.POST:
  new = Descriptor(term = form.cleaned_data['term'], note
= form.cleaned_data['note'])
  new.save()
  return HttpResponseRedirect('/admin/new/%s' % new.id)
   

I did this function, and it works, but I used it in my custom form
(CustomNewForm), and I have modify it for use it in change_form
In this case, "checked" is a button, Descriptor is a model, and term and
note are attributes. I create an instance of Descriptor when I press
"checked" button.
My doubt is how modify it for use it in chage_form? Because in this case, my
"form" is..?
Please, help, really I need do that.
Thanks

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