Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
steering
Commits
df556c7c
Verified
Commit
df556c7c
authored
9 months ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
feat: remove choices, add validator & increase max_length of Aspect Ratio field
parent
7577a8ed
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
program/migrations/0101_alter_radiosettings_host_image_aspect_ratio_and_more.py
+34
-0
34 additions, 0 deletions
...1_alter_radiosettings_host_image_aspect_ratio_and_more.py
program/models.py
+10
-5
10 additions, 5 deletions
program/models.py
with
44 additions
and
5 deletions
program/migrations/0101_alter_radiosettings_host_image_aspect_ratio_and_more.py
0 → 100644
+
34
−
0
View file @
df556c7c
# Generated by Django 4.2.13 on 2024-06-24 21:31
import
program.models
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
"
program
"
,
"
0100_alter_userprofile_options
"
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
"
radiosettings
"
,
name
=
"
host_image_aspect_ratio
"
,
field
=
program
.
models
.
ImageAspectRadioField
(
default
=
"
1:1
"
,
max_length
=
11
),
),
migrations
.
AlterField
(
model_name
=
"
radiosettings
"
,
name
=
"
note_image_aspect_ratio
"
,
field
=
program
.
models
.
ImageAspectRadioField
(
default
=
"
16:9
"
,
max_length
=
11
),
),
migrations
.
AlterField
(
model_name
=
"
radiosettings
"
,
name
=
"
show_image_aspect_ratio
"
,
field
=
program
.
models
.
ImageAspectRadioField
(
default
=
"
16:9
"
,
max_length
=
11
),
),
migrations
.
AlterField
(
model_name
=
"
radiosettings
"
,
name
=
"
show_logo_aspect_ratio
"
,
field
=
program
.
models
.
ImageAspectRadioField
(
default
=
"
1:1
"
,
max_length
=
11
),
),
]
This diff is collapsed.
Click to expand it.
program/models.py
+
10
−
5
View file @
df556c7c
...
@@ -23,6 +23,7 @@ from versatileimagefield.fields import PPOIField, VersatileImageField
...
@@ -23,6 +23,7 @@ from versatileimagefield.fields import PPOIField, VersatileImageField
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.core.exceptions
import
ValidationError
as
DjangoValidationError
from
django.core.exceptions
import
ValidationError
as
DjangoValidationError
from
django.core.validators
import
RegexValidator
from
django.db
import
models
from
django.db
import
models
from
django.db.models
import
Max
,
Q
from
django.db.models
import
Max
,
Q
from
django.utils
import
timezone
from
django.utils
import
timezone
...
@@ -551,12 +552,16 @@ class Playlist(models.Model):
...
@@ -551,12 +552,16 @@ class Playlist(models.Model):
class
ImageAspectRadioField
(
models
.
CharField
):
class
ImageAspectRadioField
(
models
.
CharField
):
validators
=
[
RegexValidator
(
code
=
"
invalid_aspect_ratio
"
,
message
=
"
Enter a valid aspect ratio in the format int:int or float:float
"
,
regex
=
r
"
^\d+(\.\d+)?:\d+(\.\d+)?$
"
,
)
]
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
[
"
choices
"
]
=
[
kwargs
[
"
max_length
"
]
=
11
(
"
1:1
"
,
"
1:1
"
),
(
"
16:9
"
,
"
16:9
"
),
]
kwargs
[
"
max_length
"
]
=
4
super
().
__init__
(
*
args
,
**
kwargs
)
super
().
__init__
(
*
args
,
**
kwargs
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment