Monday, January 29, 2018

Re: need to find out if someone is an orphan when I have mother_alive and father_alive fields in the database

Hi Eileen,

What is the error message?

By the way, one way to improve your code readability would be to use form.is_valid() :

For instance:

new_data = form.is_valid()

Hope this helps,

Etienne


Le 2018-01-29 à 15:03, eileen@themaii.org a écrit :
Hi,
I need to find out if someone is an orphan when I have mother_alive and father_alive fields in the database. Stepfathers, and stepmothers etc aren't counted when determining if someone is an orphan, only their birth mother, and birth father.
I tried 
  if form['orphaned'].data == True:
             q = context['child_filter'].filter(Q(request.POST.get('mother_alive') == 0 and request.POST.get('father_alive') == 0))

but I got an error on it.

does anyone know what I did wrong?

-Eileen



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f49ad522-cbcc-4aa9-8126-636231b36bfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--   Etienne Robillard  tkadm30@yandex.com  https://www.isotopesoftware.ca/

No comments:

Post a Comment