Wednesday, January 31, 2018

querying multiselectcheckbox

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

No comments:

Post a Comment