Skip to content

Commit a3fa03d

Browse files
author
stef
committed
Merge branch 'master' of github.com:stef/nnmon
Conflicts: pip-requirements.txt
2 parents 0b7940b + 7a36ad3 commit a3fa03d

24 files changed

+671
-64
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ignore python compiled files
2+
*.pyc
3+
# ignore mac files
4+
.DS_Store
5+
# ignore setup.py build dirs
6+
build/
7+
nnmon.egg-info/
8+
# ignore sqlite db
9+
*.db
10+
*.pyc

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
nnmon the bugtracker for teh internetz
2+
======================================
3+
4+
nnmon is the project running [respectmynet.eu](http://respectmynet.eu/).
5+
6+
Installation
7+
------------
8+
9+
See [/docs/SETUP.md](nnmon/blob/master/docs/SETUP.md)
10+

bt/admin.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class CommentInline(admin.TabularInline):
77

88
class ViolationAdmin(admin.ModelAdmin):
99
list_display = ('state', 'country', 'operator', 'contract', 'resource_name', 'media', 'activationid')
10-
list_filter = ('state', 'operator', 'contract', 'resource_name', 'media', 'country')
10+
list_filter = ('state', 'operator_ref', 'contract', 'resource_name', 'media', 'country')
1111
inlines = [CommentInline, ]
1212
admin.site.register(models.Violation, ViolationAdmin)
1313

@@ -22,9 +22,15 @@ class AttachmentAdmin(admin.ModelAdmin):
2222

2323
class ConfirmationAdmin(admin.ModelAdmin):
2424
list_display = ('violation', 'key')
25-
list_filter = ('violation__operator', 'violation__contract', 'violation__resource_name', 'violation__media', 'violation__country')
25+
list_filter = ('violation__operator_ref', 'violation__contract', 'violation__resource_name', 'violation__media', 'violation__country')
2626
admin.site.register(models.Confirmation, ConfirmationAdmin)
2727

2828
class FeaturedCaseAdmin(admin.ModelAdmin):
2929
pass
3030
admin.site.register(models.FeaturedCase, FeaturedCaseAdmin)
31+
32+
class OperatorAdmin(admin.ModelAdmin):
33+
list_display = ("__unicode__", "reported_violations")
34+
search_fields = ('name', )
35+
pass
36+
admin.site.register(models.Operator, OperatorAdmin)

bt/api.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#from django.contrib.auth.models import User
2+
from tastypie import fields
3+
from tastypie.authorization import DjangoAuthorization
4+
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
5+
from bt.models import Violation, Operator
6+
7+
8+
#class UserResource(ModelResource):
9+
# class Meta:
10+
# queryset = User.objects.all()
11+
# resource_name = 'auth/user'
12+
# excludes = ['email', 'password', 'is_superuser']
13+
14+
class OperatorResource(ModelResource):
15+
16+
class Meta:
17+
queryset = Operator.objects.all()
18+
list_allowed_methods = ['get', 'post']
19+
detail_allowed_methods = ['get', 'post', 'put', 'delete']
20+
resource_name = 'operators'
21+
authorization = DjangoAuthorization()
22+
filtering = {
23+
'name': ALL,
24+
}
25+
26+
27+
class APIResource(ModelResource):
28+
operator = fields.ForeignKey(OperatorResource, 'operator_ref')
29+
# user = fields.ForeignKey(UserResource, 'user')
30+
31+
class Meta:
32+
queryset = Violation.objects.all()
33+
list_allowed_methods = ['get', 'post']
34+
detail_allowed_methods = ['get', 'post', 'put', 'delete']
35+
resource_name = 'violations'
36+
authorization = DjangoAuthorization()
37+
filtering = {
38+
'country': ALL,
39+
'operator_ref': ALL_WITH_RELATIONS,
40+
'activationid': ALL,
41+
}

bt/feeds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def items(self):
1212
return Violation.objects.filter(activationid='').order_by('-id')[:10]
1313

1414
def item_link(self, item):
15-
return "/view/%s" % item.pk
15+
return item.get_absolute_url()
1616

1717
def item_title(self, item):
1818
return "%s (%s) %s" % (item.operator, item.country, item.contract)

bt/migrations/0001_initial.py

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# -*- coding: utf-8 -*-
2+
import datetime
3+
from south.db import db
4+
from south.v2 import SchemaMigration
5+
from django.db import models
6+
7+
8+
class Migration(SchemaMigration):
9+
10+
def forwards(self, orm):
11+
# Adding model 'Violation'
12+
db.create_table('bt_violation', (
13+
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14+
('country', self.gf('django.db.models.fields.CharField')(max_length=2)),
15+
('operator', self.gf('django.db.models.fields.CharField')(max_length=256)),
16+
('contract', self.gf('django.db.models.fields.CharField')(max_length=256, blank=True)),
17+
('resource', self.gf('django.db.models.fields.CharField')(max_length=20, blank=True)),
18+
('resource_name', self.gf('django.db.models.fields.CharField')(max_length=4096, blank=True)),
19+
('type', self.gf('django.db.models.fields.CharField')(max_length=20, blank=True)),
20+
('media', self.gf('django.db.models.fields.CharField')(max_length=20, blank=True)),
21+
('temporary', self.gf('django.db.models.fields.BooleanField')(default=False)),
22+
('contractual', self.gf('django.db.models.fields.BooleanField')(default=False)),
23+
('contract_excerpt', self.gf('django.db.models.fields.TextField')(blank=True)),
24+
('loophole', self.gf('django.db.models.fields.BooleanField')(default=False)),
25+
('activationid', self.gf('django.db.models.fields.CharField')(max_length=128, blank=True)),
26+
('state', self.gf('django.db.models.fields.CharField')(default='new', max_length=20, blank=True)),
27+
('editorial', self.gf('django.db.models.fields.TextField')(blank=True)),
28+
))
29+
db.send_create_signal('bt', ['Violation'])
30+
31+
# Adding model 'Comment'
32+
db.create_table('bt_comment', (
33+
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
34+
('submitter_email', self.gf('django.db.models.fields.EmailField')(max_length=75)),
35+
('submitter_name', self.gf('django.db.models.fields.CharField')(max_length=20)),
36+
('consent', self.gf('django.db.models.fields.BooleanField')(default=False)),
37+
('comment', self.gf('django.db.models.fields.TextField')()),
38+
('timestamp', self.gf('django.db.models.fields.DateTimeField')()),
39+
('violation', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['bt.Violation'])),
40+
))
41+
db.send_create_signal('bt', ['Comment'])
42+
43+
# Adding model 'Attachment'
44+
db.create_table('bt_attachment', (
45+
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
46+
('storage', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
47+
('name', self.gf('django.db.models.fields.CharField')(max_length=512)),
48+
('type', self.gf('django.db.models.fields.CharField')(max_length=512)),
49+
('comment', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['bt.Comment'])),
50+
))
51+
db.send_create_signal('bt', ['Attachment'])
52+
53+
# Adding model 'Confirmation'
54+
db.create_table('bt_confirmation', (
55+
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
56+
('key', self.gf('django.db.models.fields.CharField')(max_length=64, blank=True)),
57+
('email', self.gf('django.db.models.fields.EmailField')(max_length=75)),
58+
('violation', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['bt.Violation'])),
59+
))
60+
db.send_create_signal('bt', ['Confirmation'])
61+
62+
# Adding model 'FeaturedCase'
63+
db.create_table('bt_featuredcase', (
64+
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
65+
('case', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['bt.Violation'], unique=True)),
66+
))
67+
db.send_create_signal('bt', ['FeaturedCase'])
68+
69+
70+
def backwards(self, orm):
71+
# Deleting model 'Violation'
72+
db.delete_table('bt_violation')
73+
74+
# Deleting model 'Comment'
75+
db.delete_table('bt_comment')
76+
77+
# Deleting model 'Attachment'
78+
db.delete_table('bt_attachment')
79+
80+
# Deleting model 'Confirmation'
81+
db.delete_table('bt_confirmation')
82+
83+
# Deleting model 'FeaturedCase'
84+
db.delete_table('bt_featuredcase')
85+
86+
87+
models = {
88+
'bt.attachment': {
89+
'Meta': {'object_name': 'Attachment'},
90+
'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Comment']"}),
91+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
92+
'name': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
93+
'storage': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
94+
'type': ('django.db.models.fields.CharField', [], {'max_length': '512'})
95+
},
96+
'bt.comment': {
97+
'Meta': {'object_name': 'Comment'},
98+
'comment': ('django.db.models.fields.TextField', [], {}),
99+
'consent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
100+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
101+
'submitter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
102+
'submitter_name': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
103+
'timestamp': ('django.db.models.fields.DateTimeField', [], {}),
104+
'violation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Violation']"})
105+
},
106+
'bt.confirmation': {
107+
'Meta': {'object_name': 'Confirmation'},
108+
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
109+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
110+
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
111+
'violation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Violation']"})
112+
},
113+
'bt.featuredcase': {
114+
'Meta': {'object_name': 'FeaturedCase'},
115+
'case': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['bt.Violation']", 'unique': 'True'}),
116+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
117+
},
118+
'bt.violation': {
119+
'Meta': {'object_name': 'Violation'},
120+
'activationid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
121+
'contract': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
122+
'contract_excerpt': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
123+
'contractual': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
124+
'country': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
125+
'editorial': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
126+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
127+
'loophole': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
128+
'media': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
129+
'operator': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
130+
'resource': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
131+
'resource_name': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'blank': 'True'}),
132+
'state': ('django.db.models.fields.CharField', [], {'default': "'new'", 'max_length': '20', 'blank': 'True'}),
133+
'temporary': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
134+
'type': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'})
135+
}
136+
}
137+
138+
complete_apps = ['bt']
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# -*- coding: utf-8 -*-
2+
import datetime
3+
from south.db import db
4+
from south.v2 import SchemaMigration
5+
from django.db import models
6+
7+
8+
class Migration(SchemaMigration):
9+
10+
def forwards(self, orm):
11+
# Adding model 'Operator'
12+
db.create_table('bt_operator', (
13+
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14+
('name', self.gf('django.db.models.fields.CharField')(max_length=256)),
15+
('logo', self.gf('django.db.models.fields.files.ImageField')(max_length=100, null=True, blank=True)),
16+
))
17+
db.send_create_signal('bt', ['Operator'])
18+
19+
# Adding field 'Violation.operator_ref'
20+
db.add_column('bt_violation', 'operator_ref',
21+
self.gf('django.db.models.fields.related.ForeignKey')(related_name='violations', null=True, to=orm['bt.Operator']),
22+
keep_default=False)
23+
24+
25+
def backwards(self, orm):
26+
# Deleting model 'Operator'
27+
db.delete_table('bt_operator')
28+
29+
# Deleting field 'Violation.operator_ref'
30+
db.delete_column('bt_violation', 'operator_ref_id')
31+
32+
33+
models = {
34+
'bt.attachment': {
35+
'Meta': {'object_name': 'Attachment'},
36+
'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Comment']"}),
37+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
38+
'name': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
39+
'storage': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
40+
'type': ('django.db.models.fields.CharField', [], {'max_length': '512'})
41+
},
42+
'bt.comment': {
43+
'Meta': {'object_name': 'Comment'},
44+
'comment': ('django.db.models.fields.TextField', [], {}),
45+
'consent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
46+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
47+
'submitter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
48+
'submitter_name': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
49+
'timestamp': ('django.db.models.fields.DateTimeField', [], {}),
50+
'violation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Violation']"})
51+
},
52+
'bt.confirmation': {
53+
'Meta': {'object_name': 'Confirmation'},
54+
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
55+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
56+
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
57+
'violation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Violation']"})
58+
},
59+
'bt.featuredcase': {
60+
'Meta': {'object_name': 'FeaturedCase'},
61+
'case': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['bt.Violation']", 'unique': 'True'}),
62+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
63+
},
64+
'bt.operator': {
65+
'Meta': {'object_name': 'Operator'},
66+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
67+
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
68+
'name': ('django.db.models.fields.CharField', [], {'max_length': '256'})
69+
},
70+
'bt.violation': {
71+
'Meta': {'object_name': 'Violation'},
72+
'activationid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
73+
'contract': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
74+
'contract_excerpt': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
75+
'contractual': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
76+
'country': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
77+
'editorial': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
78+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
79+
'loophole': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
80+
'media': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
81+
'operator': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
82+
'operator_ref': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'violations'", 'null': 'True', 'to': "orm['bt.Operator']"}),
83+
'resource': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
84+
'resource_name': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'blank': 'True'}),
85+
'state': ('django.db.models.fields.CharField', [], {'default': "'new'", 'max_length': '20', 'blank': 'True'}),
86+
'temporary': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
87+
'type': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'})
88+
}
89+
}
90+
91+
complete_apps = ['bt']

0 commit comments

Comments
 (0)