Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
from django.conf import settings | ||
from django.conf.urls import patterns, url | ||
from django.views.generic.edit import FormView | ||
from django.forms import Form | ||
from django.core.urlresolvers import reverse | ||
|
||
from resumable.views import ResumableUploadView | ||
from resumable.fields import ResumableFileField | ||
|
||
|
||
class ResumableForm(Form): | ||
file = ResumableFileField( | ||
allowed_mimes=("audio/ogg",), | ||
upload_url=lambda: reverse('upload'), | ||
chunks_dir=getattr(settings, 'FILE_UPLOAD_TEMP_DIR') | ||
) | ||
|
||
|
||
class TestFormView(FormView): | ||
form_class = ResumableForm | ||
template_name = 'form.html' | ||
|
||
@property | ||
def success_url(self): | ||
return reverse('form') | ||
|
||
|
||
urlpatterns = patterns('', | ||
url('upload/', ResumableUploadView.as_view(), name='upload') | ||
url('^$', TestFormView.as_view(), name='form'), | ||
url('^upload/$', ResumableUploadView.as_view(), name='upload') | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<form method="post" action="."> | ||
<fieldset> | ||
{% csrf_token %} | ||
{{ form.as_p }} | ||
</fieldset> | ||
<p><input type="submit" value="send" /></p> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters