I have two diferents problems with multple choices in models.
The first, i'm trying to do a multiple choice so the user can pick one or more days of the week:
DAYS_CHOICES = (
(1, _('Monday')),
...
(7, _('Sunday')),
)
...
day = models.ManyToManyField('day', choices=DAYS_CHOICES)
The second problem:
I want to make a ManyToMany Relation with a model define in other model: First (Import to the model):
from events.models import Category
Second (The field related to the model):
type = models.ManyToManyField('Category', null=True, blank=True)
I get this error on syncdb:
Error: One or more models did not validate: situ.situ: 'day' has an m2m relation with model day, which has either not been installed or is abstract.
situ.situ: 'type' has an m2m relation with model Category, which has either not been installed or is abstract.
you could use :
day = forms.ModelMultipleChoiceField(queryset=Day.objects.all())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With