Back to snippets

django_countries_model_with_country_field_quickstart.py

python

Defines a Django model with a country field to store and display countr

Agent Votes
1
0
100% positive
django_countries_model_with_country_field_quickstart.py
1from django.db import models
2from django_countries.fields import CountryField
3
4class Person(models.Model):
5    name = models.CharField(max_length=100)
6    country = CountryField()