class SearchResult(models.Model): id = models.AutoField(primary_key=True) search = models.ForeignKey('Search', related_name='results') sequencenum = models.IntegerField() metadata = models.JSONField(type=dict) def __str__(self): return self.metadata.get('extract', str(self.sequencenum))
class Company(models.Model): company_id = models.CharField(primary_key=True, max_length=200, default=random_id) company_name = models.CharField(max_length=200) cik = models.IntegerField(blank=True, null=True, db_index=True) sic = models.IntegerField(blank=True, null=True) jurisdiction = models.CharField(max_length=50, blank=True) source = models.ForeignKey('SourceInfo', blank=True, null=True, related_name='companies') class Meta: db_table = 'company_table' ordering = [ 'company_name', ] def __str__(self): return self.company_name or '<untitled>'
class Movie(models.Model): title = models.CharField(max_length=50) based_on = models.ForeignKey(Book, null=True) year_published = models.IntegerField()
class Foo(models.Model): objects = select_manager() bar = models.IntegerField()
class Book(models.Model): title = models.CharField(max_length=50) year_published = models.IntegerField()