From 17785222188a8eea202d02036390b8214fd559f3 Mon Sep 17 00:00:00 2001 From: Luan Date: Fri, 25 Oct 2013 13:27:39 -0200 Subject: [PATCH] Minor fixes and changes on attachments --- src/proxy/migrations/0003_create_attachment_view.py | 4 ++-- src/proxy/models.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/proxy/migrations/0003_create_attachment_view.py b/src/proxy/migrations/0003_create_attachment_view.py index f4c98ff..46df6f8 100644 --- a/src/proxy/migrations/0003_create_attachment_view.py +++ b/src/proxy/migrations/0003_create_attachment_view.py @@ -15,7 +15,7 @@ class Migration(DataMigration): cursor.execute(''' CREATE OR REPLACE VIEW attachment_view AS SELECT CONCAT(attachment.type, '/' , attachment.id, '/', attachment.filename) AS url, - attachment.type AS type, + attachment.type AS used_by, attachment.filename as filename, (SELECT LOWER(SUBSTRING(attachment.filename FROM '\w{2,3}$'))) AS mimetype, attachment.author as author, @@ -29,7 +29,7 @@ class Migration(DataMigration): connection = connections['trac'] cursor = connection.cursor() - cursor.execute('DROP VIEW attachment_view;') + cursor.execute('DROP VIEW IF EXISTS attachment_view;') models = { u'proxy.attachment': { diff --git a/src/proxy/models.py b/src/proxy/models.py index 4f3a025..d618193 100644 --- a/src/proxy/models.py +++ b/src/proxy/models.py @@ -8,7 +8,7 @@ from hitcount.models import HitCountModelMixin class Attachment(models.Model, HitCountModelMixin): url = models.TextField(primary_key=True) - type = models.TextField() + used_by = models.TextField() filename = models.TextField() author = models.TextField(blank=True) description = models.TextField(blank=True) -- libgit2 0.21.2