예제 #1
0
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))
예제 #2
0
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>'
예제 #3
0
class Movie(models.Model):
    title = models.CharField(max_length=50)
    based_on = models.ForeignKey(Book, null=True)
    year_published = models.IntegerField()
예제 #4
0
 class Foo(models.Model):
     objects = select_manager()
     bar = models.IntegerField()
예제 #5
0
class Book(models.Model):
    title = models.CharField(max_length=50)
    year_published = models.IntegerField()