i want implement article model has category field such (economics,civil engineering,philosophy) , want disciplines detailed possible, choices dict large. there size limit on filed need worry about?
is there better way of doing this?
to clarify things little. suppose have following model.
there size limit on year_in_school_choices dict?
from django.db import model class student(models.model): freshman = 'fr' sophomore = 'so' junior = 'jr' senior = 'sr' year_in_school_choices = ( (freshman, 'freshman'), (sophomore, 'sophomore'), (junior, 'junior'), (senior, 'senior'), ) year_in_school = models.charfield(max_length=2, choices=year_in_school_choices, default=freshman) def is_upperclass(self): return self.year_in_school in (self.junior, self.senior)
the django docs have not defined upper limit number of choices in model field choices documentation.
so, can go ahead , define detailed choices, should not problem. issue running out of memory jonsharpe pointed if choices tuple/list huge.
it better if put choices in separate file choices.py , import models.py models not cluttered , dirty.
Comments
Post a Comment