python - Using a class field in another fields -


i have field in class depends on field in same class have problem code:

class myclass(models.model): nation = [('sp', 'spain'), ('fr', 'france')] nationality = models.charfield(max_length=2, choices=nation) first_name = models.charfield(max_length=2, choices=name)

i want put name = [('ro', 'rodrigo'), ('ra', 'raquel')] if nation = spain , name = [('lu', 'luis'), ('ch', 'chantal')] if nation = france.

how can that? thanks!

i think want change view user sees. have above underlying db model wrong place sort of feature.

in addition (assuming web application), need in javascript, can change set of allowed names user changes nationality field.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -