Friday, June 18, 2010

Re: select multiple without using foreignkey

> Ages ago I wrote asnippetwith a model field and form field to deal
> with this. It should still work. See:http://djangosnippets.org/snippets/1200/
> --
> DR.

I'm using this snippet like so:

MONTHS = [
(1, "January"),
(2, "February"),
(3, "March"),
(4, "April"),
(5, "May"),
(6, "June"),
(7, "July"),
(8, "August"),
(9, "September"),
(10, "October"),
(11, "November"),
(12, "December"),
]

class MyModel(models.Model):
months = MultiSelectField(max_length=30, choices=MONTHS,
help_text="What months of the year do you travel this route?")

And it works fine except for when I do MyModel.get_months_display() it
returns "1,2,3,4,5" instead of "January, Februrary, March, ..." Is
this by design, or am I using the snippet wrong?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate