Last active
May 23, 2017 12:42
-
-
Save Gasoid/3533212fe82fd4ef0fc636bd1ad27fce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class City(models.Model): | |
name = models.CharField(max_length=255) | |
class Person(models.Model): | |
city = models.ForeighKey(City) | |
first_name = models.CharField(max_length=255) | |
last_name = models.CharField(max_length=255) | |
for city_name in ('Saratov', 'NN', 'Moscow'): | |
city = City(name=city_name) | |
city.save() | |
if person_saratov_queryset: | |
print('Saratov') | |
if person_nn_queryset: | |
print('NN') | |
if person_moscow_queryset: | |
print('Moscow') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment