Created
December 9, 2017 17:17
-
-
Save RedGhoul/a00fe0629b480451324fe1276d39e221 to your computer and use it in GitHub Desktop.
This file contains 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
from django.db import models | |
class Topic(models.Model): | |
top_name = models.CharField(max_length=264,unique=True) | |
def __str__(self): | |
return self.top_name | |
class Webpage(models.Model): | |
topic = models.ForeignKey(Topic) # notice how easy it is to take care of foreign keys | |
name = models.CharField(max_length=264,unique=True) | |
url = models.URLField(unique=True) | |
def __str__(self): | |
return self.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment