Commit 44bbca8a authored by jc's avatar jc

fixes with autopep8

parent 0161a2d3
from django.contrib import admin from django.contrib import admin
from bt import models from bt import models
class CommentInline(admin.TabularInline): class CommentInline(admin.TabularInline):
model = models.Comment model = models.Comment
max_num = 1 max_num = 1
class ViolationAdmin(admin.ModelAdmin): class ViolationAdmin(admin.ModelAdmin):
list_display = ('state', 'country', 'operator', 'contract', 'resource_name', 'media', 'activationid', 'old', 'creation_date') list_display = ('state', 'country', 'operator', 'contract', 'resource_name', 'media', 'activationid', 'old', 'creation_date')
list_filter = ('state', 'operator_ref', 'contract', 'resource_name', 'media', 'country', 'old') list_filter = ('state', 'operator_ref', 'contract', 'resource_name', 'media', 'country', 'old')
inlines = [CommentInline, ] inlines = [CommentInline, ]
admin.site.register(models.Violation, ViolationAdmin) admin.site.register(models.Violation, ViolationAdmin)
class CommentAdmin(admin.ModelAdmin): class CommentAdmin(admin.ModelAdmin):
list_display = ('violation', 'submitter_name', 'comment') list_display = ('violation', 'submitter_name', 'comment')
list_filter = ('violation', 'submitter_name') list_filter = ('violation', 'submitter_name')
admin.site.register(models.Comment, CommentAdmin) admin.site.register(models.Comment, CommentAdmin)
class AttachmentAdmin(admin.ModelAdmin): class AttachmentAdmin(admin.ModelAdmin):
list_display = ('name', 'comment') list_display = ('name', 'comment')
admin.site.register(models.Attachment, AttachmentAdmin) admin.site.register(models.Attachment, AttachmentAdmin)
class ConfirmationAdmin(admin.ModelAdmin): class ConfirmationAdmin(admin.ModelAdmin):
list_display = ('violation', 'key') list_display = ('violation', 'key')
list_filter = ('violation__operator_ref', 'violation__contract', 'violation__resource_name', 'violation__media', 'violation__country') list_filter = ('violation__operator_ref', 'violation__contract', 'violation__resource_name', 'violation__media', 'violation__country')
admin.site.register(models.Confirmation, ConfirmationAdmin) admin.site.register(models.Confirmation, ConfirmationAdmin)
class FeaturedCaseAdmin(admin.ModelAdmin): class FeaturedCaseAdmin(admin.ModelAdmin):
pass pass
admin.site.register(models.FeaturedCase, FeaturedCaseAdmin) admin.site.register(models.FeaturedCase, FeaturedCaseAdmin)
class OperatorAdmin(admin.ModelAdmin): class OperatorAdmin(admin.ModelAdmin):
list_display = ("__unicode__", "reported_violations") list_display = ("__unicode__", "reported_violations")
search_fields = ('name', ) search_fields = ('name', )
pass pass
admin.site.register(models.Operator, OperatorAdmin)
\ No newline at end of file
admin.site.register(models.Operator, OperatorAdmin)
...@@ -5,7 +5,7 @@ from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS ...@@ -5,7 +5,7 @@ from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from bt.models import Violation, Operator from bt.models import Violation, Operator
#class UserResource(ModelResource): # class UserResource(ModelResource):
# class Meta: # class Meta:
# queryset = User.objects.all() # queryset = User.objects.all()
# resource_name = 'auth/user' # resource_name = 'auth/user'
......
...@@ -2,6 +2,7 @@ from django.contrib.syndication.views import Feed ...@@ -2,6 +2,7 @@ from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed from django.utils.feedgenerator import Atom1Feed
from bt.models import Violation from bt.models import Violation
class RssSiteNewsFeed(Feed): class RssSiteNewsFeed(Feed):
title = "NNMON - Latest NN Infringements" title = "NNMON - Latest NN Infringements"
link = "/" link = "/"
...@@ -17,7 +18,7 @@ class RssSiteNewsFeed(Feed): ...@@ -17,7 +18,7 @@ class RssSiteNewsFeed(Feed):
def item_title(self, item): def item_title(self, item):
return "%s (%s) %s" % (item.operator, item.country, item.contract) return "%s (%s) %s" % (item.operator, item.country, item.contract)
class AtomSiteNewsFeed(RssSiteNewsFeed): class AtomSiteNewsFeed(RssSiteNewsFeed):
feed_type = Atom1Feed feed_type = Atom1Feed
subtitle = RssSiteNewsFeed.description subtitle = RssSiteNewsFeed.description
...@@ -8,16 +8,19 @@ from bt.multifile import MultiFileField ...@@ -8,16 +8,19 @@ from bt.multifile import MultiFileField
from operator import itemgetter from operator import itemgetter
from captcha.fields import CaptchaField from captcha.fields import CaptchaField
class AdvancedEditor(forms.Textarea): class AdvancedEditor(forms.Textarea):
class Media: class Media:
js = (settings.MEDIA_URL+'/js/tinymce/tiny_mce.js',) js = (settings.MEDIA_URL + '/js/tinymce/tiny_mce.js',)
def __init__(self, language=None, attrs=None): def __init__(self, language=None, attrs=None):
self.language = language or settings.LANGUAGE_CODE[:2] self.language = language or settings.LANGUAGE_CODE[:2]
self.attrs = {'class': 'advancededitor'} self.attrs = {'class': 'advancededitor'}
if attrs: self.attrs.update(attrs) if attrs:
self.attrs.update(attrs)
super(AdvancedEditor, self).__init__(attrs) super(AdvancedEditor, self).__init__(attrs)
class AddViolation(forms.Form): class AddViolation(forms.Form):
resource_name = forms.CharField(required=True, max_length=4096, label=_('Please describe the discrimination'), help_text=_("What service or site, or person is unavailable or seems artificially slowed down. e.g. VoIP, p2p, filesharing, specific websites, etc.")) resource_name = forms.CharField(required=True, max_length=4096, label=_('Please describe the discrimination'), help_text=_("What service or site, or person is unavailable or seems artificially slowed down. e.g. VoIP, p2p, filesharing, specific websites, etc."))
country = forms.ChoiceField(required=True, choices=(('',''),)+tuple(sorted(COUNTRIES,key=itemgetter(1))), label=_("Country"), help_text=_('EU member state where the discrimination is reported.')) country = forms.ChoiceField(required=True, choices=(('',''),)+tuple(sorted(COUNTRIES,key=itemgetter(1))), label=_("Country"), help_text=_('EU member state where the discrimination is reported.'))
...@@ -67,5 +70,6 @@ class SearchViolation(SearchForm): ...@@ -67,5 +70,6 @@ class SearchViolation(SearchForm):
return sqs return sqs
class QuickSearchViolation(forms.Form): class QuickSearchViolation(forms.Form):
query = forms.CharField(required='True', max_length=256, label=_("Search"), help_text=_('Search for an existing violation')) query = forms.CharField(required='True', max_length=256, label=_("Search"), help_text=_('Search for an existing violation'))
...@@ -36,7 +36,7 @@ COUNTRIES = ( ...@@ -36,7 +36,7 @@ COUNTRIES = (
('FI', _('Finland')), ('FI', _('Finland')),
('SE', _('Sweden')), ('SE', _('Sweden')),
('UK', _('United Kingdom')), ('UK', _('United Kingdom')),
) )
RESOURCES = ( RESOURCES = (
('other', _('other')), ('other', _('other')),
('port', _('port')), ('port', _('port')),
...@@ -48,7 +48,7 @@ RESOURCES = ( ...@@ -48,7 +48,7 @@ RESOURCES = (
('video', _('video streaming')), ('video', _('video streaming')),
('audio', _('audio streaming')), ('audio', _('audio streaming')),
('class', _('class of application or contraint')), ('class', _('class of application or contraint')),
) )
TYPES = ( TYPES = (
('zerorating', _('Zero Rating')), ('zerorating', _('Zero Rating')),
('specialised', _('Specialised Service')), ('specialised', _('Specialised Service')),
...@@ -56,11 +56,11 @@ TYPES = ( ...@@ -56,11 +56,11 @@ TYPES = (
('throttling', _('Throttling')), ('throttling', _('Throttling')),
('prioritisation', _('Prioritisation')), ('prioritisation', _('Prioritisation')),
('other', _('Other')) ('other', _('Other'))
) )
MEDIA = ( MEDIA = (
('fixed', _('Fixed')), ('fixed', _('Fixed')),
('mobile', _('Mobile')), ('mobile', _('Mobile')),
) )
STATUS = ( STATUS = (
('moreinfo', _('Need more info')), ('moreinfo', _('Need more info')),
('new', _('New')), ('new', _('New')),
...@@ -69,7 +69,8 @@ STATUS = ( ...@@ -69,7 +69,8 @@ STATUS = (
('ooscope', _('Out of scope')), ('ooscope', _('Out of scope')),
('resolved', _('Resolved')), ('resolved', _('Resolved')),
('closed', _('Closed')), ('closed', _('Closed')),
) )
class Operator(models.Model): class Operator(models.Model):
""" """
...@@ -85,6 +86,7 @@ class Operator(models.Model): ...@@ -85,6 +86,7 @@ class Operator(models.Model):
def __unicode__(self): def __unicode__(self):
return self.name return self.name
class Violation(models.Model): class Violation(models.Model):
country = models.CharField(max_length=2, choices=COUNTRIES) country = models.CharField(max_length=2, choices=COUNTRIES)
operator_ref = models.ForeignKey(Operator, related_name="violations") operator_ref = models.ForeignKey(Operator, related_name="violations")
...@@ -92,12 +94,12 @@ class Violation(models.Model): ...@@ -92,12 +94,12 @@ class Violation(models.Model):
resource = models.CharField(max_length=20, choices=RESOURCES, blank=True) resource = models.CharField(max_length=20, choices=RESOURCES, blank=True)
resource_name = models.CharField(max_length=4096, blank=True) resource_name = models.CharField(max_length=4096, blank=True)
type = models.CharField(max_length=20, choices=TYPES, blank=True) type = models.CharField(max_length=20, choices=TYPES, blank=True)
media = models.CharField( max_length=20, choices=MEDIA, blank=True) media = models.CharField(max_length=20, choices=MEDIA, blank=True)
temporary = models.BooleanField( ) temporary = models.BooleanField()
contractual = models.BooleanField() contractual = models.BooleanField()
contract_excerpt = models.TextField(null=True, blank=True) contract_excerpt = models.TextField(null=True, blank=True)
loophole = models.BooleanField() loophole = models.BooleanField()
activationid= models.CharField(max_length=128, null=True, blank=True) activationid = models.CharField(max_length=128, null=True, blank=True)
state = models.CharField(max_length=20, choices=STATUS, default='new', blank=True) state = models.CharField(max_length=20, choices=STATUS, default='new', blank=True)
editorial = models.TextField(null=True, blank=True) editorial = models.TextField(null=True, blank=True)
old = models.BooleanField(default="False") old = models.BooleanField(default="False")
...@@ -131,7 +133,7 @@ class Violation(models.Model): ...@@ -131,7 +133,7 @@ class Violation(models.Model):
class Comment(models.Model): class Comment(models.Model):
submitter_email = models.EmailField() submitter_email = models.EmailField()
submitter_name = models.CharField(max_length=20) submitter_name = models.CharField(max_length=20)
consent = models.BooleanField( ) consent = models.BooleanField()
comment = models.TextField() comment = models.TextField()
timestamp = models.DateTimeField() timestamp = models.DateTimeField()
violation = models.ForeignKey(Violation) violation = models.ForeignKey(Violation)
...@@ -142,10 +144,11 @@ class Comment(models.Model): ...@@ -142,10 +144,11 @@ class Comment(models.Model):
def __unicode__(self): def __unicode__(self):
return _("Comment #%s") % (self.pk) return _("Comment #%s") % (self.pk)
class Attachment(models.Model): class Attachment(models.Model):
storage = models.FileField(upload_to='static') storage = models.FileField(upload_to='static')
name= models.CharField(max_length=512) name = models.CharField(max_length=512)
type= models.CharField(max_length=512) type = models.CharField(max_length=512)
comment = models.ForeignKey(Comment) comment = models.ForeignKey(Comment)
class Admin: class Admin:
...@@ -154,23 +157,28 @@ class Attachment(models.Model): ...@@ -154,23 +157,28 @@ class Attachment(models.Model):
def __unicode__(self): def __unicode__(self):
return self.name return self.name
class Confirmation(models.Model): class Confirmation(models.Model):
key=models.CharField(max_length=64, blank=True) key = models.CharField(max_length=64, blank=True)
email=models.EmailField() email = models.EmailField()
violation = models.ForeignKey(Violation) violation = models.ForeignKey(Violation)
class Admin: class Admin:
pass pass
class ViolationModerator(CommentModerator): class ViolationModerator(CommentModerator):
email_notification = True email_notification = True
moderate_after = 0 moderate_after = 0
def moderate(self, comment, content_object, request): def moderate(self, comment, content_object, request):
return True return True
if Violation not in moderator._registry: if Violation not in moderator._registry:
moderator.register(Violation, ViolationModerator) moderator.register(Violation, ViolationModerator)
class FeaturedCase(models.Model): class FeaturedCase(models.Model):
case = models.OneToOneField(Violation) case = models.OneToOneField(Violation)
......
...@@ -16,6 +16,7 @@ from django.utils.safestring import mark_safe ...@@ -16,6 +16,7 @@ from django.utils.safestring import mark_safe
FILE_INPUT_EMPTY_VALUE = object() FILE_INPUT_EMPTY_VALUE = object()
class MultiFileInput(Input): class MultiFileInput(Input):
""" """
A widget to be used by the MultiFileField to allow the user to upload A widget to be used by the MultiFileField to allow the user to upload
...@@ -57,6 +58,7 @@ class MultiFileInput(Input): ...@@ -57,6 +58,7 @@ class MultiFileInput(Input):
return id_ return id_
id_for_label = classmethod(id_for_label) id_for_label = classmethod(id_for_label)
class MultiFileField(Field): class MultiFileField(Field):
""" """
A field allowing users to upload multiple files at once. A field allowing users to upload multiple files at once.
......
from haystack import indexes from haystack import indexes
from models import Operator, Violation from models import Operator, Violation
class ViolationIndexes(indexes.SearchIndex, indexes.Indexable): class ViolationIndexes(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True) text = indexes.CharField(document=True, use_template=True)
operator = indexes.CharField(model_attr="operator_ref") operator = indexes.CharField(model_attr="operator_ref")
......
...@@ -8,7 +8,8 @@ from bt.models import Violation ...@@ -8,7 +8,8 @@ from bt.models import Violation
from django.db.models import Count from django.db.models import Count
import odslib import odslib
from django.utils.html import strip_tags from django.utils.html import strip_tags
import re, htmlentitydefs import re
import htmlentitydefs
## ##
# Removes HTML or XML character references and entities from a text string. # Removes HTML or XML character references and entities from a text string.
# #
...@@ -16,8 +17,10 @@ import re, htmlentitydefs ...@@ -16,8 +17,10 @@ import re, htmlentitydefs
# @return The plain text, as a Unicode string, if necessary. # @return The plain text, as a Unicode string, if necessary.
# source: http://effbot.org/zone/re-sub.htm # source: http://effbot.org/zone/re-sub.htm
def unescape(text): def unescape(text):
text=strip_tags(text) text = strip_tags(text)
def fixup(m): def fixup(m):
text = m.group(0) text = m.group(0)
if text[:2] == "&#": if text[:2] == "&#":
...@@ -35,47 +38,49 @@ def unescape(text): ...@@ -35,47 +38,49 @@ def unescape(text):
text = unichr(htmlentitydefs.name2codepoint[text[1:-1]]) text = unichr(htmlentitydefs.name2codepoint[text[1:-1]])
except KeyError: except KeyError:
pass pass
return text # leave as is return text # leave as is
return re.sub("&#?\w+;", fixup, text) return re.sub("&#?\w+;", fixup, text)
def save_ods(): def save_ods():
# Create your document # Create your document
doc = ooolib.Calc() doc = ooolib.Calc()
col=1 col = 1
row=2 row = 2
doc.set_cell_property('bold', True) doc.set_cell_property('bold', True)
doc.set_row_property(row, 'height', '16.5pt') doc.set_row_property(row, 'height', '16.5pt')
for heading, width in [('Country', '73pt'), for heading, width in [('Country', '73pt'),
('Operator', '77pt'), ('Operator', '77pt'),
('Type of measure*','355pt'), ('Type of measure*', '355pt'),
('','355pt'), ('', '355pt'),
('Description of the measure', '148pt'), ('Description of the measure', '148pt'),
('Objective',''), ('Objective', ''),
('Method of implementation (if applicable)',''), ('Method of implementation (if applicable)', ''),
('Number of subscribers having a subscription where this measure is implemented',''), ('Number of subscribers having a subscription where this measure is implemented', ''),
('How is the user informed?','148pt'), ('How is the user informed?', '148pt'),
('Can the user activate/deactivate the measure? How?', '148pt'), ('Can the user activate/deactivate the measure? How?', '148pt'),
('Protection of business secret','239pt')]: ('Protection of business secret', '239pt')]:
if width: doc.set_column_property(col, 'width', width) if width:
doc.set_column_property(col, 'width', width)
doc.set_cell_value(col, row, "string", heading) doc.set_cell_value(col, row, "string", heading)
col+=1 col += 1
doc.set_cell_property('bold', False) doc.set_cell_property('bold', False)
row=3 row = 3
for v in Violation.objects.filter(activationid='').exclude(state__in=['closed', 'ooscope', 'duplicate']).annotate(total=Count('confirmation')): for v in Violation.objects.filter(activationid='').exclude(state__in=['closed', 'ooscope', 'duplicate']).annotate(total=Count('confirmation')):
if v.total>0 or v.state=='verified': if v.total > 0 or v.state == 'verified':
doc.set_row_property(row, 'height', '16.5pt') doc.set_row_property(row, 'height', '16.5pt')
doc.set_cell_property('wrap-option', 'wrap') doc.set_cell_property('wrap-option', 'wrap')
doc.set_cell_value(1, row, "string", v.country) doc.set_cell_value(1, row, "string", v.country)
doc.set_cell_value(2, row, "string", v.operator) doc.set_cell_value(2, row, "string", v.operator)
doc.set_cell_value(3, row, "string", "%s %s" % (v.type, v.resource_name)) doc.set_cell_value(3, row, "string", "%s %s" % (v.type, v.resource_name))
doc.set_cell_value(5, row, "string", "%s\n\n%s" % ( v.editorial, unescape(v.comment_set.get().comment))) doc.set_cell_value(5, row, "string", "%s\n\n%s" % (v.editorial, unescape(v.comment_set.get().comment)))
doc.set_cell_value(9, row, "string", "%s %s" % ("Contractual" if v.contractual else "", unescape(v.contract_excerpt))) doc.set_cell_value(9, row, "string", "%s %s" % ("Contractual" if v.contractual else "", unescape(v.contract_excerpt)))
doc.set_cell_value(10, row, "string", "can update to a different dataplan" if v.loophole else "") doc.set_cell_value(10, row, "string", "can update to a different dataplan" if v.loophole else "")
doc.set_cell_value(12, row, "string", v.media) doc.set_cell_value(12, row, "string", v.media)
row+=1 row += 1
#(v.state, v.country, v.operator, v.contract, v.resource, v.resource_name, v.type, v.media, v.temporary, v.contractual, v.contract_excerpt, v.loophole, v.editorial,v.comment_set.get().comment) #(v.state, v.country, v.operator, v.contract, v.resource, v.resource_name, v.type, v.media, v.temporary, v.contractual, v.contract_excerpt, v.loophole, v.editorial,v.comment_set.get().comment)
# Save the document to the file you want to create # Save the document to the file you want to create
......
...@@ -6,20 +6,28 @@ from ..models import COUNTRIES, STATUS, TYPES, MEDIA ...@@ -6,20 +6,28 @@ from ..models import COUNTRIES, STATUS, TYPES, MEDIA
register = Library() register = Library()
@register.simple_tag @register.simple_tag
def root_url(): def root_url():
return settings.ROOT_URL return settings.ROOT_URL
@register.simple_tag @register.simple_tag
def media_url(): def media_url():
return settings.MEDIA_URL return settings.MEDIA_URL
country_map=dict(COUNTRIES)
country_map = dict(COUNTRIES)
@register.filter(name='country') @register.filter(name='country')
def country(code): def country(code):
return country_map[code] return country_map[code]
status_map=dict(STATUS)
status_map = dict(STATUS)
@register.filter(name='status') @register.filter(name='status')
def status(code): def status(code):
try: try:
...@@ -27,7 +35,10 @@ def status(code): ...@@ -27,7 +35,10 @@ def status(code):
except: except:
return code return code
type_map=dict(TYPES)
type_map = dict(TYPES)
@register.filter(name='type') @register.filter(name='type')
def type(code): def type(code):
try: try:
...@@ -35,7 +46,10 @@ def type(code): ...@@ -35,7 +46,10 @@ def type(code):
except: except:
return code return code
media_map=dict(MEDIA)
media_map = dict(MEDIA)
@register.filter(name='media') @register.filter(name='media')
def media(code): def media(code):
try: try:
......
...@@ -6,6 +6,7 @@ import json ...@@ -6,6 +6,7 @@ import json
register = Library() register = Library()
@register.filter(name='jsonify') @register.filter(name='jsonify')
def jsonify(object): def jsonify(object):
if isinstance(object, QuerySet): if isinstance(object, QuerySet):
......
This diff is collapsed.
...@@ -13,82 +13,82 @@ operator_api_resource = OperatorResource() ...@@ -13,82 +13,82 @@ operator_api_resource = OperatorResource()
admin.autodiscover() admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', url(r'^$',
view=bt.AddForm.as_view(), view=bt.AddForm.as_view(),
name="homepage"), name="homepage"),
url(r'^list/$', url(r'^list/$',
view=bt.ViolationsList.as_view(), view=bt.ViolationsList.as_view(),
name="list_violations"), name="list_violations"),
url(r'^list/(?P<country>\w+)/$', url(r'^list/(?P<country>\w+)/$',
view=bt.ViolationsList.as_view(), view=bt.ViolationsList.as_view(),
name="filter_country"), name="filter_country"),
url(r'^list/(?P<country>\w+)/(?P<operator>\w+)/$', url(r'^list/(?P<country>\w+)/(?P<operator>\w+)/$',
view=bt.ViolationsList.as_view(), view=bt.ViolationsList.as_view(),
name="filter_operator"), name="filter_operator"),
# violation cannonical url and redirections # violation cannonical url and redirections
url(r'^(?P<id>[0-9]*)$', url(r'^(?P<id>[0-9]*)$',
RedirectView.as_view(url='/view/%(id)s')), RedirectView.as_view(url='/view/%(id)s')),
url(r'^view/(?P<id>[0-9]*)$', url(r'^view/(?P<id>[0-9]*)$',
view=bt.ViolationView.as_view(), view=bt.ViolationView.as_view(),
name="violation_url"), name="violation_url"),
url(r'^attach/(?P<id>[0-9]*)$', url(r'^attach/(?P<id>[0-9]*)$',
view=bt.get_attach, view=bt.get_attach,
name="attach"), name="attach"),
# different data outputs # different data outputs
url(r'^csv$', url(r'^csv$',
view=bt.ViolationCsvList.as_view(), view=bt.ViolationCsvList.as_view(),
name="csv_output"), name="csv_output"),
url(r'^ods$', url(r'^ods$',
view=bt.asods, view=bt.asods,
name="ods_output"), name="ods_output"),
url(r'^rss/$', url(r'^rss/$',
view=RssSiteNewsFeed(), view=RssSiteNewsFeed(),
name="rss_output"), name="rss_output"),
url(r'^atom/$', url(r'^atom/$',
view=AtomSiteNewsFeed(), view=AtomSiteNewsFeed(),
name="atom_output"), name="atom_output"),
url(r'^activate/$', url(r'^activate/$',
view=bt.activate, view=bt.activate,
name="activate"), name="activate"),
url(r'^confirm/(?P<id>[0-9a-z]*)$', url(r'^confirm/(?P<id>[0-9a-z]*)$',
view=bt.confirm, view=bt.confirm,
name="confirm"), name="confirm"),
url(r'^confirm/(?P<id>[0-9]*)/(?P<name>.*)$', url(r'^confirm/(?P<id>[0-9]*)/(?P<name>.*)$',
view=bt.confirm, view=bt.confirm,
name="confirm_full"), name="confirm_full"),
url(r'^moderate/$', url(r'^moderate/$',
view=bt.moderate, view=bt.moderate,
name="moderate"), name="moderate"),
url(r'^lookup/', url(r'^lookup/',
view=bt.LookupView.as_view(template_name='search/lookup.json'), view=bt.LookupView.as_view(template_name='search/lookup.json'),
name="lookup"), name="lookup"),
url(r'^accounts/logout$', url(r'^accounts/logout$',
'django.contrib.auth.views.logout', {'next_page': '/'}), 'django.contrib.auth.views.logout', {'next_page': '/'}),
url(r'^accounts/', url(r'^accounts/',
include('registration.backends.hmac.urls')), include('registration.backends.hmac.urls')),
url(r'^comments/', url(r'^comments/',
include('django_comments.urls')), include('django_comments.urls')),
url(r'^about/$', url(r'^about/$',
TemplateView.as_view(template_name='nn.html')), TemplateView.as_view(template_name='nn.html')),
url(r'^start/$', url(r'^start/$',
TemplateView.as_view(template_name='start.html')), TemplateView.as_view(template_name='start.html')),
url(r'^captcha/', url(r'^captcha/',
include('captcha.urls')), include('captcha.urls')),
url(r'^admin/', url(r'^admin/',
include(admin.site.urls)), include(admin.site.urls)),
url(r'^api/', url(r'^api/',
include(api_resource.urls)), include(api_resource.urls)),
url(r'^api/', url(r'^api/',
include(operator_api_resource.urls)), include(operator_api_resource.urls)),
url(r'^search/', url(r'^search/',
bt.ViolationSearchView.as_view(template_name='search/search.html')), bt.ViolationSearchView.as_view(template_name='search/search.html')),
# Language switch # Language switch
url(r'^i18n/', include('django.conf.urls.i18n')), url(r'^i18n/', include('django.conf.urls.i18n')),
)