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
e5257db2
Commit
e5257db2
authored
8 months ago
by
Konrad Mohrfeldt
Browse files
Options
Downloads
Patches
Plain Diff
refactor: move ProgramEntry into models
parent
261e297c
No related branches found
No related tags found
1 merge request
!52
new program endpoint
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
program/models.py
+12
-0
12 additions, 0 deletions
program/models.py
program/services.py
+1
-9
1 addition, 9 deletions
program/services.py
with
13 additions
and
9 deletions
program/models.py
+
12
−
0
View file @
e5257db2
...
@@ -17,6 +17,9 @@
...
@@ -17,6 +17,9 @@
# You should have received a copy of the GNU Affero General Public License
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
import
dataclasses
import
datetime
import
jsonschema
import
jsonschema
from
rest_framework.exceptions
import
ValidationError
from
rest_framework.exceptions
import
ValidationError
from
versatileimagefield.fields
import
PPOIField
,
VersatileImageField
from
versatileimagefield.fields
import
PPOIField
,
VersatileImageField
...
@@ -687,3 +690,12 @@ class RadioSettings(models.Model):
...
@@ -687,3 +690,12 @@ class RadioSettings(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
station_name
return
self
.
station_name
@dataclasses.dataclass
()
class
ProgramEntry
:
id
:
str
start
:
datetime
.
datetime
end
:
datetime
.
datetime
show
:
Show
timeslot
:
TimeSlot
|
None
This diff is collapsed.
Click to expand it.
program/services.py
+
1
−
9
View file @
e5257db2
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
import
copy
import
copy
from
collections.abc
import
Iterator
from
collections.abc
import
Iterator
from
datetime
import
datetime
,
time
,
timedelta
from
datetime
import
datetime
,
time
,
timedelta
from
typing
import
TypedDict
from
dateutil.relativedelta
import
relativedelta
from
dateutil.relativedelta
import
relativedelta
from
dateutil.rrule
import
rrule
from
dateutil.rrule
import
rrule
...
@@ -33,6 +32,7 @@ from django.utils import timezone
...
@@ -33,6 +32,7 @@ from django.utils import timezone
from
django.utils.translation
import
gettext_lazy
as
_
from
django.utils.translation
import
gettext_lazy
as
_
from
program.models
import
(
from
program.models
import
(
Note
,
Note
,
ProgramEntry
,
RadioSettings
,
RadioSettings
,
RRule
,
RRule
,
Schedule
,
Schedule
,
...
@@ -699,14 +699,6 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
...
@@ -699,14 +699,6 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
return
conflicts
return
conflicts
class
ProgramEntry
(
TypedDict
):
id
:
str
start
:
datetime
end
:
datetime
show
:
Show
timeslot
:
TimeSlot
|
None
def
generate_program_entries
(
def
generate_program_entries
(
queryset
:
QuerySet
[
TimeSlot
],
queryset
:
QuerySet
[
TimeSlot
],
*
,
*
,
...
...
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