Saturday, October 29, 2016

Re: WOrking with checkbox Multiple Select FIeld - Django Admin

try to to get all the checked objects using getlist from request store it in a textfield.this is better when you have 20 check boxes then code become too complex and messy

On Sun, Oct 30, 2016 at 10:55 AM, M Hashmi <mhashmi1979@gmail.com> wrote:
Form ModelForm if you need to check a single field then you set it as BooleanField in your models.py but if you need to use kind of condition that requires multiple checkboxes to be True. Then its better to define condition in your view like

models.py
a = models.BooleanField(default=False)
b = models.BooleanField(default=False)
c = models.BooleanField(default=False)

Views.py 
if a and b == True
return "correct".

Makes sense?

Regards,
Mudassar

On Sat, Oct 29, 2016 at 3:43 PM, Bernardo Garcia <botibagl@gmail.com> wrote:
HI, friends.

Someone know how to work with a field that allow perform a multiple selection in a field?, like a checkbox. In django admin,

Thanks :)

--
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/670c3379-cea2-4819-91e8-5fbe804d1c88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/CANoUts7E%2BTPngOpz4D6YBdsK9j5XopXNpmR-zEzZLe%2BJ8zrZjw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
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/CAGGVXBO2Qn6DVHR-zf5Xca1TvUT%2BhkaqOU3qxBmD8PD_yNrgPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment