Skip to content
Browse files

we've decided to omit one extra functionality 'level', maybe next tim…

…e :)
  • Loading branch information...
1 parent 44c1e11 commit 08e8de536627b4cdedab4729d2766eb5941d9388 @alexanderad committed Jul 30, 2011
View
4 crawler/constants.py
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
+from BaseHTTPServer import BaseHTTPRequestHandler
+
+HTTP_RESPONSE_CODES = BaseHTTPRequestHandler.responses
+
CRAWLER_VISITS_FREQ = (
('hourly', u'Every hour'),
('daily', u'Daily'),
View
1 crawler/views.py
@@ -1 +0,0 @@
-# -*- coding: utf-8 -*-
View
101 ...migrations/0002_auto__del_page__add_field_task_url__del_field_link_page__add_field_lin.py
@@ -0,0 +1,101 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Deleting model 'Page'
+ db.delete_table('tasks_page')
+
+ # Adding field 'Task.url'
+ db.add_column('tasks_task', 'url', self.gf('django.db.models.fields.URLField')(default=u'', max_length=2048), keep_default=False)
+
+ # Deleting field 'Link.page'
+ db.delete_column('tasks_link', 'page_id')
+
+ # Adding field 'Link.task'
+ db.add_column('tasks_link', 'task', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['tasks.Task'], null=True), keep_default=False)
+
+
+ def backwards(self, orm):
+
+ # Adding model 'Page'
+ db.create_table('tasks_page', (
+ ('url', self.gf('django.db.models.fields.URLField')(max_length=2048)),
+ ('task', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['tasks.Task'])),
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(default=u'', max_length=128)),
+ ))
+ db.send_create_signal('tasks', ['Page'])
+
+ # Deleting field 'Task.url'
+ db.delete_column('tasks_task', 'url')
+
+ # User chose to not deal with backwards NULL issues for 'Link.page'
+ raise RuntimeError("Cannot reverse this migration. 'Link.page' and its values cannot be restored.")
+
+ # Deleting field 'Link.task'
+ db.delete_column('tasks_link', 'task_id')
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'tasks.link': {
+ 'Meta': {'object_name': 'Link'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'img_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'link': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '2048'}),
+ 'link_anchor': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '256'}),
+ 'link_type': ('django.db.models.fields.CharField', [], {'default': "'web'", 'max_length': '8'}),
+ 'remote_page_title': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '256'}),
+ 'task': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['tasks.Task']", 'null': 'True'})
+ },
+ 'tasks.task': {
+ 'Meta': {'object_name': 'Task'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '128'}),
+ 'url': ('django.db.models.fields.URLField', [], {'default': "u''", 'max_length': '2048'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+ }
+ }
+
+ complete_apps = ['tasks']
View
19 tasks/models.py
@@ -4,25 +4,20 @@
from tasks.constants import LINK_TYPES
class Task(models.Model):
- """ Model for tasks """
+ """ Model for tasks (one task -- one page) """
user = models.ForeignKey(User)
name = models.CharField(max_length=128, default=u'')
- def __unicode__(self):
- return self.name
-
-class Page(models.Model):
- """ Model for Pages in Task """
- task = models.ForeignKey(Task)
- name = models.CharField(max_length=128, default=u'')
- url = models.URLField(verify_exists=False, max_length=2048)
+ url = models.URLField(verify_exists=False, max_length=2048, default=u'')
@property
def get_stats(self):
#TODO
return {}
-
+ def __unicode__(self):
+ return self.name
+
class Link(models.Model):
- """ Model for Link on a Page """
- page = models.ForeignKey(Page)
+ """ Model for Link on a page of Task """
+ task = models.ForeignKey(Task, null=True)
link = models.CharField(max_length=2048, default=u'')
link_type = models.CharField(max_length=8, choices=LINK_TYPES, default='web')
link_anchor = models.CharField(max_length=256, default=u'')

0 comments on commit 08e8de5

Please sign in to comment.
Something went wrong with that request. Please try again.