0 Replies - 1312 Views - Last Post: 27 November 2012 - 06:45 AM Rate Topic: -----

#1 Rhinodj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-November 12

Disable/enable function not work when call and save in my django

Posted 27 November 2012 - 06:45 AM

I am very newbiees to django and python. Need help on my project. I'm totally stuck.I have a project about health system whereby the doctor have to key in a particular form for a specific patient and for a specific sickness. In this form there is also disable and enable function for specific variable. I have two problems so far.
No.1- I cannot make the enable and disable to work when I call back the particular patient. It will be shown all enable.
No.2- When I wanted to save the form, all the disable column is not save.

Here is some of my coding.
views.py
def clean(self):# not sure if this is needed
        cleaned_data = super(RehabDiabetesForm, self).clean()
        ANSVAR_SEKTOR = cleaned_data.get("ANSVAR_SEKTOR")
        
        if ANSVAR_SEKTOR == "2":
            ''
            if "2" not in ANSVAR_SEKTOR:
                raise forms.Validationerror ("Try again")
        return cleaned_data
                        
    def form_valid(self, form):
        if (form.cleaned_data['ANSVAR_SEKTOR'] == "2"):# i try this but i am stuck and don't know how to proceed
            ''
        form.save()
        return HttpResponseRedirect(reverse("afdelingt_view"))



Herewith i attached how the page look like. Maybe it will give a better understanding. If its not clear please write to me. Will explained the very best. Thanks a million

Attached image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Page 1 of 1