On Thu, 29 Jun 2017, Guilherme Leal wrote:
> It wouldn't be the case to use the field choices?
> https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.Field.choices
Guilherme,
Now that I know Field.choices exists it will certainly do the job.
I read the example as translating a quoted string in two steps to a
two-character, uppercase abbreviation. Would the following one-step list of
choices be correct?
industry_choices (
('Agriculture'),
('Business, other'),
('Chemicals'),
('Energy'),
('Law'),
('Manufacturing'),
('Mining'),
('Municipalities'),
('Ports/Marine Services'),
('Transportation'),
)
industry=models.CharField(max_length=24, choices=industry_choices, default='Agriculture')
Thanks,
Rich
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment