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
9c0b9236
Commit
9c0b9236
authored
Jul 19, 2023
by
Seb
Browse files
streamfield fix for test app
parent
00714db1
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/app/migrations/0002_alter_testpage_video_streamfield.py
0 → 100644
View file @
9c0b9236
# Generated by Django 4.2.3 on 2023-07-18 23:19
from
django.db
import
migrations
import
wagtail.fields
import
wagtailvideos.blocks
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'app'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'testpage'
,
name
=
'video_streamfield'
,
field
=
wagtail
.
fields
.
StreamField
([(
'video'
,
wagtailvideos
.
blocks
.
VideoChooserBlock
())],
blank
=
True
,
use_json_field
=
True
),
),
]
tests/app/models.py
View file @
9c0b9236
...
...
@@ -7,49 +7,61 @@ from wagtail.models import Page
from
wagtailvideos.blocks
import
VideoChooserBlock
from
wagtailvideos.edit_handlers
import
VideoChooserPanel
from
wagtailvideos.models
import
(
AbstractTrackListing
,
AbstractVideo
,
AbstractVideoTrack
,
AbstractVideoTranscode
)
AbstractTrackListing
,
AbstractVideo
,
AbstractVideoTrack
,
AbstractVideoTranscode
,
)
class
CustomVideoModel
(
AbstractVideo
):
attribution
=
models
.
TextField
(
blank
=
True
)
admin_form_fields
=
(
'
title
'
,
'
attribution
'
,
'
file
'
,
'
collection
'
,
'
thumbnail
'
,
'
tags
'
,
"
title
"
,
"
attribution
"
,
"
file
"
,
"
collection
"
,
"
thumbnail
"
,
"
tags
"
,
)
class
CustomVideoTranscode
(
AbstractVideoTranscode
):
video
=
models
.
ForeignKey
(
CustomVideoModel
,
related_name
=
'transcodes'
,
on_delete
=
models
.
CASCADE
)
video
=
models
.
ForeignKey
(
CustomVideoModel
,
related_name
=
"transcodes"
,
on_delete
=
models
.
CASCADE
)
class
Meta
:
unique_together
=
(
(
'video'
,
'media_format'
)
)
unique_together
=
(
"video"
,
"media_format"
)
class
CustomTrackListing
(
AbstractTrackListing
):
video
=
models
.
OneToOneField
(
CustomVideoModel
,
related_name
=
'track_listing'
,
on_delete
=
models
.
CASCADE
)
video
=
models
.
OneToOneField
(
CustomVideoModel
,
related_name
=
"track_listing"
,
on_delete
=
models
.
CASCADE
)
class
CustomVideoTrack
(
AbstractVideoTrack
):
listing
=
ParentalKey
(
CustomTrackListing
,
related_name
=
'tracks'
,
on_delete
=
models
.
CASCADE
)
listing
=
ParentalKey
(
CustomTrackListing
,
related_name
=
"tracks"
,
on_delete
=
models
.
CASCADE
)
class
TestPage
(
Page
):
video_field
=
models
.
ForeignKey
(
CustomVideoModel
,
related_name
=
'+'
,
null
=
True
,
blank
=
True
,
on_delete
=
models
.
SET_NULL
)
CustomVideoModel
,
related_name
=
"+"
,
null
=
True
,
blank
=
True
,
on_delete
=
models
.
SET_NULL
,
)
video_streamfield
=
StreamField
(
[
(
'
video
'
,
VideoChooserBlock
())
],
blank
=
True
)
video_streamfield
=
StreamField
(
[(
"
video
"
,
VideoChooserBlock
())
],
blank
=
True
,
use_json_field
=
True
)
content_panels
=
Page
.
content_panels
+
[
VideoChooserPanel
(
'
video_field
'
),
FieldPanel
(
'
video_streamfield
'
),
VideoChooserPanel
(
"
video_field
"
),
FieldPanel
(
"
video_streamfield
"
),
]
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