mysql - Django database model for my website -


i building aviation website need store aircraft manufacturer, type , version of particular aircraft....boeing 777 300 example. here boeing manufact., 777 version , 300 model. model use is:

     class manufa(mod...):      name=charfield 

....

 manufact=models.foreignkey(manufact)  type=models.foreignkey(type)  version=models.foreignkey(version) 

this allows easy search problem every time have display item in search, have make 3 separate queries full name of aircraft form foreign key id....for search page 100 items...thats unimaginable number of queries..

if store these names if change version name or have edit each of rows...how solve can aircraft name same row...no second query..

you have read more of great django docs ;) https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-related

btw. should post full model definition


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -