Django models
The data collected using the spiders needs to be stored in a database. In Django, the database tables are called models and defined in the models.py
file (within the pages
folder). The content of this file is as follows:
from django.db import models from django.conf import settings from django.utils.translation import ugettext_lazy as _ class SearchTerm(models.Model): term = models.CharField(_('search'), max_length=255) num_reviews = models.IntegerField(null=True,default=0) #display term on admin panel def __unicode__(self): return self.term class Page(models.Model): searchterm = models.ForeignKey(SearchTerm, related_name='pages',null=True,blank=True) url = models.URLField(_('url'), default='', blank=True) title = models.CharField(_('name'), max_length=255) depth = models.IntegerField(null=True,default=-1) html = models.TextField(_('html'),blank=True, default='') review = models.BooleanField(default=False) old_rank...