Re: querying multiselectcheckbox

2018-02-01 Thread Andy
Once you fixed the typo in your model name its 
Participants.objects.filter(track_events__in=['100M', 
'200M']).values_list('Full_name')

And you should use single case for model name (Participant) and lower case 
for full_name as you did with the other attributes. 

-- 
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+unsubscr...@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/a31e79e1-4b35-4dba-901d-bd93a2d48068%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


querying multiselectcheckbox

2018-01-31 Thread Tech Today


# this is my model


from django.db import models
from multiselectfield import MultiSelectField


TRACK_EVENTS_CHOICES = (
('100M', '100 Meter'),
('200M', '200 Meter'),
('400M', '400 Meter'),
('800M', '800 Meter'),
('1500M', '1500 Meter'),
('5000M', '5000 Meter'),

)

class Particiepents(models.Model):

roll_no = models.IntegerField()
Full_name = models.CharField(max_length=40)
father_name = models.CharField(max_length=40)
sex = models.CharField(max_length=10, choices=SEX_CHOICES)
branch = models.CharField(max_length=20, choices=BRANCH_CHOICES)
semester = models.CharField(max_length=10, choices=SEMESTER_CHOICES)
track_events = MultiSelectField(max_length=30, null=True, blank=True, 
choices=TRACK_EVENTS_CHOICES, default="track_events")
field_events = MultiSelectField(max_length=30, null=True, blank=True, 
choices=FIELD_EVENTS_CHOICES, default="track_events")


def __str__(self):
return self.Full_name


# I want to retrieve a individual lists of Full_name participating in different 
track_events(100m, 200m, 400m..)




-- 
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+unsubscr...@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/f499a882-77c2-4f53-81b9-5138c7302e1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.