Markov: add a permission for importing from a log
This commit is contained in:
parent
399d419824
commit
acfcd574b5
@ -49,6 +49,9 @@ class MarkovState(models.Model):
|
||||
context = models.ForeignKey(MarkovContext)
|
||||
|
||||
class Meta:
|
||||
permissions = {
|
||||
('import_log_file', "Can import states from a log file"),
|
||||
}
|
||||
unique_together = ('context', 'k1', 'k2', 'v')
|
||||
|
||||
def __unicode__(self):
|
||||
|
@ -5,6 +5,7 @@ markov/views.py --- manipulate markov data
|
||||
|
||||
import logging
|
||||
|
||||
from django.contrib.auth.decorators import permission_required
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
|
||||
@ -21,6 +22,7 @@ def index(request):
|
||||
return HttpResponse()
|
||||
|
||||
|
||||
@permission_required('import_log_file', raise_exception=True)
|
||||
def import_file(request):
|
||||
"""Accept a file upload and turn it into markov stuff.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user