queryviews

This commit is contained in:
unknown 2012-04-28 00:01:45 +02:00
commit e16d8941c4
2 changed files with 6 additions and 1 deletions

View File

@ -121,7 +121,8 @@ def addType(inFile, outFile):
outFile.write(outJSON) outFile.write(outJSON)
outFile.close() outFile.close()
def importJSON(filename): #prefix is a silly quick-fix for date like creekmanifest1201
def importJSON(filename, prefix=""):
data = json.loads(open(filename).read()) data = json.loads(open(filename).read())
errors_ships = [] errors_ships = []
errors_goods = [] errors_goods = []
@ -129,6 +130,8 @@ def importJSON(filename):
for manifest in data: for manifest in data:
m = Manifest() m = Manifest()
m.filename = manifest['filename'] m.filename = manifest['filename']
if prefix != '':
manifest['date'] = manifest['date'].replace(prefix, "")
month = manifest['date'][0:3] month = manifest['date'][0:3]
yr = manifest['date'][3:5] yr = manifest['date'][3:5]
m.month = month m.month = month

View File

@ -17,6 +17,8 @@ urlpatterns = patterns('',
(r'^$', 'ships.views.shipList'), (r'^$', 'ships.views.shipList'),
(r'^uniqueShips', 'ships.queryviews.uniqueShips'),
(r'^uniquePorts', 'ships.queryviews.uniquePorts'),
# for human translators # for human translators
(r'^trans/(?P<model>[A-Za-z].*?)/(?P<field>[A-Za-z].*?)/(?P<page_no>\d*)/', 'ships.views.translate'), (r'^trans/(?P<model>[A-Za-z].*?)/(?P<field>[A-Za-z].*?)/(?P<page_no>\d*)/', 'ships.views.translate'),
(r'^dotrans/(?P<model>[A-Za-z].*?)/(?P<field>[A-Za-z].*?)/', 'ships.views.dotranslate'), (r'^dotrans/(?P<model>[A-Za-z].*?)/(?P<field>[A-Za-z].*?)/', 'ships.views.dotranslate'),