Commit d7e5f4c6 authored by Okhin's avatar Okhin

Moving to django 1.8

parent c11e56f6
nnmon the bugtracker for teh internetz
======================================
nnmon is the project running [respectmynet.eu](http://respectmynet.eu/).
Installation
------------
See [/docs/SETUP.md](nnmon/blob/master/docs/SETUP.md)
[extractors]
django = babeldjango.extract:extract_django
[django: templates/*.*]
[django: templates/comments/*.*]
[python: bt/**.py]
This diff is collapsed.
# -*- coding: 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 'Operator'
db.create_table('bt_operator', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=256)),
('logo', self.gf('django.db.models.fields.files.ImageField')(max_length=100, null=True, blank=True)),
))
db.send_create_signal('bt', ['Operator'])
# Adding field 'Violation.operator_ref'
db.add_column('bt_violation', 'operator_ref',
self.gf('django.db.models.fields.related.ForeignKey')(related_name='violations', null=True, to=orm['bt.Operator']),
keep_default=False)
def backwards(self, orm):
# Deleting model 'Operator'
db.delete_table('bt_operator')
# Deleting field 'Violation.operator_ref'
db.delete_column('bt_violation', 'operator_ref_id')
models = {
'bt.attachment': {
'Meta': {'object_name': 'Attachment'},
'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Comment']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
'storage': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '512'})
},
'bt.comment': {
'Meta': {'object_name': 'Comment'},
'comment': ('django.db.models.fields.TextField', [], {}),
'consent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'submitter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
'submitter_name': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {}),
'violation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Violation']"})
},
'bt.confirmation': {
'Meta': {'object_name': 'Confirmation'},
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
'violation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Violation']"})
},
'bt.featuredcase': {
'Meta': {'object_name': 'FeaturedCase'},
'case': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['bt.Violation']", 'unique': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'bt.operator': {
'Meta': {'object_name': 'Operator'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '256'})
},
'bt.violation': {
'Meta': {'object_name': 'Violation'},
'activationid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'contract': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'contract_excerpt': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'contractual': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
'editorial': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'loophole': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'media': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'operator': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'operator_ref': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'violations'", 'null': 'True', 'to': "orm['bt.Operator']"}),
'resource': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'resource_name': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'blank': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'default': "'new'", 'max_length': '20', 'blank': 'True'}),
'temporary': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'})
}
}
complete_apps = ['bt']
\ No newline at end of file
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Populate new operator foreign key field"
for violation in orm['bt.Violation'].objects.all():
operator, created = orm['bt.Operator'].objects.get_or_create(name=violation.operator)
violation.operator_ref = operator
violation.save()
def backwards(self, orm):
"No need for backward pass"
pass
models = {
'bt.attachment': {
'Meta': {'object_name': 'Attachment'},
'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Comment']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
'storage': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '512'})
},
'bt.comment': {
'Meta': {'object_name': 'Comment'},
'comment': ('django.db.models.fields.TextField', [], {}),
'consent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'submitter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
'submitter_name': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {}),
'violation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Violation']"})
},
'bt.confirmation': {
'Meta': {'object_name': 'Confirmation'},
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
'violation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Violation']"})
},
'bt.featuredcase': {
'Meta': {'object_name': 'FeaturedCase'},
'case': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['bt.Violation']", 'unique': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'bt.operator': {
'Meta': {'object_name': 'Operator'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '256'})
},
'bt.violation': {
'Meta': {'object_name': 'Violation'},
'activationid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'contract': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'contract_excerpt': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'contractual': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
'editorial': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'loophole': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'media': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'operator': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'operator_ref': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'violations'", 'null': 'True', 'to': "orm['bt.Operator']"}),
'resource': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'resource_name': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'blank': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'default': "'new'", 'max_length': '20', 'blank': 'True'}),
'temporary': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'})
}
}
complete_apps = ['bt']
symmetrical = True
# -*- coding: 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 field 'Violation.operator'
db.delete_column('bt_violation', 'operator')
# Changing field 'Violation.operator_ref'
db.alter_column('bt_violation', 'operator_ref_id', self.gf('django.db.models.fields.related.ForeignKey')(default=0, to=orm['bt.Operator']))
def backwards(self, orm):
# Adding field 'Violation.operator'
db.add_column('bt_violation', 'operator',
self.gf('django.db.models.fields.CharField')(default=0, max_length=256),
keep_default=False)
# Changing field 'Violation.operator_ref'
db.alter_column('bt_violation', 'operator_ref_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['bt.Operator']))
models = {
'bt.attachment': {
'Meta': {'object_name': 'Attachment'},
'comment': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Comment']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
'storage': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '512'})
},
'bt.comment': {
'Meta': {'object_name': 'Comment'},
'comment': ('django.db.models.fields.TextField', [], {}),
'consent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'submitter_email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
'submitter_name': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {}),
'violation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Violation']"})
},
'bt.confirmation': {
'Meta': {'object_name': 'Confirmation'},
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}),
'violation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['bt.Violation']"})
},
'bt.featuredcase': {
'Meta': {'object_name': 'FeaturedCase'},
'case': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['bt.Violation']", 'unique': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'bt.operator': {
'Meta': {'object_name': 'Operator'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'logo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '256'})
},
'bt.violation': {
'Meta': {'object_name': 'Violation'},
'activationid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'contract': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'contract_excerpt': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'contractual': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
'editorial': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'loophole': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'media': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'operator_ref': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'violations'", 'to': "orm['bt.Operator']"}),
'resource': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'resource_name': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'blank': 'True'}),
'state': ('django.db.models.fields.CharField', [], {'default': "'new'", 'max_length': '20', 'blank': 'True'}),
'temporary': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'})
}
}
complete_apps = ['bt']
\ No newline at end of file
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.comments.moderation import CommentModerator, moderator
from django_comments.moderation import CommentModerator, moderator
COUNTRIES = (
('BE', _('Belgium')),
......
......@@ -6,7 +6,7 @@ from django.conf import settings
from bt.models import Violation
from django.db.models import Count
import ooolib
import odslib
from django.utils.html import strip_tags
import re, htmlentitydefs
##
......
......@@ -2,7 +2,7 @@ from django.template import Library, Variable
from django.conf import settings
from django import template
import random
from nnmon.bt.models import COUNTRIES, STATUS, TYPES, MEDIA
from ..models import COUNTRIES, STATUS, TYPES, MEDIA
register = Library()
......
Reading emails in development mode
==================================
In development mode, emails are written in `/tmp/app-messages/`.
To find the last sent email use your funcky `ls` command:
ls -ltr
SETUP
=====
This describes how to setup the nnmon dev environment
Install the base dependencies
-----------------------------
Install the following packages:
sudo aptitude install python-sqlite python-ooolib python-imaging
Install the base python virtualenv tools:
sudo apt-get install python-setuptools
sudo pip install virtualenv
sudo pip install virtualenvwrapper
You don't use the virtualenv/virtualenvwrapper tools yet
--------------------------------------------------------
Create a directory to hold the virtual environments:
mkdir ~/.virtualenvs
Add to your .bashrc (or equivalent) the following lines:
export WORKON_HOME=$HOME'/.virtualenvs'
source /usr/local/bin/virtualenvwrapper.sh
Then run the following command:
source ~/.bashrc
This will end up creating (relatively large) folders in ~/.virtualenvs
where all the projet dependencies will be installed.
Setup your virtual environment
-----------------------------
Create the virtualenv for nnmon and workon it:
mkvirtualenv --system-site-packages --distribute nnmon
Install nnmon's depdendencies:
pip install -r pip-requirements.txt
Run the server
--------------
cd ../nnmon
python manage.py syncdb # run the database migrations
python manage.py runserver 8080
Your application is available on [http://localhost:8080/](http://localhost:8080/)
#!/bin/sh
# launch this in the python virtualenv to regenerate the .pot :
pybabel extract -F babel.cfg -o locale/django.pot .
# then this to push it to transifex (after cheching you didn't loose anything
# tx push -s
# To pull the translated language do this :
# tx pull
# To add a language link with transifex do :
# tx set -r nnmon.messagespot -l nl locale/nl/LC_MESSAGES/django.po
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/bin/sh
echo "Compiling django/gettext language files ..."
echo -n " "
for i in `find -mindepth 1 -maxdepth 1 -type d`
do
echo -n "$i "
cd $i/LC_MESSAGES
msgfmt -o django.mo django.po
cd ../..
done
echo " Finished"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
sys.exit(1)
import settings
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
execute_manager(settings)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "respect_my_net_new.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
This diff is collapsed.
#map {
border: 2px solid #745C1B;
background: #fff url(../img/noise.png);
border-radius: 5px;
margin: 1em;
width: 300px;
height: 280px;
}
svg path { stroke-linejoin: round }
svg .sea {
fill: #fff;
stroke-width: .25px;
}
svg .graticule