pad.ma urls
This commit is contained in:
parent
1b8a3b37ce
commit
daabd64677
3 changed files with 16 additions and 5 deletions
|
@ -126,7 +126,6 @@ def upload(request):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
user = request.user
|
|
||||||
f = get_object_or_404_json(models.File, oshash=request.POST['oshash'])
|
f = get_object_or_404_json(models.File, oshash=request.POST['oshash'])
|
||||||
if 'frame' in request.FILES:
|
if 'frame' in request.FILES:
|
||||||
if f.frames.count() == 0:
|
if f.frames.count() == 0:
|
||||||
|
@ -134,8 +133,7 @@ def upload(request):
|
||||||
name = frame.name
|
name = frame.name
|
||||||
#float required?
|
#float required?
|
||||||
position = float(os.path.splitext(name)[0])
|
position = float(os.path.splitext(name)[0])
|
||||||
fr = models.Frame(file=f, position=position)
|
fr, created = models.Frame.objects.get_or_create(file=f, position=position)
|
||||||
fr.save()
|
|
||||||
fr.frame.save(name, frame)
|
fr.frame.save(name, frame)
|
||||||
response = json_response({})
|
response = json_response({})
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
|
||||||
def padma_video(request, hid, view=''):
|
def padma_video(request, url):
|
||||||
|
url = url.split('/')
|
||||||
|
hid = url[0]
|
||||||
|
if len(url) > 1:
|
||||||
|
view = url[1]
|
||||||
|
else:
|
||||||
|
view = None
|
||||||
alias = get_object_or_404(models.IDAlias, old=hid)
|
alias = get_object_or_404(models.IDAlias, old=hid)
|
||||||
url = '/%s' % alias.new
|
url = '/%s' % alias.new
|
||||||
if view:
|
if view:
|
||||||
url += '/' + {
|
url += '/' + {
|
||||||
|
'editor': 'timeline',
|
||||||
}.get(view, view)
|
}.get(view, view)
|
||||||
#FIXME: reqire layer urls, reqrite timerange urls
|
#FIXME: reqire layer urls, reqrite timerange urls
|
||||||
raise redirect(url)
|
return redirect(url)
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,10 @@ if settings.DEBUG:
|
||||||
{'document_root': settings.TESTS_ROOT}),
|
{'document_root': settings.TESTS_ROOT}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
urlpatterns += patterns('',
|
||||||
|
(r'^(V[a-z0-9]*)$', 'urlalias.views.padma_video'),
|
||||||
|
(r'^(V[a-z0-9]*/.*)$', 'urlalias.views.padma_video'),
|
||||||
|
)
|
||||||
urlpatterns += patterns('',
|
urlpatterns += patterns('',
|
||||||
(r'^.*?embed$', 'app.views.embed'),
|
(r'^.*?embed$', 'app.views.embed'),
|
||||||
(r'^[A-Z0-9].*$', 'app.views.index'),
|
(r'^[A-Z0-9].*$', 'app.views.index'),
|
||||||
|
|
Loading…
Reference in a new issue