[extensions-web] Make error reporting its own app.
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] Make error reporting its own app.
- Date: Fri, 23 Sep 2011 23:09:16 +0000 (UTC)
commit 1052ac70c8ae8d9e39de5613f91ca62f4b9712a7
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Sep 23 15:22:30 2011 -0400
Make error reporting its own app.
sweettooth/errorreports/admin.py | 22 ++++
sweettooth/errorreports/migrations/0001_initial.py | 107 ++++++++++++++++++++
sweettooth/errorreports/models.py | 26 +++++
.../templates/errorreports}/error-report.html | 0
sweettooth/errorreports/urls.py | 9 ++
sweettooth/errorreports/views.py | 43 ++++++++
sweettooth/extensions/admin.py | 20 +----
.../migrations/0006_auto__del_errorreport.py | 98 ++++++++++++++++++
sweettooth/extensions/models.py | 20 ----
.../extensions/templates/extensions/comments.html | 2 +-
sweettooth/extensions/urls.py | 5 +-
sweettooth/extensions/views.py | 36 -------
sweettooth/settings.py | 2 +
sweettooth/urls.py | 2 +
14 files changed, 312 insertions(+), 80 deletions(-)
---
diff --git a/sweettooth/errorreports/__init__.py b/sweettooth/errorreports/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/sweettooth/errorreports/admin.py b/sweettooth/errorreports/admin.py
new file mode 100644
index 0000000..33ff750
--- /dev/null
+++ b/sweettooth/errorreports/admin.py
@@ -0,0 +1,22 @@
+
+from django.contrib import admin
+
+from errorreports.models import ErrorReport
+
+class ErrorReportAdmin(admin.ModelAdmin):
+ list_display = 'user_or_email', 'extension', 'version_num'
+ list_display_links = list_display
+
+ def user_or_email(self, report):
+ if report.user:
+ return report.user
+ else:
+ return report.email
+
+ def version_num(self, report):
+ return report.version.version
+
+ def extension(self, report):
+ return report.version.extension
+
+admin.site.register(ErrorReport, ErrorReportAdmin)
diff --git a/sweettooth/errorreports/migrations/0001_initial.py b/sweettooth/errorreports/migrations/0001_initial.py
new file mode 100644
index 0000000..71b7bc5
--- /dev/null
+++ b/sweettooth/errorreports/migrations/0001_initial.py
@@ -0,0 +1,107 @@
+# 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):
+
+ # Adding model 'ErrorReport'
+ db.create_table('errorreports_errorreport', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('comment', self.gf('django.db.models.fields.TextField')(blank=True)),
+ ('errors', self.gf('django.db.models.fields.TextField')(blank=True)),
+ ('email', self.gf('django.db.models.fields.EmailField')(max_length=75, blank=True)),
+ ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', blank=True, to=orm['auth.User'])),
+ ('version', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['extensions.ExtensionVersion'])),
+ ))
+ db.send_create_signal('errorreports', ['ErrorReport'])
+
+
+ def backwards(self, orm):
+
+ # Deleting model 'ErrorReport'
+ db.delete_table('errorreports_errorreport')
+
+
+ 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'})
+ },
+ 'errorreports.errorreport': {
+ 'Meta': {'object_name': 'ErrorReport'},
+ 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'errors': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'blank': 'True', 'to': "orm['auth.User']"}),
+ 'version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['extensions.ExtensionVersion']"})
+ },
+ 'extensions.extension': {
+ 'Meta': {'object_name': 'Extension'},
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
+ 'description': ('django.db.models.fields.TextField', [], {}),
+ 'icon': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'screenshot': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'blank': 'True'}),
+ 'slug': ('autoslug.fields.AutoSlugField', [], {'unique_with': '()', 'max_length': '50', 'populate_from': 'None', 'db_index': 'True'}),
+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+ 'uuid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200', 'db_index': 'True'})
+ },
+ 'extensions.extensionversion': {
+ 'Meta': {'unique_together': "(('extension', 'version'),)", 'object_name': 'ExtensionVersion'},
+ 'extension': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'versions'", 'to': "orm['extensions.Extension']"}),
+ 'extra_json_fields': ('django.db.models.fields.TextField', [], {}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'shell_versions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['extensions.ShellVersion']", 'symmetrical': 'False'}),
+ 'source': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
+ 'status': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'version': ('django.db.models.fields.IntegerField', [], {'default': '0', 'max_length': '223'})
+ },
+ 'extensions.shellversion': {
+ 'Meta': {'object_name': 'ShellVersion'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'major': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'minor': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'point': ('django.db.models.fields.IntegerField', [], {})
+ }
+ }
+
+ complete_apps = ['errorreports']
diff --git a/sweettooth/errorreports/migrations/__init__.py b/sweettooth/errorreports/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/sweettooth/errorreports/models.py b/sweettooth/errorreports/models.py
new file mode 100644
index 0000000..f308ffa
--- /dev/null
+++ b/sweettooth/errorreports/models.py
@@ -0,0 +1,26 @@
+
+from django.contrib import auth
+from django.db import models
+from django.dispatch import Signal
+from extensions.models import ExtensionVersion
+
+class ErrorReport(models.Model):
+ comment = models.TextField(blank=True)
+ errors = models.TextField(blank=True)
+
+ # In the case that a user isn't logged in, they can supply an optional
+ # email address for the extension author to reply to.
+ email = models.EmailField(blank=True)
+
+ user = models.ForeignKey(auth.models.User, blank=True, related_name="+")
+
+ version = models.ForeignKey(ExtensionVersion)
+
+ @property
+ def user_email(self):
+ if self.user:
+ return self.user.email
+ else:
+ return self.email
+
+error_reported = Signal(providing_args=["version", "report"])
diff --git a/sweettooth/extensions/templates/extensions/error-report.html b/sweettooth/errorreports/templates/errorreports/error-report.html
similarity index 100%
rename from sweettooth/extensions/templates/extensions/error-report.html
rename to sweettooth/errorreports/templates/errorreports/error-report.html
diff --git a/sweettooth/errorreports/urls.py b/sweettooth/errorreports/urls.py
new file mode 100644
index 0000000..ae0faf0
--- /dev/null
+++ b/sweettooth/errorreports/urls.py
@@ -0,0 +1,9 @@
+
+from django.conf.urls.defaults import patterns, url
+
+from errorreports import views
+
+urlpatterns = patterns('',
+ url(r'^report/(?P<pk>\d+)',
+ views.ReportErrorView.as_view(), name='errorreports-report'),
+)
diff --git a/sweettooth/errorreports/views.py b/sweettooth/errorreports/views.py
new file mode 100644
index 0000000..aed2a9d
--- /dev/null
+++ b/sweettooth/errorreports/views.py
@@ -0,0 +1,43 @@
+
+from django.contrib import messages
+from django.shortcuts import redirect
+from django.views.generic import DetailView
+
+from errorreports.models import ErrorReport, error_reported
+from extensions.models import ExtensionVersion, VISIBLE_STATUSES
+
+class ReportErrorView(DetailView):
+ queryset = ExtensionVersion.objects.filter(status__in=VISIBLE_STATUSES)
+ context_object_name = "version"
+ template_name = "errorreports/error-report.html"
+
+ def post(self, request, *args, **kwargs):
+ self.object = self.get_object()
+
+ if request.POST['has_errors']:
+ errors = request.POST['error']
+ else:
+ errors = ""
+
+ comment = request.POST['comment']
+
+ if request.user.is_authenticated():
+ user, email = request.user, ""
+ else:
+ user, email = None, request.POST['email']
+
+ report = ErrorReport(version=self.object,
+ comment=comment,
+ errors=errors,
+ user=user,
+ email=email)
+ report.save()
+
+ error_reported.send(sender=self, version=self.object, report=report)
+
+ messages.info(request, "Thank you for your error report!")
+
+ return redirect('extensions-version-detail',
+ pk=self.object.pk,
+ ext_pk=self.object.extension.pk,
+ slug=self.object.extension.slug)
diff --git a/sweettooth/extensions/admin.py b/sweettooth/extensions/admin.py
index 2054130..50337b1 100644
--- a/sweettooth/extensions/admin.py
+++ b/sweettooth/extensions/admin.py
@@ -2,7 +2,7 @@
from django.contrib import admin
from sorl.thumbnail.admin import AdminImageMixin
-from extensions.models import Extension, ExtensionVersion, ErrorReport
+from extensions.models import Extension, ExtensionVersion
from review.models import CodeReview
class CodeReviewAdmin(admin.TabularInline):
@@ -37,21 +37,3 @@ class ExtensionAdmin(admin.ModelAdmin):
inlines = [ExtensionVersionInline]
admin.site.register(Extension, ExtensionAdmin)
-
-class ErrorReportAdmin(admin.ModelAdmin):
- list_display = 'user_or_email', 'extension', 'version_num'
- list_display_links = list_display
-
- def user_or_email(self, report):
- if report.user:
- return report.user
- else:
- return report.email
-
- def version_num(self, report):
- return report.version.version
-
- def extension(self, report):
- return report.version.extension
-
-admin.site.register(ErrorReport, ErrorReportAdmin)
diff --git a/sweettooth/extensions/migrations/0006_auto__del_errorreport.py b/sweettooth/extensions/migrations/0006_auto__del_errorreport.py
new file mode 100644
index 0000000..64e3b86
--- /dev/null
+++ b/sweettooth/extensions/migrations/0006_auto__del_errorreport.py
@@ -0,0 +1,98 @@
+# 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 'ErrorReport'
+ db.delete_table('extensions_errorreport')
+
+
+ def backwards(self, orm):
+
+ # Adding model 'ErrorReport'
+ db.create_table('extensions_errorreport', (
+ ('comment', self.gf('django.db.models.fields.TextField')(blank=True)),
+ ('errors', self.gf('django.db.models.fields.TextField')(blank=True)),
+ ('version', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['extensions.ExtensionVersion'])),
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['auth.User'], blank=True)),
+ ('email', self.gf('django.db.models.fields.EmailField')(max_length=75, blank=True)),
+ ))
+ db.send_create_signal('extensions', ['ErrorReport'])
+
+
+ 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'})
+ },
+ 'extensions.extension': {
+ 'Meta': {'object_name': 'Extension'},
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
+ 'description': ('django.db.models.fields.TextField', [], {}),
+ 'icon': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'screenshot': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'blank': 'True'}),
+ 'slug': ('autoslug.fields.AutoSlugField', [], {'unique_with': '()', 'max_length': '50', 'populate_from': 'None', 'db_index': 'True'}),
+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+ 'uuid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200', 'db_index': 'True'})
+ },
+ 'extensions.extensionversion': {
+ 'Meta': {'unique_together': "(('extension', 'version'),)", 'object_name': 'ExtensionVersion'},
+ 'extension': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'versions'", 'to': "orm['extensions.Extension']"}),
+ 'extra_json_fields': ('django.db.models.fields.TextField', [], {}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'shell_versions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['extensions.ShellVersion']", 'symmetrical': 'False'}),
+ 'source': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
+ 'status': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'version': ('django.db.models.fields.IntegerField', [], {'default': '0', 'max_length': '223'})
+ },
+ 'extensions.shellversion': {
+ 'Meta': {'object_name': 'ShellVersion'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'major': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'minor': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'point': ('django.db.models.fields.IntegerField', [], {})
+ }
+ }
+
+ complete_apps = ['extensions']
diff --git a/sweettooth/extensions/models.py b/sweettooth/extensions/models.py
index 497d428..c96ba86 100644
--- a/sweettooth/extensions/models.py
+++ b/sweettooth/extensions/models.py
@@ -246,26 +246,6 @@ class ExtensionVersion(models.Model):
self.save()
-class ErrorReport(models.Model):
- comment = models.TextField(blank=True)
- errors = models.TextField(blank=True)
-
- # In the case that a user isn't logged in, they can supply an optional
- # email address for the extension author to reply to.
- email = models.EmailField(blank=True)
-
- user = models.ForeignKey(auth.models.User, blank=True, related_name="+")
-
- version = models.ForeignKey(ExtensionVersion)
-
- @property
- def user_email(self):
- if self.user:
- return self.user.email
- else:
- return self.email
-
submitted_for_review = Signal(providing_args=["version"])
reviewed = Signal(providing_args=["version", "review"])
status_changed = Signal(providing_args=["version", "log"])
-error_reported = Signal(providing_args=["version", "report"])
diff --git a/sweettooth/extensions/templates/extensions/comments.html b/sweettooth/extensions/templates/extensions/comments.html
index 7fc631f..2003aa2 100644
--- a/sweettooth/extensions/templates/extensions/comments.html
+++ b/sweettooth/extensions/templates/extensions/comments.html
@@ -30,7 +30,7 @@
</div>
<div class="report error">
- <a class="txt" href="{% url extensions-error pk=version.pk %}" class="report error">Help! It didn't work!</a>
+ <a class="txt" href="{% url errorreports-report pk=version.pk %}" class="report error">Help! It didn't work!</a>
<p>
Errors should be reported through the error reporting tool — it
helps extension authors be known about bugs in their extension!
diff --git a/sweettooth/extensions/urls.py b/sweettooth/extensions/urls.py
index 901369d..1600a8d 100644
--- a/sweettooth/extensions/urls.py
+++ b/sweettooth/extensions/urls.py
@@ -1,6 +1,6 @@
from django.conf.urls.defaults import patterns, include, url
-from django.views.generic import ListView, TemplateView, DetailView
+from django.views.generic import ListView, TemplateView
from extensions import views, models
@@ -40,9 +40,6 @@ urlpatterns = patterns('',
url(r'^local/', TemplateView.as_view(template_name="extensions/local.html"), name='extensions-local'),
- url(r'^error-report/(?P<pk>\d+)',
- views.ReportErrorView.as_view(), name='extensions-error'),
-
url(r'^upload/', include(upload_patterns)),
url(r'^ajax/', include(ajax_patterns)),
url(r'', include(shell_patterns)),
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 9abdbf7..5f2ebde 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -267,39 +267,3 @@ def upload_file(request, pk):
form = UploadForm()
return render(request, 'extensions/upload-file.html', dict(form=form))
-
-class ReportErrorView(DetailView):
- queryset = models.ExtensionVersion.objects.filter(status__in=models.VISIBLE_STATUSES)
- context_object_name = "version"
- template_name = "extensions/error-report.html"
-
- def post(self, request, *args, **kwargs):
- self.object = self.get_object()
-
- if request.POST['has_errors']:
- errors = request.POST['error']
- else:
- errors = ""
-
- comment = request.POST['comment']
-
- if request.user.is_authenticated():
- user, email = request.user, ""
- else:
- user, email = None, request.POST['email']
-
- report = models.ErrorReport(version=self.object,
- comment=comment,
- errors=errors,
- user=user,
- email=email)
- report.save()
-
- models.error_reported.send(sender=self, version=self.object, report=report)
-
- messages.info(request, "Thank you for your error report!")
-
- return redirect('extensions-version-detail',
- pk=self.object.pk,
- ext_pk=self.object.extension.pk,
- slug=self.object.extension.slug)
diff --git a/sweettooth/settings.py b/sweettooth/settings.py
index 57189e6..b3dbbf0 100644
--- a/sweettooth/settings.py
+++ b/sweettooth/settings.py
@@ -134,6 +134,7 @@ INSTALLED_APPS = (
# 'ratings' goes before django's comments
# app so it will find our templates
'ratings',
+
'django.contrib.comments',
'django.contrib.contenttypes',
'django.contrib.sessions',
@@ -146,6 +147,7 @@ INSTALLED_APPS = (
'extensions',
'auth',
'review',
+ 'errorreports',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
diff --git a/sweettooth/urls.py b/sweettooth/urls.py
index d878426..9048916 100644
--- a/sweettooth/urls.py
+++ b/sweettooth/urls.py
@@ -15,9 +15,11 @@ urlpatterns = patterns('',
url(r'^', include('extensions.urls'), name='index'),
url(r'^review/', include('review.urls')),
+ url(r'^errors/', include('errorreports.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^comments/', include('django.contrib.comments.urls')),
+
)
if settings.DEBUG:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]