I canβt find it anywhere, so your help will be pleasant for me :) Here is this field:
categories = models.ManyToManyField(fragmentCategory)
FragmentCategory:
class fragmentCategory(models.Model): CATEGORY_CHOICES = ( ('val1', 'value1'), ('val2', 'value2'), ('val3', 'value3'), ) name = models.CharField(max_length=20, choices=CATEGORY_CHOICES)
Here is the form to submit:
<input type="checkbox" name="val1" /> <input type="checkbox" name="val2" /> <input type="checkbox" name="val3" />
I tried something like this:
categories = fragmentCategory.objects.get(id=1),
Or:
categories = [1,2]
django django-models
IProblemFactory Jul 25 '09 at 16:02 2009-07-25 16:02
source share