Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
45b438da
Unverified
Commit
45b438da
authored
Jul 23, 2018
by
seb-b
Committed by
GitHub
Jul 23, 2018
Browse files
Merge pull request #23 from takeflight/wagtail2
Convert to wagtail 2
parents
acb2eb87
c1ff2812
Changes
28
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
45b438da
*.pyc
*.egg-info
.*.swp
dist/
./settings.py
venv/
...
...
.travis.yml
View file @
45b438da
...
...
@@ -10,14 +10,15 @@ env:
python
:
-
2.7
-
3.4
-
3.5
-
3.6
env
:
-
DJANGO='110' WAGTAIL='19'
-
DJANGO='110' WAGTAIL='110'
-
DJANGO='111' WAGTAIL='110'
-
DJANGO='111' WAGTAIL='20'
-
DJANGO='111' WAGTAIL='21'
-
DJANGO='20' WAGTAIL='20'
-
DJANGO='20' WAGTAIL='21'
matrix
:
...
...
@@ -26,9 +27,10 @@ matrix:
python
:
3.5
before_install
:
#
- sudo add-apt-repository ppa:mc3man/trusty-media -y
// Inlcudes all multimedia options but 404s currently :(
-
sudo add-apt-repository ppa:mc3man/trusty-media -y
-
sudo apt-get update -qq
-
sudo apt-get install ffmpeg -y
# The install of ffmpeg fails at random with 'There were unauthenticated packages' 🤷♂️
-
sudo apt-get install ffmpeg --allow-unauthenticated -y
install
:
-
pip install --upgrade pip wheel tox
...
...
CHANGELOG.rst
View file @
45b438da
CHANGELOG
=========
2.0.0
-----
- Dropped python2
- Updated wagtail dependency to 2.0
0.4.0
-----
...
...
README.rst
View file @
45b438da
...
...
@@ -8,7 +8,7 @@ html5 compliant codec using ffmpeg.
Requirements
------------
- Wagtail >
1.7
- Wagtail >
= 2.0
- `ffmpeg <https://ffmpeg.org/>`__
Installing
...
...
setup.py
View file @
45b438da
...
...
@@ -10,7 +10,7 @@ from setuptools import find_packages, setup
setup
(
name
=
'wagtailvideos'
,
version
=
'
0.4
.0'
,
version
=
'
2.0
.0'
,
description
=
"A wagtail module for uploading and displaying videos in various codecs."
,
long_description
=
readme
,
author
=
'Takeflight'
,
...
...
@@ -18,9 +18,9 @@ setup(
url
=
'https://github.com/takeflight/wagtailvideos'
,
install_requires
=
[
'wagtail>=
1.7
'
,
'Django>=1.
9
'
,
'django-enumchoicefield==
0.6
.0'
,
'wagtail>=
2.0
'
,
'Django>=1.
11
'
,
'django-enumchoicefield==
1.0
.0'
,
],
extras_require
=
{
'testing'
:
[
...
...
@@ -42,11 +42,10 @@ setup(
'Intended Audience :: Developers'
,
'Operating System :: OS Independent'
,
'Programming Language :: Python'
,
'Programming Language :: Python :: 2'
,
'Programming Language :: Python :: 2.7'
,
'Programming Language :: Python :: 3'
,
'Programming Language :: Python :: 3.4'
,
'Programming Language :: Python :: 3.5'
,
'Programming Language :: Python :: 3.6'
,
'Framework :: Django'
,
'License :: OSI Approved :: BSD License'
,
],
...
...
tests/app/models.py
View file @
45b438da
from
__future__
import
unicode_literals
from
django.db
import
models
from
wagtail.
wagtail
core.models
import
Page
from
wagtail.core.models
import
Page
from
wagtailvideos.edit_handlers
import
VideoChooserPanel
...
...
tests/app/settings.py
View file @
45b438da
...
...
@@ -9,12 +9,13 @@ INSTALLED_APPS = [
'taggit'
,
'modelcluster'
,
'wagtail.wagtailcore'
,
'wagtail.wagtailadmin'
,
'wagtail.wagtailusers'
,
'wagtail.wagtailsites'
,
'wagtail.wagtailsnippets'
,
'wagtail.wagtailimages'
,
'wagtail.core'
,
'wagtail.admin'
,
'wagtail.users'
,
'wagtail.sites'
,
'wagtail.snippets'
,
'wagtail.images'
,
'wagtail.documents'
,
'django.contrib.admin'
,
'django.contrib.auth'
,
...
...
@@ -41,7 +42,7 @@ DEBUG = True
USE_TZ
=
True
TIME_ZONE
=
'Australia/Hobart'
MIDDLEWARE
_CLASSES
=
[
MIDDLEWARE
=
[
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
...
...
@@ -49,7 +50,7 @@ MIDDLEWARE_CLASSES = [
'django.contrib.messages.middleware.MessageMiddleware'
,
'django.middleware.clickjacking.XFrameOptionsMiddleware'
,
'wagtail.
wagtail
core.middleware.SiteMiddleware'
,
'wagtail.core.middleware.SiteMiddleware'
,
]
TEMPLATES
=
[
...
...
tests/app/urls.py
View file @
45b438da
...
...
@@ -5,8 +5,8 @@ import re
from
django.conf
import
settings
from
django.conf.urls
import
include
,
url
from
django.views.static
import
serve
from
wagtail.
wagtail
admin
import
urls
as
wagtailadmin_urls
from
wagtail.
wagtail
core
import
urls
as
wagtail_urls
from
wagtail.admin
import
urls
as
wagtailadmin_urls
from
wagtail.core
import
urls
as
wagtail_urls
urlpatterns
=
[
url
(
r
'^admin/'
,
include
(
wagtailadmin_urls
)),
...
...
tests/storage.py
View file @
45b438da
import
errno
import
os
import
warnings
from
datetime
import
datetime
from
django.conf
import
settings
...
...
@@ -10,7 +9,6 @@ from django.core.files.storage import FileSystemStorage
from
django.utils
import
timezone
from
django.utils._os
import
safe_join
from
django.utils.deconstruct
import
deconstructible
from
django.utils.deprecation
import
RemovedInDjango20Warning
from
django.utils.encoding
import
filepath_to_uri
,
force_text
from
django.utils.six.moves.urllib.parse
import
urljoin
...
...
@@ -145,33 +143,6 @@ class RemoteStorage(FileSystemStorage):
url
=
url
.
lstrip
(
'/'
)
return
urljoin
(
self
.
base_url
,
url
)
def
accessed_time
(
self
,
name
):
warnings
.
warn
(
'FileSystemStorage.accessed_time() is deprecated in favor of '
'get_accessed_time().'
,
RemovedInDjango20Warning
,
stacklevel
=
2
,
)
return
datetime
.
fromtimestamp
(
os
.
path
.
getatime
(
self
.
path
(
name
)))
def
created_time
(
self
,
name
):
warnings
.
warn
(
'FileSystemStorage.created_time() is deprecated in favor of '
'get_created_time().'
,
RemovedInDjango20Warning
,
stacklevel
=
2
,
)
return
datetime
.
fromtimestamp
(
os
.
path
.
getctime
(
self
.
path
(
name
)))
def
modified_time
(
self
,
name
):
warnings
.
warn
(
'FileSystemStorage.modified_time() is deprecated in favor of '
'get_modified_time().'
,
RemovedInDjango20Warning
,
stacklevel
=
2
,
)
return
datetime
.
fromtimestamp
(
os
.
path
.
getmtime
(
self
.
path
(
name
)))
def
_datetime_from_timestamp
(
self
,
ts
):
"""
If timezone support is enabled, make an aware datetime object in UTC;
...
...
tests/test_admin_views.py
View file @
45b438da
...
...
@@ -5,12 +5,12 @@ import json
from
django.contrib.auth
import
get_user_model
from
django.contrib.auth.models
import
Group
,
Permission
from
django.core.files.uploadedfile
import
SimpleUploadedFile
from
django.core.urlresolvers
import
reverse
from
django.template.defaultfilters
import
filesizeformat
from
django.test
import
TestCase
,
override_settings
from
django.urls
import
reverse
from
mock
import
patch
from
wagtail.core.models
import
Collection
,
GroupCollectionPermission
from
wagtail.tests.utils
import
WagtailTestUtils
from
wagtail.wagtailcore.models
import
Collection
,
GroupCollectionPermission
from
tests.utils
import
create_test_video_file
from
wagtailvideos.models
import
Video
...
...
tox.ini
View file @
45b438da
...
...
@@ -2,8 +2,7 @@
skip_missing_interpreters
=
True
envlist
=
py{27,34,35}-dj{110}-wt{19}
py{27,34,35}-dj{110,111}-wt{110}
py{34,35,36}-dj{110,20}-wt{20,21}
# Enforce good style
flake8,isort
...
...
@@ -16,14 +15,10 @@ pip_pre = True
deps
=
{
[base]
deps}
dj18:
Django~=1.8.0
dj19:
Django~=1.9.0
dj110:
Django~=1.10.0
dj111:
Django~=1.11.0
wt17:
wagtail~=1.7.0
wt18:
wagtail~=1.8.0
wt19:
wagtail~=1.9.0
wt110:
wagtail~=1.10.0
dj20:
Django~=2.0.0
wt20:
wagtail~=2.0.0
wt21:
wagtail~=2.1.0
[testenv:flake8]
deps
=
flake8
...
...
@@ -34,6 +29,6 @@ commands = flake8 wagtailvideos/ tests/
usedevelop
=
True
deps
=
{
[base]
deps}
isort
=
=4.
2.2
isort
=
=4.
3.4
basepython
=
python3.5
commands
=
isort --recursive --diff --check-only wagtailvideos/ tests/
wagtailvideos/apps.py
View file @
45b438da
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
from
django.apps
import
AppConfig
from
django.core.checks
import
Warning
,
register
...
...
wagtailvideos/edit_handlers.py
View file @
45b438da
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
from
wagtail.wagtailadmin.edit_handlers
import
BaseChooserPanel
from
wagtail.admin.edit_handlers
import
BaseChooserPanel
from
.widgets
import
AdminVideoChooser
class
BaseVideoChooserPanel
(
BaseChooserPanel
):
object_type_name
=
"video"
@
classmethod
def
widget_overrides
(
cls
):
return
{
cls
.
field_name
:
AdminVideoChooser
}
class
VideoChooserPanel
(
BaseChooserPanel
):
model
=
None
field_name
=
None
_target_model
=
None
object_type_name
=
"video"
class
VideoChooserPanel
(
object
):
def
__init__
(
self
,
field_name
):
self
.
field_name
=
field_name
def
bind_to_model
(
self
,
model
):
return
type
(
str
(
'_VideoChooserPanel'
),
(
BaseVideoChooserPanel
,),
{
'model'
:
model
,
'field_name'
:
self
.
field_name
,
})
def
widget_overrides
(
self
):
return
{
self
.
field_name
:
AdminVideoChooser
}
wagtailvideos/ffmpeg.py
View file @
45b438da
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
import
datetime
import
logging
import
os
...
...
wagtailvideos/fields.py
View file @
45b438da
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
from
django.conf
import
settings
from
django.core.exceptions
import
ValidationError
from
django.forms.fields
import
FileField
...
...
wagtailvideos/forms.py
View file @
45b438da
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
from
django
import
forms
from
django.forms.models
import
modelform_factory
from
django.utils.translation
import
ugettext
as
_
from
enumchoicefield.forms
import
EnumField
from
wagtail.
wagtail
admin
import
widgets
from
wagtail.
wagtail
admin.forms
import
(
from
wagtail.admin
import
widgets
from
wagtail.admin.forms
import
(
BaseCollectionMemberForm
,
collection_member_permission_formset_factory
)
from
wagtailvideos.fields
import
WagtailVideoField
...
...
wagtailvideos/jinja2tags.py
View file @
45b438da
from
__future__
import
absolute_import
,
unicode_literals
from
jinja2.ext
import
Extension
from
.models
import
Video
...
...
wagtailvideos/migrations/0001_initial.py
View file @
45b438da
...
...
@@ -4,8 +4,8 @@ from __future__ import absolute_import, print_function, unicode_literals
import
django.db.models.deletion
import
taggit.managers
import
wagtail.
wagtail
core.models
import
wagtail.
wagtail
search.index
import
wagtail.core.models
import
wagtail.search.index
from
django.conf
import
settings
from
django.db
import
migrations
,
models
...
...
@@ -31,7 +31,7 @@ class Migration(migrations.Migration):
(
'file'
,
models
.
ImageField
(
height_field
=
'height'
,
upload_to
=
wagtailvideos
.
models
.
get_upload_to
,
verbose_name
=
'file'
,
width_field
=
'width'
)),
(
'created_at'
,
models
.
DateTimeField
(
auto_now_add
=
True
,
db_index
=
True
,
verbose_name
=
'created at'
)),
(
'file_size'
,
models
.
PositiveIntegerField
(
editable
=
False
,
null
=
True
)),
(
'collection'
,
models
.
ForeignKey
(
default
=
wagtail
.
wagtail
core
.
models
.
get_root_collection_id
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'+'
,
to
=
'wagtailcore.Collection'
,
verbose_name
=
'collection'
)),
(
'collection'
,
models
.
ForeignKey
(
default
=
wagtail
.
core
.
models
.
get_root_collection_id
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'+'
,
to
=
'wagtailcore.Collection'
,
verbose_name
=
'collection'
)),
(
'tags'
,
taggit
.
managers
.
TaggableManager
(
blank
=
True
,
help_text
=
None
,
through
=
'taggit.TaggedItem'
,
to
=
'taggit.Tag'
,
verbose_name
=
'tags'
)),
(
'uploaded_by_user'
,
models
.
ForeignKey
(
blank
=
True
,
editable
=
False
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
SET_NULL
,
to
=
settings
.
AUTH_USER_MODEL
,
verbose_name
=
'uploaded by user'
)),
],
...
...
wagtailvideos/models.py
View file @
45b438da
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
import
logging
import
mimetypes
import
os
...
...
@@ -14,20 +12,20 @@ from django.conf import settings
from
django.core.exceptions
import
SuspiciousFileOperation
from
django.core.files.base
import
ContentFile
from
django.core.files.temp
import
NamedTemporaryFile
from
django.core.urlresolvers
import
reverse
from
django.db
import
models
from
django.db.models.signals
import
post_save
,
pre_delete
from
django.dispatch.dispatcher
import
receiver
from
django.forms.utils
import
flatatt
from
django.urls
import
reverse
from
django.utils.encoding
import
python_2_unicode_compatible
from
django.utils.text
import
mark_safe
from
django.utils.translation
import
ugettext_lazy
as
_
from
enumchoicefield
import
ChoiceEnum
,
EnumChoiceField
from
taggit.managers
import
TaggableManager
from
wagtail.
wagtail
admin.utils
import
get_object_usage
from
wagtail.
wagtail
core.models
import
CollectionMember
from
wagtail.
wagtail
search
import
index
from
wagtail.
wagtail
search.queryset
import
SearchableQuerySetMixin
from
wagtail.admin.utils
import
get_object_usage
from
wagtail.core.models
import
CollectionMember
from
wagtail.search
import
index
from
wagtail.search.queryset
import
SearchableQuerySetMixin
from
wagtailvideos
import
ffmpeg
...
...
@@ -367,7 +365,7 @@ class AbstractVideoTranscode(models.Model):
class
VideoTranscode
(
AbstractVideoTranscode
):
video
=
models
.
ForeignKey
(
Video
,
related_name
=
'transcodes'
)
video
=
models
.
ForeignKey
(
Video
,
related_name
=
'transcodes'
,
on_delete
=
models
.
CASCADE
)
class
Meta
:
unique_together
=
(
...
...
wagtailvideos/permissions.py
View file @
45b438da
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
from
wagtail.wagtailcore.permission_policies.collections
import
\
CollectionOwnershipPermissionPolicy
from
wagtail.core.permission_policies.collections
import
(
CollectionOwnershipPermissionPolicy
)
from
wagtailvideos.models
import
Video
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment