i new django , have working through bunch of tutorials seem stop short of having django site code on how more complex queries database.
i have following models:
class game(models.model): abbreviation = models.charfield(max_length=15) name = models.charfield(max_length=50) class environment(models.model): name = models.charfield(max_length=20) gamename = models.foreignkey(game, related_name='environment', unique=true) gameid = models.integerfield()
i need able query has gameid environment table needs on game table , return name. there 1 game per environment.
thanks, carrie
environment.objects.filter(gamename__name=somename).get()
Comments
Post a Comment