forked from 0x2620/pandora
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'])
|
||||
if 'frame' in request.FILES:
|
||||
if f.frames.count() == 0:
|
||||
|
@ -134,8 +133,7 @@ def upload(request):
|
|||
name = frame.name
|
||||
#float required?
|
||||
position = float(os.path.splitext(name)[0])
|
||||
fr = models.Frame(file=f, position=position)
|
||||
fr.save()
|
||||
fr, created = models.Frame.objects.get_or_create(file=f, position=position)
|
||||
fr.frame.save(name, frame)
|
||||
response = json_response({})
|
||||
else:
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
# Create your views here.
|
||||
from django.shortcuts import get_object_or_404, redirect
|
||||
|
||||
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)
|
||||
url = '/%s' % alias.new
|
||||
if view:
|
||||
url += '/' + {
|
||||
'editor': 'timeline',
|
||||
}.get(view, view)
|
||||
#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}),
|
||||
)
|
||||
|
||||
urlpatterns += patterns('',
|
||||
(r'^(V[a-z0-9]*)$', 'urlalias.views.padma_video'),
|
||||
(r'^(V[a-z0-9]*/.*)$', 'urlalias.views.padma_video'),
|
||||
)
|
||||
urlpatterns += patterns('',
|
||||
(r'^.*?embed$', 'app.views.embed'),
|
||||
(r'^[A-Z0-9].*$', 'app.views.index'),
|
||||
|
|
Loading…
Reference in a new issue