How to Reload django model -
i have modelchoice field in django model class choices based on model values. each time add new entries latter model, value not reflect on page untill restart server. below code:
from multiselectfield import multiselectfield class firstmodel(models.model): choices = [(x.pk,x.subject_title) x in subject.objects.all()] choices = tuple(choices) subjects_to_offer = multiselectfield(choices=choices) class subject(models.model): # field declarations
now each time update subject, values not reflect on page until restart server. please how reload first model without restarting server. many tanks p.s multiselectfield package https://github.com/goinnn/django-multiselectfield choice field except has added features. if can figure way of reloading models without restarting server i'll fine
yup design, cannot solved way.
the better thing use simple m2m field in models , write custom function saving way want , in front end, make arrangements selection of maximum number of fields.
in case, choices created when program initiates or code compiled.
if have no other option, can follow this link. have re-runserver on save(). example explains both dev , production (apache/wsgi) server.
Comments
Post a Comment