Compare commits
80 Commits
develop-1.
...
07f3881dde
| Author | SHA1 | Date | |
|---|---|---|---|
| 07f3881dde | |||
| 6469913f8a | |||
| 75f1973d41 | |||
| b96cf59780 | |||
| 63c7fadd3f | |||
| c9ddd38b9b | |||
| 72cd24083a | |||
| fd3411ed38 | |||
| fddaaee169 | |||
| 42ae35a6ae | |||
| 1bfbdb304f | |||
| 27b0bec870 | |||
| 5986d86da3 | |||
| b4539481e6 | |||
| 25f6d91903 | |||
| 8b3d3a2483 | |||
| c8b0d1c5fb | |||
| 1674266890 | |||
| dd71f984ed | |||
| 269b29b2c1 | |||
|
|
df41885cca | ||
|
|
2a75608701 | ||
|
|
e1cf455384 | ||
|
|
93e286fa62 | ||
|
|
e3966ca5cb | ||
|
|
c335ed9fb9 | ||
|
|
ad90255570 | ||
|
|
cab6cacd0b | ||
|
|
1475a80316 | ||
|
|
b9148933f4 | ||
|
|
5bb52a9d67 | ||
|
|
8cf57c07b2 | ||
|
|
20aa3aba9d | ||
|
|
d53cb3e935 | ||
|
|
25ceacdff9 | ||
|
|
0adcacf375 | ||
|
|
c31d776504 | ||
|
|
69b77a675b | ||
|
|
ac9b3c8ede | ||
|
|
825ed03dbd | ||
|
|
561914ee78 | ||
|
|
ccea2a5ea6 | ||
|
|
c52e87acd2 | ||
|
|
294c848415 | ||
|
|
1f6381bf07 | ||
|
|
73d8ff32d5 | ||
|
|
46a9008cda | ||
|
|
eaa1e2412a | ||
|
|
a3c21c64ed | ||
|
|
0e444f0502 | ||
|
|
4778803ee0 | ||
|
|
9c3eaf05c7 | ||
|
|
f05e47af1c | ||
|
|
1de9548111 | ||
|
|
8202a9324c | ||
|
|
f5ce00795e | ||
|
|
4e04cfae7e | ||
|
|
d2ed8df2ac | ||
|
|
712ab223ba | ||
|
|
ed9affbef6 | ||
|
|
cb5a6a3ee8 | ||
|
|
bc697bd4bd | ||
|
|
d075fecbce | ||
|
|
0c07586787 | ||
|
|
9661e98a70 | ||
|
|
69d77e1d0c | ||
|
|
62ada47352 | ||
|
|
474016f776 | ||
|
|
6a21a9d094 | ||
|
|
b4c12def13 | ||
|
|
36ae12af3d | ||
|
|
0a86d4e0a3 | ||
|
|
a53aebb5b8 | ||
|
|
1af0348c89 | ||
|
|
8ab8ef5b1c | ||
|
|
bf9da835b2 | ||
|
|
7b28149d7e | ||
|
|
87a2ee5a45 | ||
|
|
ab231e9a89 | ||
|
|
1661601caf |
@@ -30,9 +30,9 @@ class DiffusionAdmin(DiffusionBaseAdmin, admin.ModelAdmin):
|
|||||||
|
|
||||||
end_date.short_description = _("end")
|
end_date.short_description = _("end")
|
||||||
|
|
||||||
list_display = ("episode", "start_date", "end_date", "type", "initial")
|
list_display = ("episode", "start", "end", "type", "initial")
|
||||||
list_filter = ("type", "start", "program")
|
list_filter = ("type", "start", "program")
|
||||||
list_editable = ("type",)
|
list_editable = ("type", "start", "end")
|
||||||
ordering = ("-start", "id")
|
ordering = ("-start", "id")
|
||||||
|
|
||||||
fields = ("type", "start", "end", "initial", "program", "schedule")
|
fields = ("type", "start", "end", "initial", "program", "schedule")
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ class BasePageAdmin(admin.ModelAdmin):
|
|||||||
change_form_template = "admin/aircox/page_change_form.html"
|
change_form_template = "admin/aircox/page_change_form.html"
|
||||||
|
|
||||||
def cover_thumb(self, obj):
|
def cover_thumb(self, obj):
|
||||||
return mark_safe('<img src="{}"/>'.format(obj.cover.icons["64"])) if obj.cover else ""
|
if obj.cover and obj.cover.thumbnails:
|
||||||
|
return mark_safe('<img src="{}"/>'.format(obj.cover.icons["64"]))
|
||||||
|
return ""
|
||||||
|
|
||||||
def get_changeform_initial_data(self, request):
|
def get_changeform_initial_data(self, request):
|
||||||
data = super().get_changeform_initial_data(request)
|
data = super().get_changeform_initial_data(request)
|
||||||
@@ -95,6 +97,7 @@ class PageAdmin(BasePageAdmin):
|
|||||||
@admin.register(StaticPage)
|
@admin.register(StaticPage)
|
||||||
class StaticPageAdmin(BasePageAdmin):
|
class StaticPageAdmin(BasePageAdmin):
|
||||||
list_display = BasePageAdmin.list_display + ("attach_to",)
|
list_display = BasePageAdmin.list_display + ("attach_to",)
|
||||||
|
list_editable = BasePageAdmin.list_editable + ("attach_to",)
|
||||||
fieldsets = deepcopy(BasePageAdmin.fieldsets)
|
fieldsets = deepcopy(BasePageAdmin.fieldsets)
|
||||||
|
|
||||||
fieldsets[1][1]["fields"] += ("attach_to",)
|
fieldsets[1][1]["fields"] += ("attach_to",)
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ class Settings(BaseSettings):
|
|||||||
# TODO include content_type in order to avoid clash with potential
|
# TODO include content_type in order to avoid clash with potential
|
||||||
# extra applications
|
# extra applications
|
||||||
# aircox
|
# aircox
|
||||||
"change_program",
|
"view_program",
|
||||||
"change_episode",
|
"view_episode",
|
||||||
"change_diffusion",
|
"change_diffusion",
|
||||||
"add_comment",
|
"add_comment",
|
||||||
"change_comment",
|
"change_comment",
|
||||||
|
|||||||
4
aircox/context_processors/__init__.py
Normal file
4
aircox/context_processors/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
def station(request):
|
||||||
|
station = request.station
|
||||||
|
audio_streams = station.streams if station else None
|
||||||
|
return {"station": station, "audio_streams": audio_streams}
|
||||||
@@ -10,7 +10,7 @@ class PageFilters(filters.FilterSet):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Page
|
model = Page
|
||||||
fields = {
|
fields = {
|
||||||
"category__id": ["in"],
|
"category__id": ["in", "exact"],
|
||||||
"pub_date": ["exact", "gte", "lte"],
|
"pub_date": ["exact", "gte", "lte"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.forms import ModelForm
|
from django.forms import ModelForm, ImageField, FileField
|
||||||
|
|
||||||
from .models import Comment
|
from ckeditor.fields import RichTextField
|
||||||
|
from filer.models.imagemodels import Image
|
||||||
|
from filer.models.filemodels import File
|
||||||
|
|
||||||
|
from aircox.models import Comment, Episode, Program
|
||||||
|
from aircox.controllers.sound_file import SoundFile
|
||||||
|
|
||||||
|
|
||||||
class CommentForm(ModelForm):
|
class CommentForm(ModelForm):
|
||||||
@@ -16,3 +21,38 @@ class CommentForm(ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Comment
|
model = Comment
|
||||||
fields = ["nickname", "email", "content"]
|
fields = ["nickname", "email", "content"]
|
||||||
|
|
||||||
|
|
||||||
|
class ProgramForm(ModelForm):
|
||||||
|
content = RichTextField()
|
||||||
|
new_cover = ImageField(required=False)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Program
|
||||||
|
fields = ["content"]
|
||||||
|
|
||||||
|
def save(self, commit=True):
|
||||||
|
file_obj = self.cleaned_data["new_cover"]
|
||||||
|
if file_obj:
|
||||||
|
obj, _ = Image.objects.get_or_create(original_filename=file_obj.name, file=file_obj)
|
||||||
|
self.instance.cover = obj
|
||||||
|
super().save(commit=commit)
|
||||||
|
|
||||||
|
|
||||||
|
class EpisodeForm(ModelForm):
|
||||||
|
content = RichTextField()
|
||||||
|
new_podcast = FileField(required=False)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Episode
|
||||||
|
fields = ["content"]
|
||||||
|
|
||||||
|
def save(self, commit=True):
|
||||||
|
file_obj = self.cleaned_data["new_podcast"]
|
||||||
|
if file_obj:
|
||||||
|
obj, _ = File.objects.get_or_create(original_filename=file_obj.name, file=file_obj)
|
||||||
|
sound_file = SoundFile(obj.path)
|
||||||
|
sound_file.sync(
|
||||||
|
program=self.instance.program, episode=self.instance, type=0, is_public=True, is_downloadable=True
|
||||||
|
)
|
||||||
|
super().save(commit=commit)
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,641 @@
|
|||||||
|
# Generated by Django 4.2.1 on 2023-11-24 21:11
|
||||||
|
|
||||||
|
import aircox.models.schedule
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("aircox", "0014_alter_schedule_timezone"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="schedule",
|
||||||
|
name="timezone",
|
||||||
|
field=models.CharField(
|
||||||
|
choices=[
|
||||||
|
("Africa/Abidjan", "Africa/Abidjan"),
|
||||||
|
("Africa/Accra", "Africa/Accra"),
|
||||||
|
("Africa/Addis_Ababa", "Africa/Addis_Ababa"),
|
||||||
|
("Africa/Algiers", "Africa/Algiers"),
|
||||||
|
("Africa/Asmara", "Africa/Asmara"),
|
||||||
|
("Africa/Asmera", "Africa/Asmera"),
|
||||||
|
("Africa/Bamako", "Africa/Bamako"),
|
||||||
|
("Africa/Bangui", "Africa/Bangui"),
|
||||||
|
("Africa/Banjul", "Africa/Banjul"),
|
||||||
|
("Africa/Bissau", "Africa/Bissau"),
|
||||||
|
("Africa/Blantyre", "Africa/Blantyre"),
|
||||||
|
("Africa/Brazzaville", "Africa/Brazzaville"),
|
||||||
|
("Africa/Bujumbura", "Africa/Bujumbura"),
|
||||||
|
("Africa/Cairo", "Africa/Cairo"),
|
||||||
|
("Africa/Casablanca", "Africa/Casablanca"),
|
||||||
|
("Africa/Ceuta", "Africa/Ceuta"),
|
||||||
|
("Africa/Conakry", "Africa/Conakry"),
|
||||||
|
("Africa/Dakar", "Africa/Dakar"),
|
||||||
|
("Africa/Dar_es_Salaam", "Africa/Dar_es_Salaam"),
|
||||||
|
("Africa/Djibouti", "Africa/Djibouti"),
|
||||||
|
("Africa/Douala", "Africa/Douala"),
|
||||||
|
("Africa/El_Aaiun", "Africa/El_Aaiun"),
|
||||||
|
("Africa/Freetown", "Africa/Freetown"),
|
||||||
|
("Africa/Gaborone", "Africa/Gaborone"),
|
||||||
|
("Africa/Harare", "Africa/Harare"),
|
||||||
|
("Africa/Johannesburg", "Africa/Johannesburg"),
|
||||||
|
("Africa/Juba", "Africa/Juba"),
|
||||||
|
("Africa/Kampala", "Africa/Kampala"),
|
||||||
|
("Africa/Khartoum", "Africa/Khartoum"),
|
||||||
|
("Africa/Kigali", "Africa/Kigali"),
|
||||||
|
("Africa/Kinshasa", "Africa/Kinshasa"),
|
||||||
|
("Africa/Lagos", "Africa/Lagos"),
|
||||||
|
("Africa/Libreville", "Africa/Libreville"),
|
||||||
|
("Africa/Lome", "Africa/Lome"),
|
||||||
|
("Africa/Luanda", "Africa/Luanda"),
|
||||||
|
("Africa/Lubumbashi", "Africa/Lubumbashi"),
|
||||||
|
("Africa/Lusaka", "Africa/Lusaka"),
|
||||||
|
("Africa/Malabo", "Africa/Malabo"),
|
||||||
|
("Africa/Maputo", "Africa/Maputo"),
|
||||||
|
("Africa/Maseru", "Africa/Maseru"),
|
||||||
|
("Africa/Mbabane", "Africa/Mbabane"),
|
||||||
|
("Africa/Mogadishu", "Africa/Mogadishu"),
|
||||||
|
("Africa/Monrovia", "Africa/Monrovia"),
|
||||||
|
("Africa/Nairobi", "Africa/Nairobi"),
|
||||||
|
("Africa/Ndjamena", "Africa/Ndjamena"),
|
||||||
|
("Africa/Niamey", "Africa/Niamey"),
|
||||||
|
("Africa/Nouakchott", "Africa/Nouakchott"),
|
||||||
|
("Africa/Ouagadougou", "Africa/Ouagadougou"),
|
||||||
|
("Africa/Porto-Novo", "Africa/Porto-Novo"),
|
||||||
|
("Africa/Sao_Tome", "Africa/Sao_Tome"),
|
||||||
|
("Africa/Timbuktu", "Africa/Timbuktu"),
|
||||||
|
("Africa/Tripoli", "Africa/Tripoli"),
|
||||||
|
("Africa/Tunis", "Africa/Tunis"),
|
||||||
|
("Africa/Windhoek", "Africa/Windhoek"),
|
||||||
|
("America/Adak", "America/Adak"),
|
||||||
|
("America/Anchorage", "America/Anchorage"),
|
||||||
|
("America/Anguilla", "America/Anguilla"),
|
||||||
|
("America/Antigua", "America/Antigua"),
|
||||||
|
("America/Araguaina", "America/Araguaina"),
|
||||||
|
("America/Argentina/Buenos_Aires", "America/Argentina/Buenos_Aires"),
|
||||||
|
("America/Argentina/Catamarca", "America/Argentina/Catamarca"),
|
||||||
|
("America/Argentina/ComodRivadavia", "America/Argentina/ComodRivadavia"),
|
||||||
|
("America/Argentina/Cordoba", "America/Argentina/Cordoba"),
|
||||||
|
("America/Argentina/Jujuy", "America/Argentina/Jujuy"),
|
||||||
|
("America/Argentina/La_Rioja", "America/Argentina/La_Rioja"),
|
||||||
|
("America/Argentina/Mendoza", "America/Argentina/Mendoza"),
|
||||||
|
("America/Argentina/Rio_Gallegos", "America/Argentina/Rio_Gallegos"),
|
||||||
|
("America/Argentina/Salta", "America/Argentina/Salta"),
|
||||||
|
("America/Argentina/San_Juan", "America/Argentina/San_Juan"),
|
||||||
|
("America/Argentina/San_Luis", "America/Argentina/San_Luis"),
|
||||||
|
("America/Argentina/Tucuman", "America/Argentina/Tucuman"),
|
||||||
|
("America/Argentina/Ushuaia", "America/Argentina/Ushuaia"),
|
||||||
|
("America/Aruba", "America/Aruba"),
|
||||||
|
("America/Asuncion", "America/Asuncion"),
|
||||||
|
("America/Atikokan", "America/Atikokan"),
|
||||||
|
("America/Atka", "America/Atka"),
|
||||||
|
("America/Bahia", "America/Bahia"),
|
||||||
|
("America/Bahia_Banderas", "America/Bahia_Banderas"),
|
||||||
|
("America/Barbados", "America/Barbados"),
|
||||||
|
("America/Belem", "America/Belem"),
|
||||||
|
("America/Belize", "America/Belize"),
|
||||||
|
("America/Blanc-Sablon", "America/Blanc-Sablon"),
|
||||||
|
("America/Boa_Vista", "America/Boa_Vista"),
|
||||||
|
("America/Bogota", "America/Bogota"),
|
||||||
|
("America/Boise", "America/Boise"),
|
||||||
|
("America/Buenos_Aires", "America/Buenos_Aires"),
|
||||||
|
("America/Cambridge_Bay", "America/Cambridge_Bay"),
|
||||||
|
("America/Campo_Grande", "America/Campo_Grande"),
|
||||||
|
("America/Cancun", "America/Cancun"),
|
||||||
|
("America/Caracas", "America/Caracas"),
|
||||||
|
("America/Catamarca", "America/Catamarca"),
|
||||||
|
("America/Cayenne", "America/Cayenne"),
|
||||||
|
("America/Cayman", "America/Cayman"),
|
||||||
|
("America/Chicago", "America/Chicago"),
|
||||||
|
("America/Chihuahua", "America/Chihuahua"),
|
||||||
|
("America/Ciudad_Juarez", "America/Ciudad_Juarez"),
|
||||||
|
("America/Coral_Harbour", "America/Coral_Harbour"),
|
||||||
|
("America/Cordoba", "America/Cordoba"),
|
||||||
|
("America/Costa_Rica", "America/Costa_Rica"),
|
||||||
|
("America/Creston", "America/Creston"),
|
||||||
|
("America/Cuiaba", "America/Cuiaba"),
|
||||||
|
("America/Curacao", "America/Curacao"),
|
||||||
|
("America/Danmarkshavn", "America/Danmarkshavn"),
|
||||||
|
("America/Dawson", "America/Dawson"),
|
||||||
|
("America/Dawson_Creek", "America/Dawson_Creek"),
|
||||||
|
("America/Denver", "America/Denver"),
|
||||||
|
("America/Detroit", "America/Detroit"),
|
||||||
|
("America/Dominica", "America/Dominica"),
|
||||||
|
("America/Edmonton", "America/Edmonton"),
|
||||||
|
("America/Eirunepe", "America/Eirunepe"),
|
||||||
|
("America/El_Salvador", "America/El_Salvador"),
|
||||||
|
("America/Ensenada", "America/Ensenada"),
|
||||||
|
("America/Fort_Nelson", "America/Fort_Nelson"),
|
||||||
|
("America/Fort_Wayne", "America/Fort_Wayne"),
|
||||||
|
("America/Fortaleza", "America/Fortaleza"),
|
||||||
|
("America/Glace_Bay", "America/Glace_Bay"),
|
||||||
|
("America/Godthab", "America/Godthab"),
|
||||||
|
("America/Goose_Bay", "America/Goose_Bay"),
|
||||||
|
("America/Grand_Turk", "America/Grand_Turk"),
|
||||||
|
("America/Grenada", "America/Grenada"),
|
||||||
|
("America/Guadeloupe", "America/Guadeloupe"),
|
||||||
|
("America/Guatemala", "America/Guatemala"),
|
||||||
|
("America/Guayaquil", "America/Guayaquil"),
|
||||||
|
("America/Guyana", "America/Guyana"),
|
||||||
|
("America/Halifax", "America/Halifax"),
|
||||||
|
("America/Havana", "America/Havana"),
|
||||||
|
("America/Hermosillo", "America/Hermosillo"),
|
||||||
|
("America/Indiana/Indianapolis", "America/Indiana/Indianapolis"),
|
||||||
|
("America/Indiana/Knox", "America/Indiana/Knox"),
|
||||||
|
("America/Indiana/Marengo", "America/Indiana/Marengo"),
|
||||||
|
("America/Indiana/Petersburg", "America/Indiana/Petersburg"),
|
||||||
|
("America/Indiana/Tell_City", "America/Indiana/Tell_City"),
|
||||||
|
("America/Indiana/Vevay", "America/Indiana/Vevay"),
|
||||||
|
("America/Indiana/Vincennes", "America/Indiana/Vincennes"),
|
||||||
|
("America/Indiana/Winamac", "America/Indiana/Winamac"),
|
||||||
|
("America/Indianapolis", "America/Indianapolis"),
|
||||||
|
("America/Inuvik", "America/Inuvik"),
|
||||||
|
("America/Iqaluit", "America/Iqaluit"),
|
||||||
|
("America/Jamaica", "America/Jamaica"),
|
||||||
|
("America/Jujuy", "America/Jujuy"),
|
||||||
|
("America/Juneau", "America/Juneau"),
|
||||||
|
("America/Kentucky/Louisville", "America/Kentucky/Louisville"),
|
||||||
|
("America/Kentucky/Monticello", "America/Kentucky/Monticello"),
|
||||||
|
("America/Knox_IN", "America/Knox_IN"),
|
||||||
|
("America/Kralendijk", "America/Kralendijk"),
|
||||||
|
("America/La_Paz", "America/La_Paz"),
|
||||||
|
("America/Lima", "America/Lima"),
|
||||||
|
("America/Los_Angeles", "America/Los_Angeles"),
|
||||||
|
("America/Louisville", "America/Louisville"),
|
||||||
|
("America/Lower_Princes", "America/Lower_Princes"),
|
||||||
|
("America/Maceio", "America/Maceio"),
|
||||||
|
("America/Managua", "America/Managua"),
|
||||||
|
("America/Manaus", "America/Manaus"),
|
||||||
|
("America/Marigot", "America/Marigot"),
|
||||||
|
("America/Martinique", "America/Martinique"),
|
||||||
|
("America/Matamoros", "America/Matamoros"),
|
||||||
|
("America/Mazatlan", "America/Mazatlan"),
|
||||||
|
("America/Mendoza", "America/Mendoza"),
|
||||||
|
("America/Menominee", "America/Menominee"),
|
||||||
|
("America/Merida", "America/Merida"),
|
||||||
|
("America/Metlakatla", "America/Metlakatla"),
|
||||||
|
("America/Mexico_City", "America/Mexico_City"),
|
||||||
|
("America/Miquelon", "America/Miquelon"),
|
||||||
|
("America/Moncton", "America/Moncton"),
|
||||||
|
("America/Monterrey", "America/Monterrey"),
|
||||||
|
("America/Montevideo", "America/Montevideo"),
|
||||||
|
("America/Montreal", "America/Montreal"),
|
||||||
|
("America/Montserrat", "America/Montserrat"),
|
||||||
|
("America/Nassau", "America/Nassau"),
|
||||||
|
("America/New_York", "America/New_York"),
|
||||||
|
("America/Nipigon", "America/Nipigon"),
|
||||||
|
("America/Nome", "America/Nome"),
|
||||||
|
("America/Noronha", "America/Noronha"),
|
||||||
|
("America/North_Dakota/Beulah", "America/North_Dakota/Beulah"),
|
||||||
|
("America/North_Dakota/Center", "America/North_Dakota/Center"),
|
||||||
|
("America/North_Dakota/New_Salem", "America/North_Dakota/New_Salem"),
|
||||||
|
("America/Nuuk", "America/Nuuk"),
|
||||||
|
("America/Ojinaga", "America/Ojinaga"),
|
||||||
|
("America/Panama", "America/Panama"),
|
||||||
|
("America/Pangnirtung", "America/Pangnirtung"),
|
||||||
|
("America/Paramaribo", "America/Paramaribo"),
|
||||||
|
("America/Phoenix", "America/Phoenix"),
|
||||||
|
("America/Port-au-Prince", "America/Port-au-Prince"),
|
||||||
|
("America/Port_of_Spain", "America/Port_of_Spain"),
|
||||||
|
("America/Porto_Acre", "America/Porto_Acre"),
|
||||||
|
("America/Porto_Velho", "America/Porto_Velho"),
|
||||||
|
("America/Puerto_Rico", "America/Puerto_Rico"),
|
||||||
|
("America/Punta_Arenas", "America/Punta_Arenas"),
|
||||||
|
("America/Rainy_River", "America/Rainy_River"),
|
||||||
|
("America/Rankin_Inlet", "America/Rankin_Inlet"),
|
||||||
|
("America/Recife", "America/Recife"),
|
||||||
|
("America/Regina", "America/Regina"),
|
||||||
|
("America/Resolute", "America/Resolute"),
|
||||||
|
("America/Rio_Branco", "America/Rio_Branco"),
|
||||||
|
("America/Rosario", "America/Rosario"),
|
||||||
|
("America/Santa_Isabel", "America/Santa_Isabel"),
|
||||||
|
("America/Santarem", "America/Santarem"),
|
||||||
|
("America/Santiago", "America/Santiago"),
|
||||||
|
("America/Santo_Domingo", "America/Santo_Domingo"),
|
||||||
|
("America/Sao_Paulo", "America/Sao_Paulo"),
|
||||||
|
("America/Scoresbysund", "America/Scoresbysund"),
|
||||||
|
("America/Shiprock", "America/Shiprock"),
|
||||||
|
("America/Sitka", "America/Sitka"),
|
||||||
|
("America/St_Barthelemy", "America/St_Barthelemy"),
|
||||||
|
("America/St_Johns", "America/St_Johns"),
|
||||||
|
("America/St_Kitts", "America/St_Kitts"),
|
||||||
|
("America/St_Lucia", "America/St_Lucia"),
|
||||||
|
("America/St_Thomas", "America/St_Thomas"),
|
||||||
|
("America/St_Vincent", "America/St_Vincent"),
|
||||||
|
("America/Swift_Current", "America/Swift_Current"),
|
||||||
|
("America/Tegucigalpa", "America/Tegucigalpa"),
|
||||||
|
("America/Thule", "America/Thule"),
|
||||||
|
("America/Thunder_Bay", "America/Thunder_Bay"),
|
||||||
|
("America/Tijuana", "America/Tijuana"),
|
||||||
|
("America/Toronto", "America/Toronto"),
|
||||||
|
("America/Tortola", "America/Tortola"),
|
||||||
|
("America/Vancouver", "America/Vancouver"),
|
||||||
|
("America/Virgin", "America/Virgin"),
|
||||||
|
("America/Whitehorse", "America/Whitehorse"),
|
||||||
|
("America/Winnipeg", "America/Winnipeg"),
|
||||||
|
("America/Yakutat", "America/Yakutat"),
|
||||||
|
("America/Yellowknife", "America/Yellowknife"),
|
||||||
|
("Antarctica/Casey", "Antarctica/Casey"),
|
||||||
|
("Antarctica/Davis", "Antarctica/Davis"),
|
||||||
|
("Antarctica/DumontDUrville", "Antarctica/DumontDUrville"),
|
||||||
|
("Antarctica/Macquarie", "Antarctica/Macquarie"),
|
||||||
|
("Antarctica/Mawson", "Antarctica/Mawson"),
|
||||||
|
("Antarctica/McMurdo", "Antarctica/McMurdo"),
|
||||||
|
("Antarctica/Palmer", "Antarctica/Palmer"),
|
||||||
|
("Antarctica/Rothera", "Antarctica/Rothera"),
|
||||||
|
("Antarctica/South_Pole", "Antarctica/South_Pole"),
|
||||||
|
("Antarctica/Syowa", "Antarctica/Syowa"),
|
||||||
|
("Antarctica/Troll", "Antarctica/Troll"),
|
||||||
|
("Antarctica/Vostok", "Antarctica/Vostok"),
|
||||||
|
("Arctic/Longyearbyen", "Arctic/Longyearbyen"),
|
||||||
|
("Asia/Aden", "Asia/Aden"),
|
||||||
|
("Asia/Almaty", "Asia/Almaty"),
|
||||||
|
("Asia/Amman", "Asia/Amman"),
|
||||||
|
("Asia/Anadyr", "Asia/Anadyr"),
|
||||||
|
("Asia/Aqtau", "Asia/Aqtau"),
|
||||||
|
("Asia/Aqtobe", "Asia/Aqtobe"),
|
||||||
|
("Asia/Ashgabat", "Asia/Ashgabat"),
|
||||||
|
("Asia/Ashkhabad", "Asia/Ashkhabad"),
|
||||||
|
("Asia/Atyrau", "Asia/Atyrau"),
|
||||||
|
("Asia/Baghdad", "Asia/Baghdad"),
|
||||||
|
("Asia/Bahrain", "Asia/Bahrain"),
|
||||||
|
("Asia/Baku", "Asia/Baku"),
|
||||||
|
("Asia/Bangkok", "Asia/Bangkok"),
|
||||||
|
("Asia/Barnaul", "Asia/Barnaul"),
|
||||||
|
("Asia/Beirut", "Asia/Beirut"),
|
||||||
|
("Asia/Bishkek", "Asia/Bishkek"),
|
||||||
|
("Asia/Brunei", "Asia/Brunei"),
|
||||||
|
("Asia/Calcutta", "Asia/Calcutta"),
|
||||||
|
("Asia/Chita", "Asia/Chita"),
|
||||||
|
("Asia/Choibalsan", "Asia/Choibalsan"),
|
||||||
|
("Asia/Chongqing", "Asia/Chongqing"),
|
||||||
|
("Asia/Chungking", "Asia/Chungking"),
|
||||||
|
("Asia/Colombo", "Asia/Colombo"),
|
||||||
|
("Asia/Dacca", "Asia/Dacca"),
|
||||||
|
("Asia/Damascus", "Asia/Damascus"),
|
||||||
|
("Asia/Dhaka", "Asia/Dhaka"),
|
||||||
|
("Asia/Dili", "Asia/Dili"),
|
||||||
|
("Asia/Dubai", "Asia/Dubai"),
|
||||||
|
("Asia/Dushanbe", "Asia/Dushanbe"),
|
||||||
|
("Asia/Famagusta", "Asia/Famagusta"),
|
||||||
|
("Asia/Gaza", "Asia/Gaza"),
|
||||||
|
("Asia/Harbin", "Asia/Harbin"),
|
||||||
|
("Asia/Hebron", "Asia/Hebron"),
|
||||||
|
("Asia/Ho_Chi_Minh", "Asia/Ho_Chi_Minh"),
|
||||||
|
("Asia/Hong_Kong", "Asia/Hong_Kong"),
|
||||||
|
("Asia/Hovd", "Asia/Hovd"),
|
||||||
|
("Asia/Irkutsk", "Asia/Irkutsk"),
|
||||||
|
("Asia/Istanbul", "Asia/Istanbul"),
|
||||||
|
("Asia/Jakarta", "Asia/Jakarta"),
|
||||||
|
("Asia/Jayapura", "Asia/Jayapura"),
|
||||||
|
("Asia/Jerusalem", "Asia/Jerusalem"),
|
||||||
|
("Asia/Kabul", "Asia/Kabul"),
|
||||||
|
("Asia/Kamchatka", "Asia/Kamchatka"),
|
||||||
|
("Asia/Karachi", "Asia/Karachi"),
|
||||||
|
("Asia/Kashgar", "Asia/Kashgar"),
|
||||||
|
("Asia/Kathmandu", "Asia/Kathmandu"),
|
||||||
|
("Asia/Katmandu", "Asia/Katmandu"),
|
||||||
|
("Asia/Khandyga", "Asia/Khandyga"),
|
||||||
|
("Asia/Kolkata", "Asia/Kolkata"),
|
||||||
|
("Asia/Krasnoyarsk", "Asia/Krasnoyarsk"),
|
||||||
|
("Asia/Kuala_Lumpur", "Asia/Kuala_Lumpur"),
|
||||||
|
("Asia/Kuching", "Asia/Kuching"),
|
||||||
|
("Asia/Kuwait", "Asia/Kuwait"),
|
||||||
|
("Asia/Macao", "Asia/Macao"),
|
||||||
|
("Asia/Macau", "Asia/Macau"),
|
||||||
|
("Asia/Magadan", "Asia/Magadan"),
|
||||||
|
("Asia/Makassar", "Asia/Makassar"),
|
||||||
|
("Asia/Manila", "Asia/Manila"),
|
||||||
|
("Asia/Muscat", "Asia/Muscat"),
|
||||||
|
("Asia/Nicosia", "Asia/Nicosia"),
|
||||||
|
("Asia/Novokuznetsk", "Asia/Novokuznetsk"),
|
||||||
|
("Asia/Novosibirsk", "Asia/Novosibirsk"),
|
||||||
|
("Asia/Omsk", "Asia/Omsk"),
|
||||||
|
("Asia/Oral", "Asia/Oral"),
|
||||||
|
("Asia/Phnom_Penh", "Asia/Phnom_Penh"),
|
||||||
|
("Asia/Pontianak", "Asia/Pontianak"),
|
||||||
|
("Asia/Pyongyang", "Asia/Pyongyang"),
|
||||||
|
("Asia/Qatar", "Asia/Qatar"),
|
||||||
|
("Asia/Qostanay", "Asia/Qostanay"),
|
||||||
|
("Asia/Qyzylorda", "Asia/Qyzylorda"),
|
||||||
|
("Asia/Rangoon", "Asia/Rangoon"),
|
||||||
|
("Asia/Riyadh", "Asia/Riyadh"),
|
||||||
|
("Asia/Saigon", "Asia/Saigon"),
|
||||||
|
("Asia/Sakhalin", "Asia/Sakhalin"),
|
||||||
|
("Asia/Samarkand", "Asia/Samarkand"),
|
||||||
|
("Asia/Seoul", "Asia/Seoul"),
|
||||||
|
("Asia/Shanghai", "Asia/Shanghai"),
|
||||||
|
("Asia/Singapore", "Asia/Singapore"),
|
||||||
|
("Asia/Srednekolymsk", "Asia/Srednekolymsk"),
|
||||||
|
("Asia/Taipei", "Asia/Taipei"),
|
||||||
|
("Asia/Tashkent", "Asia/Tashkent"),
|
||||||
|
("Asia/Tbilisi", "Asia/Tbilisi"),
|
||||||
|
("Asia/Tehran", "Asia/Tehran"),
|
||||||
|
("Asia/Tel_Aviv", "Asia/Tel_Aviv"),
|
||||||
|
("Asia/Thimbu", "Asia/Thimbu"),
|
||||||
|
("Asia/Thimphu", "Asia/Thimphu"),
|
||||||
|
("Asia/Tokyo", "Asia/Tokyo"),
|
||||||
|
("Asia/Tomsk", "Asia/Tomsk"),
|
||||||
|
("Asia/Ujung_Pandang", "Asia/Ujung_Pandang"),
|
||||||
|
("Asia/Ulaanbaatar", "Asia/Ulaanbaatar"),
|
||||||
|
("Asia/Ulan_Bator", "Asia/Ulan_Bator"),
|
||||||
|
("Asia/Urumqi", "Asia/Urumqi"),
|
||||||
|
("Asia/Ust-Nera", "Asia/Ust-Nera"),
|
||||||
|
("Asia/Vientiane", "Asia/Vientiane"),
|
||||||
|
("Asia/Vladivostok", "Asia/Vladivostok"),
|
||||||
|
("Asia/Yakutsk", "Asia/Yakutsk"),
|
||||||
|
("Asia/Yangon", "Asia/Yangon"),
|
||||||
|
("Asia/Yekaterinburg", "Asia/Yekaterinburg"),
|
||||||
|
("Asia/Yerevan", "Asia/Yerevan"),
|
||||||
|
("Atlantic/Azores", "Atlantic/Azores"),
|
||||||
|
("Atlantic/Bermuda", "Atlantic/Bermuda"),
|
||||||
|
("Atlantic/Canary", "Atlantic/Canary"),
|
||||||
|
("Atlantic/Cape_Verde", "Atlantic/Cape_Verde"),
|
||||||
|
("Atlantic/Faeroe", "Atlantic/Faeroe"),
|
||||||
|
("Atlantic/Faroe", "Atlantic/Faroe"),
|
||||||
|
("Atlantic/Jan_Mayen", "Atlantic/Jan_Mayen"),
|
||||||
|
("Atlantic/Madeira", "Atlantic/Madeira"),
|
||||||
|
("Atlantic/Reykjavik", "Atlantic/Reykjavik"),
|
||||||
|
("Atlantic/South_Georgia", "Atlantic/South_Georgia"),
|
||||||
|
("Atlantic/St_Helena", "Atlantic/St_Helena"),
|
||||||
|
("Atlantic/Stanley", "Atlantic/Stanley"),
|
||||||
|
("Australia/ACT", "Australia/ACT"),
|
||||||
|
("Australia/Adelaide", "Australia/Adelaide"),
|
||||||
|
("Australia/Brisbane", "Australia/Brisbane"),
|
||||||
|
("Australia/Broken_Hill", "Australia/Broken_Hill"),
|
||||||
|
("Australia/Canberra", "Australia/Canberra"),
|
||||||
|
("Australia/Currie", "Australia/Currie"),
|
||||||
|
("Australia/Darwin", "Australia/Darwin"),
|
||||||
|
("Australia/Eucla", "Australia/Eucla"),
|
||||||
|
("Australia/Hobart", "Australia/Hobart"),
|
||||||
|
("Australia/LHI", "Australia/LHI"),
|
||||||
|
("Australia/Lindeman", "Australia/Lindeman"),
|
||||||
|
("Australia/Lord_Howe", "Australia/Lord_Howe"),
|
||||||
|
("Australia/Melbourne", "Australia/Melbourne"),
|
||||||
|
("Australia/NSW", "Australia/NSW"),
|
||||||
|
("Australia/North", "Australia/North"),
|
||||||
|
("Australia/Perth", "Australia/Perth"),
|
||||||
|
("Australia/Queensland", "Australia/Queensland"),
|
||||||
|
("Australia/South", "Australia/South"),
|
||||||
|
("Australia/Sydney", "Australia/Sydney"),
|
||||||
|
("Australia/Tasmania", "Australia/Tasmania"),
|
||||||
|
("Australia/Victoria", "Australia/Victoria"),
|
||||||
|
("Australia/West", "Australia/West"),
|
||||||
|
("Australia/Yancowinna", "Australia/Yancowinna"),
|
||||||
|
("Brazil/Acre", "Brazil/Acre"),
|
||||||
|
("Brazil/DeNoronha", "Brazil/DeNoronha"),
|
||||||
|
("Brazil/East", "Brazil/East"),
|
||||||
|
("Brazil/West", "Brazil/West"),
|
||||||
|
("CET", "CET"),
|
||||||
|
("CST6CDT", "CST6CDT"),
|
||||||
|
("Canada/Atlantic", "Canada/Atlantic"),
|
||||||
|
("Canada/Central", "Canada/Central"),
|
||||||
|
("Canada/Eastern", "Canada/Eastern"),
|
||||||
|
("Canada/Mountain", "Canada/Mountain"),
|
||||||
|
("Canada/Newfoundland", "Canada/Newfoundland"),
|
||||||
|
("Canada/Pacific", "Canada/Pacific"),
|
||||||
|
("Canada/Saskatchewan", "Canada/Saskatchewan"),
|
||||||
|
("Canada/Yukon", "Canada/Yukon"),
|
||||||
|
("Chile/Continental", "Chile/Continental"),
|
||||||
|
("Chile/EasterIsland", "Chile/EasterIsland"),
|
||||||
|
("Cuba", "Cuba"),
|
||||||
|
("EET", "EET"),
|
||||||
|
("EST", "EST"),
|
||||||
|
("EST5EDT", "EST5EDT"),
|
||||||
|
("Egypt", "Egypt"),
|
||||||
|
("Eire", "Eire"),
|
||||||
|
("Etc/GMT", "Etc/GMT"),
|
||||||
|
("Etc/GMT+0", "Etc/GMT+0"),
|
||||||
|
("Etc/GMT+1", "Etc/GMT+1"),
|
||||||
|
("Etc/GMT+10", "Etc/GMT+10"),
|
||||||
|
("Etc/GMT+11", "Etc/GMT+11"),
|
||||||
|
("Etc/GMT+12", "Etc/GMT+12"),
|
||||||
|
("Etc/GMT+2", "Etc/GMT+2"),
|
||||||
|
("Etc/GMT+3", "Etc/GMT+3"),
|
||||||
|
("Etc/GMT+4", "Etc/GMT+4"),
|
||||||
|
("Etc/GMT+5", "Etc/GMT+5"),
|
||||||
|
("Etc/GMT+6", "Etc/GMT+6"),
|
||||||
|
("Etc/GMT+7", "Etc/GMT+7"),
|
||||||
|
("Etc/GMT+8", "Etc/GMT+8"),
|
||||||
|
("Etc/GMT+9", "Etc/GMT+9"),
|
||||||
|
("Etc/GMT-0", "Etc/GMT-0"),
|
||||||
|
("Etc/GMT-1", "Etc/GMT-1"),
|
||||||
|
("Etc/GMT-10", "Etc/GMT-10"),
|
||||||
|
("Etc/GMT-11", "Etc/GMT-11"),
|
||||||
|
("Etc/GMT-12", "Etc/GMT-12"),
|
||||||
|
("Etc/GMT-13", "Etc/GMT-13"),
|
||||||
|
("Etc/GMT-14", "Etc/GMT-14"),
|
||||||
|
("Etc/GMT-2", "Etc/GMT-2"),
|
||||||
|
("Etc/GMT-3", "Etc/GMT-3"),
|
||||||
|
("Etc/GMT-4", "Etc/GMT-4"),
|
||||||
|
("Etc/GMT-5", "Etc/GMT-5"),
|
||||||
|
("Etc/GMT-6", "Etc/GMT-6"),
|
||||||
|
("Etc/GMT-7", "Etc/GMT-7"),
|
||||||
|
("Etc/GMT-8", "Etc/GMT-8"),
|
||||||
|
("Etc/GMT-9", "Etc/GMT-9"),
|
||||||
|
("Etc/GMT0", "Etc/GMT0"),
|
||||||
|
("Etc/Greenwich", "Etc/Greenwich"),
|
||||||
|
("Etc/UCT", "Etc/UCT"),
|
||||||
|
("Etc/UTC", "Etc/UTC"),
|
||||||
|
("Etc/Universal", "Etc/Universal"),
|
||||||
|
("Etc/Zulu", "Etc/Zulu"),
|
||||||
|
("Europe/Amsterdam", "Europe/Amsterdam"),
|
||||||
|
("Europe/Andorra", "Europe/Andorra"),
|
||||||
|
("Europe/Astrakhan", "Europe/Astrakhan"),
|
||||||
|
("Europe/Athens", "Europe/Athens"),
|
||||||
|
("Europe/Belfast", "Europe/Belfast"),
|
||||||
|
("Europe/Belgrade", "Europe/Belgrade"),
|
||||||
|
("Europe/Berlin", "Europe/Berlin"),
|
||||||
|
("Europe/Bratislava", "Europe/Bratislava"),
|
||||||
|
("Europe/Brussels", "Europe/Brussels"),
|
||||||
|
("Europe/Bucharest", "Europe/Bucharest"),
|
||||||
|
("Europe/Budapest", "Europe/Budapest"),
|
||||||
|
("Europe/Busingen", "Europe/Busingen"),
|
||||||
|
("Europe/Chisinau", "Europe/Chisinau"),
|
||||||
|
("Europe/Copenhagen", "Europe/Copenhagen"),
|
||||||
|
("Europe/Dublin", "Europe/Dublin"),
|
||||||
|
("Europe/Gibraltar", "Europe/Gibraltar"),
|
||||||
|
("Europe/Guernsey", "Europe/Guernsey"),
|
||||||
|
("Europe/Helsinki", "Europe/Helsinki"),
|
||||||
|
("Europe/Isle_of_Man", "Europe/Isle_of_Man"),
|
||||||
|
("Europe/Istanbul", "Europe/Istanbul"),
|
||||||
|
("Europe/Jersey", "Europe/Jersey"),
|
||||||
|
("Europe/Kaliningrad", "Europe/Kaliningrad"),
|
||||||
|
("Europe/Kiev", "Europe/Kiev"),
|
||||||
|
("Europe/Kirov", "Europe/Kirov"),
|
||||||
|
("Europe/Kyiv", "Europe/Kyiv"),
|
||||||
|
("Europe/Lisbon", "Europe/Lisbon"),
|
||||||
|
("Europe/Ljubljana", "Europe/Ljubljana"),
|
||||||
|
("Europe/London", "Europe/London"),
|
||||||
|
("Europe/Luxembourg", "Europe/Luxembourg"),
|
||||||
|
("Europe/Madrid", "Europe/Madrid"),
|
||||||
|
("Europe/Malta", "Europe/Malta"),
|
||||||
|
("Europe/Mariehamn", "Europe/Mariehamn"),
|
||||||
|
("Europe/Minsk", "Europe/Minsk"),
|
||||||
|
("Europe/Monaco", "Europe/Monaco"),
|
||||||
|
("Europe/Moscow", "Europe/Moscow"),
|
||||||
|
("Europe/Nicosia", "Europe/Nicosia"),
|
||||||
|
("Europe/Oslo", "Europe/Oslo"),
|
||||||
|
("Europe/Paris", "Europe/Paris"),
|
||||||
|
("Europe/Podgorica", "Europe/Podgorica"),
|
||||||
|
("Europe/Prague", "Europe/Prague"),
|
||||||
|
("Europe/Riga", "Europe/Riga"),
|
||||||
|
("Europe/Rome", "Europe/Rome"),
|
||||||
|
("Europe/Samara", "Europe/Samara"),
|
||||||
|
("Europe/San_Marino", "Europe/San_Marino"),
|
||||||
|
("Europe/Sarajevo", "Europe/Sarajevo"),
|
||||||
|
("Europe/Saratov", "Europe/Saratov"),
|
||||||
|
("Europe/Simferopol", "Europe/Simferopol"),
|
||||||
|
("Europe/Skopje", "Europe/Skopje"),
|
||||||
|
("Europe/Sofia", "Europe/Sofia"),
|
||||||
|
("Europe/Stockholm", "Europe/Stockholm"),
|
||||||
|
("Europe/Tallinn", "Europe/Tallinn"),
|
||||||
|
("Europe/Tirane", "Europe/Tirane"),
|
||||||
|
("Europe/Tiraspol", "Europe/Tiraspol"),
|
||||||
|
("Europe/Ulyanovsk", "Europe/Ulyanovsk"),
|
||||||
|
("Europe/Uzhgorod", "Europe/Uzhgorod"),
|
||||||
|
("Europe/Vaduz", "Europe/Vaduz"),
|
||||||
|
("Europe/Vatican", "Europe/Vatican"),
|
||||||
|
("Europe/Vienna", "Europe/Vienna"),
|
||||||
|
("Europe/Vilnius", "Europe/Vilnius"),
|
||||||
|
("Europe/Volgograd", "Europe/Volgograd"),
|
||||||
|
("Europe/Warsaw", "Europe/Warsaw"),
|
||||||
|
("Europe/Zagreb", "Europe/Zagreb"),
|
||||||
|
("Europe/Zaporozhye", "Europe/Zaporozhye"),
|
||||||
|
("Europe/Zurich", "Europe/Zurich"),
|
||||||
|
("Factory", "Factory"),
|
||||||
|
("GB", "GB"),
|
||||||
|
("GB-Eire", "GB-Eire"),
|
||||||
|
("GMT", "GMT"),
|
||||||
|
("GMT+0", "GMT+0"),
|
||||||
|
("GMT-0", "GMT-0"),
|
||||||
|
("GMT0", "GMT0"),
|
||||||
|
("Greenwich", "Greenwich"),
|
||||||
|
("HST", "HST"),
|
||||||
|
("Hongkong", "Hongkong"),
|
||||||
|
("Iceland", "Iceland"),
|
||||||
|
("Indian/Antananarivo", "Indian/Antananarivo"),
|
||||||
|
("Indian/Chagos", "Indian/Chagos"),
|
||||||
|
("Indian/Christmas", "Indian/Christmas"),
|
||||||
|
("Indian/Cocos", "Indian/Cocos"),
|
||||||
|
("Indian/Comoro", "Indian/Comoro"),
|
||||||
|
("Indian/Kerguelen", "Indian/Kerguelen"),
|
||||||
|
("Indian/Mahe", "Indian/Mahe"),
|
||||||
|
("Indian/Maldives", "Indian/Maldives"),
|
||||||
|
("Indian/Mauritius", "Indian/Mauritius"),
|
||||||
|
("Indian/Mayotte", "Indian/Mayotte"),
|
||||||
|
("Indian/Reunion", "Indian/Reunion"),
|
||||||
|
("Iran", "Iran"),
|
||||||
|
("Israel", "Israel"),
|
||||||
|
("Jamaica", "Jamaica"),
|
||||||
|
("Japan", "Japan"),
|
||||||
|
("Kwajalein", "Kwajalein"),
|
||||||
|
("Libya", "Libya"),
|
||||||
|
("MET", "MET"),
|
||||||
|
("MST", "MST"),
|
||||||
|
("MST7MDT", "MST7MDT"),
|
||||||
|
("Mexico/BajaNorte", "Mexico/BajaNorte"),
|
||||||
|
("Mexico/BajaSur", "Mexico/BajaSur"),
|
||||||
|
("Mexico/General", "Mexico/General"),
|
||||||
|
("NZ", "NZ"),
|
||||||
|
("NZ-CHAT", "NZ-CHAT"),
|
||||||
|
("Navajo", "Navajo"),
|
||||||
|
("PRC", "PRC"),
|
||||||
|
("PST8PDT", "PST8PDT"),
|
||||||
|
("Pacific/Apia", "Pacific/Apia"),
|
||||||
|
("Pacific/Auckland", "Pacific/Auckland"),
|
||||||
|
("Pacific/Bougainville", "Pacific/Bougainville"),
|
||||||
|
("Pacific/Chatham", "Pacific/Chatham"),
|
||||||
|
("Pacific/Chuuk", "Pacific/Chuuk"),
|
||||||
|
("Pacific/Easter", "Pacific/Easter"),
|
||||||
|
("Pacific/Efate", "Pacific/Efate"),
|
||||||
|
("Pacific/Enderbury", "Pacific/Enderbury"),
|
||||||
|
("Pacific/Fakaofo", "Pacific/Fakaofo"),
|
||||||
|
("Pacific/Fiji", "Pacific/Fiji"),
|
||||||
|
("Pacific/Funafuti", "Pacific/Funafuti"),
|
||||||
|
("Pacific/Galapagos", "Pacific/Galapagos"),
|
||||||
|
("Pacific/Gambier", "Pacific/Gambier"),
|
||||||
|
("Pacific/Guadalcanal", "Pacific/Guadalcanal"),
|
||||||
|
("Pacific/Guam", "Pacific/Guam"),
|
||||||
|
("Pacific/Honolulu", "Pacific/Honolulu"),
|
||||||
|
("Pacific/Johnston", "Pacific/Johnston"),
|
||||||
|
("Pacific/Kanton", "Pacific/Kanton"),
|
||||||
|
("Pacific/Kiritimati", "Pacific/Kiritimati"),
|
||||||
|
("Pacific/Kosrae", "Pacific/Kosrae"),
|
||||||
|
("Pacific/Kwajalein", "Pacific/Kwajalein"),
|
||||||
|
("Pacific/Majuro", "Pacific/Majuro"),
|
||||||
|
("Pacific/Marquesas", "Pacific/Marquesas"),
|
||||||
|
("Pacific/Midway", "Pacific/Midway"),
|
||||||
|
("Pacific/Nauru", "Pacific/Nauru"),
|
||||||
|
("Pacific/Niue", "Pacific/Niue"),
|
||||||
|
("Pacific/Norfolk", "Pacific/Norfolk"),
|
||||||
|
("Pacific/Noumea", "Pacific/Noumea"),
|
||||||
|
("Pacific/Pago_Pago", "Pacific/Pago_Pago"),
|
||||||
|
("Pacific/Palau", "Pacific/Palau"),
|
||||||
|
("Pacific/Pitcairn", "Pacific/Pitcairn"),
|
||||||
|
("Pacific/Pohnpei", "Pacific/Pohnpei"),
|
||||||
|
("Pacific/Ponape", "Pacific/Ponape"),
|
||||||
|
("Pacific/Port_Moresby", "Pacific/Port_Moresby"),
|
||||||
|
("Pacific/Rarotonga", "Pacific/Rarotonga"),
|
||||||
|
("Pacific/Saipan", "Pacific/Saipan"),
|
||||||
|
("Pacific/Samoa", "Pacific/Samoa"),
|
||||||
|
("Pacific/Tahiti", "Pacific/Tahiti"),
|
||||||
|
("Pacific/Tarawa", "Pacific/Tarawa"),
|
||||||
|
("Pacific/Tongatapu", "Pacific/Tongatapu"),
|
||||||
|
("Pacific/Truk", "Pacific/Truk"),
|
||||||
|
("Pacific/Wake", "Pacific/Wake"),
|
||||||
|
("Pacific/Wallis", "Pacific/Wallis"),
|
||||||
|
("Pacific/Yap", "Pacific/Yap"),
|
||||||
|
("Poland", "Poland"),
|
||||||
|
("Portugal", "Portugal"),
|
||||||
|
("ROC", "ROC"),
|
||||||
|
("ROK", "ROK"),
|
||||||
|
("Singapore", "Singapore"),
|
||||||
|
("Turkey", "Turkey"),
|
||||||
|
("UCT", "UCT"),
|
||||||
|
("US/Alaska", "US/Alaska"),
|
||||||
|
("US/Aleutian", "US/Aleutian"),
|
||||||
|
("US/Arizona", "US/Arizona"),
|
||||||
|
("US/Central", "US/Central"),
|
||||||
|
("US/East-Indiana", "US/East-Indiana"),
|
||||||
|
("US/Eastern", "US/Eastern"),
|
||||||
|
("US/Hawaii", "US/Hawaii"),
|
||||||
|
("US/Indiana-Starke", "US/Indiana-Starke"),
|
||||||
|
("US/Michigan", "US/Michigan"),
|
||||||
|
("US/Mountain", "US/Mountain"),
|
||||||
|
("US/Pacific", "US/Pacific"),
|
||||||
|
("US/Samoa", "US/Samoa"),
|
||||||
|
("UTC", "UTC"),
|
||||||
|
("Universal", "Universal"),
|
||||||
|
("W-SU", "W-SU"),
|
||||||
|
("WET", "WET"),
|
||||||
|
("Zulu", "Zulu"),
|
||||||
|
],
|
||||||
|
default=aircox.models.schedule.current_timezone_key,
|
||||||
|
help_text="timezone used for the date",
|
||||||
|
max_length=100,
|
||||||
|
verbose_name="timezone",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="staticpage",
|
||||||
|
name="attach_to",
|
||||||
|
field=models.SmallIntegerField(
|
||||||
|
blank=True,
|
||||||
|
choices=[
|
||||||
|
(0, "Home page"),
|
||||||
|
(1, "Diffusions page"),
|
||||||
|
(2, "Logs page"),
|
||||||
|
(3, "Programs list"),
|
||||||
|
(4, "Episodes list"),
|
||||||
|
(5, "Articles list"),
|
||||||
|
(6, "Publications list"),
|
||||||
|
],
|
||||||
|
help_text="display this page content to related element",
|
||||||
|
null=True,
|
||||||
|
verbose_name="attach to",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
25
aircox/migrations/0015_program_editors.py
Normal file
25
aircox/migrations/0015_program_editors.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Generated by Django 4.2.5 on 2023-10-18 13:50
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("auth", "0012_alter_user_first_name_max_length"),
|
||||||
|
("aircox", "0014_alter_schedule_timezone"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="program",
|
||||||
|
name="editors",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="auth.group",
|
||||||
|
verbose_name="editors",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
32
aircox/migrations/0016_alter_staticpage_attach_to.py
Normal file
32
aircox/migrations/0016_alter_staticpage_attach_to.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Generated by Django 4.2.1 on 2023-11-28 01:15
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("aircox", "0015_alter_schedule_timezone_alter_staticpage_attach_to"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="staticpage",
|
||||||
|
name="attach_to",
|
||||||
|
field=models.SmallIntegerField(
|
||||||
|
blank=True,
|
||||||
|
choices=[
|
||||||
|
(0, "Home page"),
|
||||||
|
(1, "Diffusions page"),
|
||||||
|
(2, "Logs page"),
|
||||||
|
(3, "Programs list"),
|
||||||
|
(4, "Episodes list"),
|
||||||
|
(5, "Articles list"),
|
||||||
|
(6, "Publications list"),
|
||||||
|
(7, "Podcasts list"),
|
||||||
|
],
|
||||||
|
help_text="display this page content to related element",
|
||||||
|
null=True,
|
||||||
|
verbose_name="attach to",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# Generated by Django 4.2.1 on 2023-12-12 16:58
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("aircox", "0016_alter_staticpage_attach_to"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="navitem",
|
||||||
|
name="text",
|
||||||
|
field=models.CharField(blank=True, max_length=64, null=True, verbose_name="title"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="staticpage",
|
||||||
|
name="attach_to",
|
||||||
|
field=models.SmallIntegerField(
|
||||||
|
blank=True,
|
||||||
|
choices=[
|
||||||
|
(0, "Home page"),
|
||||||
|
(1, "Diffusions page"),
|
||||||
|
(3, "Programs list"),
|
||||||
|
(4, "Episodes list"),
|
||||||
|
(5, "Articles list"),
|
||||||
|
(6, "Publications list"),
|
||||||
|
(7, "Podcasts list"),
|
||||||
|
],
|
||||||
|
help_text="display this page content to related element",
|
||||||
|
null=True,
|
||||||
|
verbose_name="attach to",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
32
aircox/migrations/0018_alter_staticpage_attach_to.py
Normal file
32
aircox/migrations/0018_alter_staticpage_attach_to.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Generated by Django 4.2.1 on 2023-12-12 18:17
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("aircox", "0017_alter_navitem_text_alter_staticpage_attach_to"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="staticpage",
|
||||||
|
name="attach_to",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True,
|
||||||
|
choices=[
|
||||||
|
("", "Home Page"),
|
||||||
|
("timetable-list", "Timetable"),
|
||||||
|
("program-list", "Programs list"),
|
||||||
|
("episode-list", "Episodes list"),
|
||||||
|
("article-list", "Articles list"),
|
||||||
|
("page-list", "Publications list"),
|
||||||
|
("podcast-list", "Podcasts list"),
|
||||||
|
],
|
||||||
|
help_text="display this page content to related element",
|
||||||
|
max_length=32,
|
||||||
|
null=True,
|
||||||
|
verbose_name="attach to",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
12
aircox/migrations/0019_merge_20240119_1022.py
Normal file
12
aircox/migrations/0019_merge_20240119_1022.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2024-01-19 09:22
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("aircox", "0015_program_editors"),
|
||||||
|
("aircox", "0018_alter_staticpage_attach_to"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = []
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Generated by Django 4.2.1 on 2024-02-01 18:12
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("aircox", "0018_alter_staticpage_attach_to"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="station",
|
||||||
|
name="music_stream_title",
|
||||||
|
field=models.CharField(
|
||||||
|
default="Music stream",
|
||||||
|
max_length=64,
|
||||||
|
verbose_name="Music stream's title",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="staticpage",
|
||||||
|
name="attach_to",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True,
|
||||||
|
choices=[
|
||||||
|
("", "None"),
|
||||||
|
("home", "Home Page"),
|
||||||
|
("timetable-list", "Timetable"),
|
||||||
|
("program-list", "Programs list"),
|
||||||
|
("episode-list", "Episodes list"),
|
||||||
|
("article-list", "Articles list"),
|
||||||
|
("page-list", "Publications list"),
|
||||||
|
("podcast-list", "Podcasts list"),
|
||||||
|
],
|
||||||
|
help_text="display this page content to related element",
|
||||||
|
max_length=32,
|
||||||
|
null=True,
|
||||||
|
verbose_name="attach to",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
12
aircox/migrations/0020_merge_20240205_1027.py
Normal file
12
aircox/migrations/0020_merge_20240205_1027.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2024-02-05 09:27
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("aircox", "0019_merge_20240119_1022"),
|
||||||
|
("aircox", "0019_station_program_streams_title_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = []
|
||||||
623
aircox/migrations/0021_alter_schedule_timezone.py
Normal file
623
aircox/migrations/0021_alter_schedule_timezone.py
Normal file
@@ -0,0 +1,623 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2024-02-06 08:13
|
||||||
|
|
||||||
|
import aircox.models.schedule
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("aircox", "0020_merge_20240205_1027"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="schedule",
|
||||||
|
name="timezone",
|
||||||
|
field=models.CharField(
|
||||||
|
choices=[
|
||||||
|
("Africa/Abidjan", "Africa/Abidjan"),
|
||||||
|
("Africa/Accra", "Africa/Accra"),
|
||||||
|
("Africa/Addis_Ababa", "Africa/Addis_Ababa"),
|
||||||
|
("Africa/Algiers", "Africa/Algiers"),
|
||||||
|
("Africa/Asmara", "Africa/Asmara"),
|
||||||
|
("Africa/Asmera", "Africa/Asmera"),
|
||||||
|
("Africa/Bamako", "Africa/Bamako"),
|
||||||
|
("Africa/Bangui", "Africa/Bangui"),
|
||||||
|
("Africa/Banjul", "Africa/Banjul"),
|
||||||
|
("Africa/Bissau", "Africa/Bissau"),
|
||||||
|
("Africa/Blantyre", "Africa/Blantyre"),
|
||||||
|
("Africa/Brazzaville", "Africa/Brazzaville"),
|
||||||
|
("Africa/Bujumbura", "Africa/Bujumbura"),
|
||||||
|
("Africa/Cairo", "Africa/Cairo"),
|
||||||
|
("Africa/Casablanca", "Africa/Casablanca"),
|
||||||
|
("Africa/Ceuta", "Africa/Ceuta"),
|
||||||
|
("Africa/Conakry", "Africa/Conakry"),
|
||||||
|
("Africa/Dakar", "Africa/Dakar"),
|
||||||
|
("Africa/Dar_es_Salaam", "Africa/Dar_es_Salaam"),
|
||||||
|
("Africa/Djibouti", "Africa/Djibouti"),
|
||||||
|
("Africa/Douala", "Africa/Douala"),
|
||||||
|
("Africa/El_Aaiun", "Africa/El_Aaiun"),
|
||||||
|
("Africa/Freetown", "Africa/Freetown"),
|
||||||
|
("Africa/Gaborone", "Africa/Gaborone"),
|
||||||
|
("Africa/Harare", "Africa/Harare"),
|
||||||
|
("Africa/Johannesburg", "Africa/Johannesburg"),
|
||||||
|
("Africa/Juba", "Africa/Juba"),
|
||||||
|
("Africa/Kampala", "Africa/Kampala"),
|
||||||
|
("Africa/Khartoum", "Africa/Khartoum"),
|
||||||
|
("Africa/Kigali", "Africa/Kigali"),
|
||||||
|
("Africa/Kinshasa", "Africa/Kinshasa"),
|
||||||
|
("Africa/Lagos", "Africa/Lagos"),
|
||||||
|
("Africa/Libreville", "Africa/Libreville"),
|
||||||
|
("Africa/Lome", "Africa/Lome"),
|
||||||
|
("Africa/Luanda", "Africa/Luanda"),
|
||||||
|
("Africa/Lubumbashi", "Africa/Lubumbashi"),
|
||||||
|
("Africa/Lusaka", "Africa/Lusaka"),
|
||||||
|
("Africa/Malabo", "Africa/Malabo"),
|
||||||
|
("Africa/Maputo", "Africa/Maputo"),
|
||||||
|
("Africa/Maseru", "Africa/Maseru"),
|
||||||
|
("Africa/Mbabane", "Africa/Mbabane"),
|
||||||
|
("Africa/Mogadishu", "Africa/Mogadishu"),
|
||||||
|
("Africa/Monrovia", "Africa/Monrovia"),
|
||||||
|
("Africa/Nairobi", "Africa/Nairobi"),
|
||||||
|
("Africa/Ndjamena", "Africa/Ndjamena"),
|
||||||
|
("Africa/Niamey", "Africa/Niamey"),
|
||||||
|
("Africa/Nouakchott", "Africa/Nouakchott"),
|
||||||
|
("Africa/Ouagadougou", "Africa/Ouagadougou"),
|
||||||
|
("Africa/Porto-Novo", "Africa/Porto-Novo"),
|
||||||
|
("Africa/Sao_Tome", "Africa/Sao_Tome"),
|
||||||
|
("Africa/Timbuktu", "Africa/Timbuktu"),
|
||||||
|
("Africa/Tripoli", "Africa/Tripoli"),
|
||||||
|
("Africa/Tunis", "Africa/Tunis"),
|
||||||
|
("Africa/Windhoek", "Africa/Windhoek"),
|
||||||
|
("America/Adak", "America/Adak"),
|
||||||
|
("America/Anchorage", "America/Anchorage"),
|
||||||
|
("America/Anguilla", "America/Anguilla"),
|
||||||
|
("America/Antigua", "America/Antigua"),
|
||||||
|
("America/Araguaina", "America/Araguaina"),
|
||||||
|
("America/Argentina/Buenos_Aires", "America/Argentina/Buenos_Aires"),
|
||||||
|
("America/Argentina/Catamarca", "America/Argentina/Catamarca"),
|
||||||
|
("America/Argentina/ComodRivadavia", "America/Argentina/ComodRivadavia"),
|
||||||
|
("America/Argentina/Cordoba", "America/Argentina/Cordoba"),
|
||||||
|
("America/Argentina/Jujuy", "America/Argentina/Jujuy"),
|
||||||
|
("America/Argentina/La_Rioja", "America/Argentina/La_Rioja"),
|
||||||
|
("America/Argentina/Mendoza", "America/Argentina/Mendoza"),
|
||||||
|
("America/Argentina/Rio_Gallegos", "America/Argentina/Rio_Gallegos"),
|
||||||
|
("America/Argentina/Salta", "America/Argentina/Salta"),
|
||||||
|
("America/Argentina/San_Juan", "America/Argentina/San_Juan"),
|
||||||
|
("America/Argentina/San_Luis", "America/Argentina/San_Luis"),
|
||||||
|
("America/Argentina/Tucuman", "America/Argentina/Tucuman"),
|
||||||
|
("America/Argentina/Ushuaia", "America/Argentina/Ushuaia"),
|
||||||
|
("America/Aruba", "America/Aruba"),
|
||||||
|
("America/Asuncion", "America/Asuncion"),
|
||||||
|
("America/Atikokan", "America/Atikokan"),
|
||||||
|
("America/Atka", "America/Atka"),
|
||||||
|
("America/Bahia", "America/Bahia"),
|
||||||
|
("America/Bahia_Banderas", "America/Bahia_Banderas"),
|
||||||
|
("America/Barbados", "America/Barbados"),
|
||||||
|
("America/Belem", "America/Belem"),
|
||||||
|
("America/Belize", "America/Belize"),
|
||||||
|
("America/Blanc-Sablon", "America/Blanc-Sablon"),
|
||||||
|
("America/Boa_Vista", "America/Boa_Vista"),
|
||||||
|
("America/Bogota", "America/Bogota"),
|
||||||
|
("America/Boise", "America/Boise"),
|
||||||
|
("America/Buenos_Aires", "America/Buenos_Aires"),
|
||||||
|
("America/Cambridge_Bay", "America/Cambridge_Bay"),
|
||||||
|
("America/Campo_Grande", "America/Campo_Grande"),
|
||||||
|
("America/Cancun", "America/Cancun"),
|
||||||
|
("America/Caracas", "America/Caracas"),
|
||||||
|
("America/Catamarca", "America/Catamarca"),
|
||||||
|
("America/Cayenne", "America/Cayenne"),
|
||||||
|
("America/Cayman", "America/Cayman"),
|
||||||
|
("America/Chicago", "America/Chicago"),
|
||||||
|
("America/Chihuahua", "America/Chihuahua"),
|
||||||
|
("America/Ciudad_Juarez", "America/Ciudad_Juarez"),
|
||||||
|
("America/Coral_Harbour", "America/Coral_Harbour"),
|
||||||
|
("America/Cordoba", "America/Cordoba"),
|
||||||
|
("America/Costa_Rica", "America/Costa_Rica"),
|
||||||
|
("America/Creston", "America/Creston"),
|
||||||
|
("America/Cuiaba", "America/Cuiaba"),
|
||||||
|
("America/Curacao", "America/Curacao"),
|
||||||
|
("America/Danmarkshavn", "America/Danmarkshavn"),
|
||||||
|
("America/Dawson", "America/Dawson"),
|
||||||
|
("America/Dawson_Creek", "America/Dawson_Creek"),
|
||||||
|
("America/Denver", "America/Denver"),
|
||||||
|
("America/Detroit", "America/Detroit"),
|
||||||
|
("America/Dominica", "America/Dominica"),
|
||||||
|
("America/Edmonton", "America/Edmonton"),
|
||||||
|
("America/Eirunepe", "America/Eirunepe"),
|
||||||
|
("America/El_Salvador", "America/El_Salvador"),
|
||||||
|
("America/Ensenada", "America/Ensenada"),
|
||||||
|
("America/Fort_Nelson", "America/Fort_Nelson"),
|
||||||
|
("America/Fort_Wayne", "America/Fort_Wayne"),
|
||||||
|
("America/Fortaleza", "America/Fortaleza"),
|
||||||
|
("America/Glace_Bay", "America/Glace_Bay"),
|
||||||
|
("America/Godthab", "America/Godthab"),
|
||||||
|
("America/Goose_Bay", "America/Goose_Bay"),
|
||||||
|
("America/Grand_Turk", "America/Grand_Turk"),
|
||||||
|
("America/Grenada", "America/Grenada"),
|
||||||
|
("America/Guadeloupe", "America/Guadeloupe"),
|
||||||
|
("America/Guatemala", "America/Guatemala"),
|
||||||
|
("America/Guayaquil", "America/Guayaquil"),
|
||||||
|
("America/Guyana", "America/Guyana"),
|
||||||
|
("America/Halifax", "America/Halifax"),
|
||||||
|
("America/Havana", "America/Havana"),
|
||||||
|
("America/Hermosillo", "America/Hermosillo"),
|
||||||
|
("America/Indiana/Indianapolis", "America/Indiana/Indianapolis"),
|
||||||
|
("America/Indiana/Knox", "America/Indiana/Knox"),
|
||||||
|
("America/Indiana/Marengo", "America/Indiana/Marengo"),
|
||||||
|
("America/Indiana/Petersburg", "America/Indiana/Petersburg"),
|
||||||
|
("America/Indiana/Tell_City", "America/Indiana/Tell_City"),
|
||||||
|
("America/Indiana/Vevay", "America/Indiana/Vevay"),
|
||||||
|
("America/Indiana/Vincennes", "America/Indiana/Vincennes"),
|
||||||
|
("America/Indiana/Winamac", "America/Indiana/Winamac"),
|
||||||
|
("America/Indianapolis", "America/Indianapolis"),
|
||||||
|
("America/Inuvik", "America/Inuvik"),
|
||||||
|
("America/Iqaluit", "America/Iqaluit"),
|
||||||
|
("America/Jamaica", "America/Jamaica"),
|
||||||
|
("America/Jujuy", "America/Jujuy"),
|
||||||
|
("America/Juneau", "America/Juneau"),
|
||||||
|
("America/Kentucky/Louisville", "America/Kentucky/Louisville"),
|
||||||
|
("America/Kentucky/Monticello", "America/Kentucky/Monticello"),
|
||||||
|
("America/Knox_IN", "America/Knox_IN"),
|
||||||
|
("America/Kralendijk", "America/Kralendijk"),
|
||||||
|
("America/La_Paz", "America/La_Paz"),
|
||||||
|
("America/Lima", "America/Lima"),
|
||||||
|
("America/Los_Angeles", "America/Los_Angeles"),
|
||||||
|
("America/Louisville", "America/Louisville"),
|
||||||
|
("America/Lower_Princes", "America/Lower_Princes"),
|
||||||
|
("America/Maceio", "America/Maceio"),
|
||||||
|
("America/Managua", "America/Managua"),
|
||||||
|
("America/Manaus", "America/Manaus"),
|
||||||
|
("America/Marigot", "America/Marigot"),
|
||||||
|
("America/Martinique", "America/Martinique"),
|
||||||
|
("America/Matamoros", "America/Matamoros"),
|
||||||
|
("America/Mazatlan", "America/Mazatlan"),
|
||||||
|
("America/Mendoza", "America/Mendoza"),
|
||||||
|
("America/Menominee", "America/Menominee"),
|
||||||
|
("America/Merida", "America/Merida"),
|
||||||
|
("America/Metlakatla", "America/Metlakatla"),
|
||||||
|
("America/Mexico_City", "America/Mexico_City"),
|
||||||
|
("America/Miquelon", "America/Miquelon"),
|
||||||
|
("America/Moncton", "America/Moncton"),
|
||||||
|
("America/Monterrey", "America/Monterrey"),
|
||||||
|
("America/Montevideo", "America/Montevideo"),
|
||||||
|
("America/Montreal", "America/Montreal"),
|
||||||
|
("America/Montserrat", "America/Montserrat"),
|
||||||
|
("America/Nassau", "America/Nassau"),
|
||||||
|
("America/New_York", "America/New_York"),
|
||||||
|
("America/Nipigon", "America/Nipigon"),
|
||||||
|
("America/Nome", "America/Nome"),
|
||||||
|
("America/Noronha", "America/Noronha"),
|
||||||
|
("America/North_Dakota/Beulah", "America/North_Dakota/Beulah"),
|
||||||
|
("America/North_Dakota/Center", "America/North_Dakota/Center"),
|
||||||
|
("America/North_Dakota/New_Salem", "America/North_Dakota/New_Salem"),
|
||||||
|
("America/Nuuk", "America/Nuuk"),
|
||||||
|
("America/Ojinaga", "America/Ojinaga"),
|
||||||
|
("America/Panama", "America/Panama"),
|
||||||
|
("America/Pangnirtung", "America/Pangnirtung"),
|
||||||
|
("America/Paramaribo", "America/Paramaribo"),
|
||||||
|
("America/Phoenix", "America/Phoenix"),
|
||||||
|
("America/Port-au-Prince", "America/Port-au-Prince"),
|
||||||
|
("America/Port_of_Spain", "America/Port_of_Spain"),
|
||||||
|
("America/Porto_Acre", "America/Porto_Acre"),
|
||||||
|
("America/Porto_Velho", "America/Porto_Velho"),
|
||||||
|
("America/Puerto_Rico", "America/Puerto_Rico"),
|
||||||
|
("America/Punta_Arenas", "America/Punta_Arenas"),
|
||||||
|
("America/Rainy_River", "America/Rainy_River"),
|
||||||
|
("America/Rankin_Inlet", "America/Rankin_Inlet"),
|
||||||
|
("America/Recife", "America/Recife"),
|
||||||
|
("America/Regina", "America/Regina"),
|
||||||
|
("America/Resolute", "America/Resolute"),
|
||||||
|
("America/Rio_Branco", "America/Rio_Branco"),
|
||||||
|
("America/Rosario", "America/Rosario"),
|
||||||
|
("America/Santa_Isabel", "America/Santa_Isabel"),
|
||||||
|
("America/Santarem", "America/Santarem"),
|
||||||
|
("America/Santiago", "America/Santiago"),
|
||||||
|
("America/Santo_Domingo", "America/Santo_Domingo"),
|
||||||
|
("America/Sao_Paulo", "America/Sao_Paulo"),
|
||||||
|
("America/Scoresbysund", "America/Scoresbysund"),
|
||||||
|
("America/Shiprock", "America/Shiprock"),
|
||||||
|
("America/Sitka", "America/Sitka"),
|
||||||
|
("America/St_Barthelemy", "America/St_Barthelemy"),
|
||||||
|
("America/St_Johns", "America/St_Johns"),
|
||||||
|
("America/St_Kitts", "America/St_Kitts"),
|
||||||
|
("America/St_Lucia", "America/St_Lucia"),
|
||||||
|
("America/St_Thomas", "America/St_Thomas"),
|
||||||
|
("America/St_Vincent", "America/St_Vincent"),
|
||||||
|
("America/Swift_Current", "America/Swift_Current"),
|
||||||
|
("America/Tegucigalpa", "America/Tegucigalpa"),
|
||||||
|
("America/Thule", "America/Thule"),
|
||||||
|
("America/Thunder_Bay", "America/Thunder_Bay"),
|
||||||
|
("America/Tijuana", "America/Tijuana"),
|
||||||
|
("America/Toronto", "America/Toronto"),
|
||||||
|
("America/Tortola", "America/Tortola"),
|
||||||
|
("America/Vancouver", "America/Vancouver"),
|
||||||
|
("America/Virgin", "America/Virgin"),
|
||||||
|
("America/Whitehorse", "America/Whitehorse"),
|
||||||
|
("America/Winnipeg", "America/Winnipeg"),
|
||||||
|
("America/Yakutat", "America/Yakutat"),
|
||||||
|
("America/Yellowknife", "America/Yellowknife"),
|
||||||
|
("Antarctica/Casey", "Antarctica/Casey"),
|
||||||
|
("Antarctica/Davis", "Antarctica/Davis"),
|
||||||
|
("Antarctica/DumontDUrville", "Antarctica/DumontDUrville"),
|
||||||
|
("Antarctica/Macquarie", "Antarctica/Macquarie"),
|
||||||
|
("Antarctica/Mawson", "Antarctica/Mawson"),
|
||||||
|
("Antarctica/McMurdo", "Antarctica/McMurdo"),
|
||||||
|
("Antarctica/Palmer", "Antarctica/Palmer"),
|
||||||
|
("Antarctica/Rothera", "Antarctica/Rothera"),
|
||||||
|
("Antarctica/South_Pole", "Antarctica/South_Pole"),
|
||||||
|
("Antarctica/Syowa", "Antarctica/Syowa"),
|
||||||
|
("Antarctica/Troll", "Antarctica/Troll"),
|
||||||
|
("Antarctica/Vostok", "Antarctica/Vostok"),
|
||||||
|
("Arctic/Longyearbyen", "Arctic/Longyearbyen"),
|
||||||
|
("Asia/Aden", "Asia/Aden"),
|
||||||
|
("Asia/Almaty", "Asia/Almaty"),
|
||||||
|
("Asia/Amman", "Asia/Amman"),
|
||||||
|
("Asia/Anadyr", "Asia/Anadyr"),
|
||||||
|
("Asia/Aqtau", "Asia/Aqtau"),
|
||||||
|
("Asia/Aqtobe", "Asia/Aqtobe"),
|
||||||
|
("Asia/Ashgabat", "Asia/Ashgabat"),
|
||||||
|
("Asia/Ashkhabad", "Asia/Ashkhabad"),
|
||||||
|
("Asia/Atyrau", "Asia/Atyrau"),
|
||||||
|
("Asia/Baghdad", "Asia/Baghdad"),
|
||||||
|
("Asia/Bahrain", "Asia/Bahrain"),
|
||||||
|
("Asia/Baku", "Asia/Baku"),
|
||||||
|
("Asia/Bangkok", "Asia/Bangkok"),
|
||||||
|
("Asia/Barnaul", "Asia/Barnaul"),
|
||||||
|
("Asia/Beirut", "Asia/Beirut"),
|
||||||
|
("Asia/Bishkek", "Asia/Bishkek"),
|
||||||
|
("Asia/Brunei", "Asia/Brunei"),
|
||||||
|
("Asia/Calcutta", "Asia/Calcutta"),
|
||||||
|
("Asia/Chita", "Asia/Chita"),
|
||||||
|
("Asia/Choibalsan", "Asia/Choibalsan"),
|
||||||
|
("Asia/Chongqing", "Asia/Chongqing"),
|
||||||
|
("Asia/Chungking", "Asia/Chungking"),
|
||||||
|
("Asia/Colombo", "Asia/Colombo"),
|
||||||
|
("Asia/Dacca", "Asia/Dacca"),
|
||||||
|
("Asia/Damascus", "Asia/Damascus"),
|
||||||
|
("Asia/Dhaka", "Asia/Dhaka"),
|
||||||
|
("Asia/Dili", "Asia/Dili"),
|
||||||
|
("Asia/Dubai", "Asia/Dubai"),
|
||||||
|
("Asia/Dushanbe", "Asia/Dushanbe"),
|
||||||
|
("Asia/Famagusta", "Asia/Famagusta"),
|
||||||
|
("Asia/Gaza", "Asia/Gaza"),
|
||||||
|
("Asia/Harbin", "Asia/Harbin"),
|
||||||
|
("Asia/Hebron", "Asia/Hebron"),
|
||||||
|
("Asia/Ho_Chi_Minh", "Asia/Ho_Chi_Minh"),
|
||||||
|
("Asia/Hong_Kong", "Asia/Hong_Kong"),
|
||||||
|
("Asia/Hovd", "Asia/Hovd"),
|
||||||
|
("Asia/Irkutsk", "Asia/Irkutsk"),
|
||||||
|
("Asia/Istanbul", "Asia/Istanbul"),
|
||||||
|
("Asia/Jakarta", "Asia/Jakarta"),
|
||||||
|
("Asia/Jayapura", "Asia/Jayapura"),
|
||||||
|
("Asia/Jerusalem", "Asia/Jerusalem"),
|
||||||
|
("Asia/Kabul", "Asia/Kabul"),
|
||||||
|
("Asia/Kamchatka", "Asia/Kamchatka"),
|
||||||
|
("Asia/Karachi", "Asia/Karachi"),
|
||||||
|
("Asia/Kashgar", "Asia/Kashgar"),
|
||||||
|
("Asia/Kathmandu", "Asia/Kathmandu"),
|
||||||
|
("Asia/Katmandu", "Asia/Katmandu"),
|
||||||
|
("Asia/Khandyga", "Asia/Khandyga"),
|
||||||
|
("Asia/Kolkata", "Asia/Kolkata"),
|
||||||
|
("Asia/Krasnoyarsk", "Asia/Krasnoyarsk"),
|
||||||
|
("Asia/Kuala_Lumpur", "Asia/Kuala_Lumpur"),
|
||||||
|
("Asia/Kuching", "Asia/Kuching"),
|
||||||
|
("Asia/Kuwait", "Asia/Kuwait"),
|
||||||
|
("Asia/Macao", "Asia/Macao"),
|
||||||
|
("Asia/Macau", "Asia/Macau"),
|
||||||
|
("Asia/Magadan", "Asia/Magadan"),
|
||||||
|
("Asia/Makassar", "Asia/Makassar"),
|
||||||
|
("Asia/Manila", "Asia/Manila"),
|
||||||
|
("Asia/Muscat", "Asia/Muscat"),
|
||||||
|
("Asia/Nicosia", "Asia/Nicosia"),
|
||||||
|
("Asia/Novokuznetsk", "Asia/Novokuznetsk"),
|
||||||
|
("Asia/Novosibirsk", "Asia/Novosibirsk"),
|
||||||
|
("Asia/Omsk", "Asia/Omsk"),
|
||||||
|
("Asia/Oral", "Asia/Oral"),
|
||||||
|
("Asia/Phnom_Penh", "Asia/Phnom_Penh"),
|
||||||
|
("Asia/Pontianak", "Asia/Pontianak"),
|
||||||
|
("Asia/Pyongyang", "Asia/Pyongyang"),
|
||||||
|
("Asia/Qatar", "Asia/Qatar"),
|
||||||
|
("Asia/Qostanay", "Asia/Qostanay"),
|
||||||
|
("Asia/Qyzylorda", "Asia/Qyzylorda"),
|
||||||
|
("Asia/Rangoon", "Asia/Rangoon"),
|
||||||
|
("Asia/Riyadh", "Asia/Riyadh"),
|
||||||
|
("Asia/Saigon", "Asia/Saigon"),
|
||||||
|
("Asia/Sakhalin", "Asia/Sakhalin"),
|
||||||
|
("Asia/Samarkand", "Asia/Samarkand"),
|
||||||
|
("Asia/Seoul", "Asia/Seoul"),
|
||||||
|
("Asia/Shanghai", "Asia/Shanghai"),
|
||||||
|
("Asia/Singapore", "Asia/Singapore"),
|
||||||
|
("Asia/Srednekolymsk", "Asia/Srednekolymsk"),
|
||||||
|
("Asia/Taipei", "Asia/Taipei"),
|
||||||
|
("Asia/Tashkent", "Asia/Tashkent"),
|
||||||
|
("Asia/Tbilisi", "Asia/Tbilisi"),
|
||||||
|
("Asia/Tehran", "Asia/Tehran"),
|
||||||
|
("Asia/Tel_Aviv", "Asia/Tel_Aviv"),
|
||||||
|
("Asia/Thimbu", "Asia/Thimbu"),
|
||||||
|
("Asia/Thimphu", "Asia/Thimphu"),
|
||||||
|
("Asia/Tokyo", "Asia/Tokyo"),
|
||||||
|
("Asia/Tomsk", "Asia/Tomsk"),
|
||||||
|
("Asia/Ujung_Pandang", "Asia/Ujung_Pandang"),
|
||||||
|
("Asia/Ulaanbaatar", "Asia/Ulaanbaatar"),
|
||||||
|
("Asia/Ulan_Bator", "Asia/Ulan_Bator"),
|
||||||
|
("Asia/Urumqi", "Asia/Urumqi"),
|
||||||
|
("Asia/Ust-Nera", "Asia/Ust-Nera"),
|
||||||
|
("Asia/Vientiane", "Asia/Vientiane"),
|
||||||
|
("Asia/Vladivostok", "Asia/Vladivostok"),
|
||||||
|
("Asia/Yakutsk", "Asia/Yakutsk"),
|
||||||
|
("Asia/Yangon", "Asia/Yangon"),
|
||||||
|
("Asia/Yekaterinburg", "Asia/Yekaterinburg"),
|
||||||
|
("Asia/Yerevan", "Asia/Yerevan"),
|
||||||
|
("Atlantic/Azores", "Atlantic/Azores"),
|
||||||
|
("Atlantic/Bermuda", "Atlantic/Bermuda"),
|
||||||
|
("Atlantic/Canary", "Atlantic/Canary"),
|
||||||
|
("Atlantic/Cape_Verde", "Atlantic/Cape_Verde"),
|
||||||
|
("Atlantic/Faeroe", "Atlantic/Faeroe"),
|
||||||
|
("Atlantic/Faroe", "Atlantic/Faroe"),
|
||||||
|
("Atlantic/Jan_Mayen", "Atlantic/Jan_Mayen"),
|
||||||
|
("Atlantic/Madeira", "Atlantic/Madeira"),
|
||||||
|
("Atlantic/Reykjavik", "Atlantic/Reykjavik"),
|
||||||
|
("Atlantic/South_Georgia", "Atlantic/South_Georgia"),
|
||||||
|
("Atlantic/St_Helena", "Atlantic/St_Helena"),
|
||||||
|
("Atlantic/Stanley", "Atlantic/Stanley"),
|
||||||
|
("Australia/ACT", "Australia/ACT"),
|
||||||
|
("Australia/Adelaide", "Australia/Adelaide"),
|
||||||
|
("Australia/Brisbane", "Australia/Brisbane"),
|
||||||
|
("Australia/Broken_Hill", "Australia/Broken_Hill"),
|
||||||
|
("Australia/Canberra", "Australia/Canberra"),
|
||||||
|
("Australia/Currie", "Australia/Currie"),
|
||||||
|
("Australia/Darwin", "Australia/Darwin"),
|
||||||
|
("Australia/Eucla", "Australia/Eucla"),
|
||||||
|
("Australia/Hobart", "Australia/Hobart"),
|
||||||
|
("Australia/LHI", "Australia/LHI"),
|
||||||
|
("Australia/Lindeman", "Australia/Lindeman"),
|
||||||
|
("Australia/Lord_Howe", "Australia/Lord_Howe"),
|
||||||
|
("Australia/Melbourne", "Australia/Melbourne"),
|
||||||
|
("Australia/NSW", "Australia/NSW"),
|
||||||
|
("Australia/North", "Australia/North"),
|
||||||
|
("Australia/Perth", "Australia/Perth"),
|
||||||
|
("Australia/Queensland", "Australia/Queensland"),
|
||||||
|
("Australia/South", "Australia/South"),
|
||||||
|
("Australia/Sydney", "Australia/Sydney"),
|
||||||
|
("Australia/Tasmania", "Australia/Tasmania"),
|
||||||
|
("Australia/Victoria", "Australia/Victoria"),
|
||||||
|
("Australia/West", "Australia/West"),
|
||||||
|
("Australia/Yancowinna", "Australia/Yancowinna"),
|
||||||
|
("Brazil/Acre", "Brazil/Acre"),
|
||||||
|
("Brazil/DeNoronha", "Brazil/DeNoronha"),
|
||||||
|
("Brazil/East", "Brazil/East"),
|
||||||
|
("Brazil/West", "Brazil/West"),
|
||||||
|
("CET", "CET"),
|
||||||
|
("CST6CDT", "CST6CDT"),
|
||||||
|
("Canada/Atlantic", "Canada/Atlantic"),
|
||||||
|
("Canada/Central", "Canada/Central"),
|
||||||
|
("Canada/Eastern", "Canada/Eastern"),
|
||||||
|
("Canada/Mountain", "Canada/Mountain"),
|
||||||
|
("Canada/Newfoundland", "Canada/Newfoundland"),
|
||||||
|
("Canada/Pacific", "Canada/Pacific"),
|
||||||
|
("Canada/Saskatchewan", "Canada/Saskatchewan"),
|
||||||
|
("Canada/Yukon", "Canada/Yukon"),
|
||||||
|
("Chile/Continental", "Chile/Continental"),
|
||||||
|
("Chile/EasterIsland", "Chile/EasterIsland"),
|
||||||
|
("Cuba", "Cuba"),
|
||||||
|
("EET", "EET"),
|
||||||
|
("EST", "EST"),
|
||||||
|
("EST5EDT", "EST5EDT"),
|
||||||
|
("Egypt", "Egypt"),
|
||||||
|
("Eire", "Eire"),
|
||||||
|
("Etc/GMT", "Etc/GMT"),
|
||||||
|
("Etc/GMT+0", "Etc/GMT+0"),
|
||||||
|
("Etc/GMT+1", "Etc/GMT+1"),
|
||||||
|
("Etc/GMT+10", "Etc/GMT+10"),
|
||||||
|
("Etc/GMT+11", "Etc/GMT+11"),
|
||||||
|
("Etc/GMT+12", "Etc/GMT+12"),
|
||||||
|
("Etc/GMT+2", "Etc/GMT+2"),
|
||||||
|
("Etc/GMT+3", "Etc/GMT+3"),
|
||||||
|
("Etc/GMT+4", "Etc/GMT+4"),
|
||||||
|
("Etc/GMT+5", "Etc/GMT+5"),
|
||||||
|
("Etc/GMT+6", "Etc/GMT+6"),
|
||||||
|
("Etc/GMT+7", "Etc/GMT+7"),
|
||||||
|
("Etc/GMT+8", "Etc/GMT+8"),
|
||||||
|
("Etc/GMT+9", "Etc/GMT+9"),
|
||||||
|
("Etc/GMT-0", "Etc/GMT-0"),
|
||||||
|
("Etc/GMT-1", "Etc/GMT-1"),
|
||||||
|
("Etc/GMT-10", "Etc/GMT-10"),
|
||||||
|
("Etc/GMT-11", "Etc/GMT-11"),
|
||||||
|
("Etc/GMT-12", "Etc/GMT-12"),
|
||||||
|
("Etc/GMT-13", "Etc/GMT-13"),
|
||||||
|
("Etc/GMT-14", "Etc/GMT-14"),
|
||||||
|
("Etc/GMT-2", "Etc/GMT-2"),
|
||||||
|
("Etc/GMT-3", "Etc/GMT-3"),
|
||||||
|
("Etc/GMT-4", "Etc/GMT-4"),
|
||||||
|
("Etc/GMT-5", "Etc/GMT-5"),
|
||||||
|
("Etc/GMT-6", "Etc/GMT-6"),
|
||||||
|
("Etc/GMT-7", "Etc/GMT-7"),
|
||||||
|
("Etc/GMT-8", "Etc/GMT-8"),
|
||||||
|
("Etc/GMT-9", "Etc/GMT-9"),
|
||||||
|
("Etc/GMT0", "Etc/GMT0"),
|
||||||
|
("Etc/Greenwich", "Etc/Greenwich"),
|
||||||
|
("Etc/UCT", "Etc/UCT"),
|
||||||
|
("Etc/UTC", "Etc/UTC"),
|
||||||
|
("Etc/Universal", "Etc/Universal"),
|
||||||
|
("Etc/Zulu", "Etc/Zulu"),
|
||||||
|
("Europe/Amsterdam", "Europe/Amsterdam"),
|
||||||
|
("Europe/Andorra", "Europe/Andorra"),
|
||||||
|
("Europe/Astrakhan", "Europe/Astrakhan"),
|
||||||
|
("Europe/Athens", "Europe/Athens"),
|
||||||
|
("Europe/Belfast", "Europe/Belfast"),
|
||||||
|
("Europe/Belgrade", "Europe/Belgrade"),
|
||||||
|
("Europe/Berlin", "Europe/Berlin"),
|
||||||
|
("Europe/Bratislava", "Europe/Bratislava"),
|
||||||
|
("Europe/Brussels", "Europe/Brussels"),
|
||||||
|
("Europe/Bucharest", "Europe/Bucharest"),
|
||||||
|
("Europe/Budapest", "Europe/Budapest"),
|
||||||
|
("Europe/Busingen", "Europe/Busingen"),
|
||||||
|
("Europe/Chisinau", "Europe/Chisinau"),
|
||||||
|
("Europe/Copenhagen", "Europe/Copenhagen"),
|
||||||
|
("Europe/Dublin", "Europe/Dublin"),
|
||||||
|
("Europe/Gibraltar", "Europe/Gibraltar"),
|
||||||
|
("Europe/Guernsey", "Europe/Guernsey"),
|
||||||
|
("Europe/Helsinki", "Europe/Helsinki"),
|
||||||
|
("Europe/Isle_of_Man", "Europe/Isle_of_Man"),
|
||||||
|
("Europe/Istanbul", "Europe/Istanbul"),
|
||||||
|
("Europe/Jersey", "Europe/Jersey"),
|
||||||
|
("Europe/Kaliningrad", "Europe/Kaliningrad"),
|
||||||
|
("Europe/Kiev", "Europe/Kiev"),
|
||||||
|
("Europe/Kirov", "Europe/Kirov"),
|
||||||
|
("Europe/Kyiv", "Europe/Kyiv"),
|
||||||
|
("Europe/Lisbon", "Europe/Lisbon"),
|
||||||
|
("Europe/Ljubljana", "Europe/Ljubljana"),
|
||||||
|
("Europe/London", "Europe/London"),
|
||||||
|
("Europe/Luxembourg", "Europe/Luxembourg"),
|
||||||
|
("Europe/Madrid", "Europe/Madrid"),
|
||||||
|
("Europe/Malta", "Europe/Malta"),
|
||||||
|
("Europe/Mariehamn", "Europe/Mariehamn"),
|
||||||
|
("Europe/Minsk", "Europe/Minsk"),
|
||||||
|
("Europe/Monaco", "Europe/Monaco"),
|
||||||
|
("Europe/Moscow", "Europe/Moscow"),
|
||||||
|
("Europe/Nicosia", "Europe/Nicosia"),
|
||||||
|
("Europe/Oslo", "Europe/Oslo"),
|
||||||
|
("Europe/Paris", "Europe/Paris"),
|
||||||
|
("Europe/Podgorica", "Europe/Podgorica"),
|
||||||
|
("Europe/Prague", "Europe/Prague"),
|
||||||
|
("Europe/Riga", "Europe/Riga"),
|
||||||
|
("Europe/Rome", "Europe/Rome"),
|
||||||
|
("Europe/Samara", "Europe/Samara"),
|
||||||
|
("Europe/San_Marino", "Europe/San_Marino"),
|
||||||
|
("Europe/Sarajevo", "Europe/Sarajevo"),
|
||||||
|
("Europe/Saratov", "Europe/Saratov"),
|
||||||
|
("Europe/Simferopol", "Europe/Simferopol"),
|
||||||
|
("Europe/Skopje", "Europe/Skopje"),
|
||||||
|
("Europe/Sofia", "Europe/Sofia"),
|
||||||
|
("Europe/Stockholm", "Europe/Stockholm"),
|
||||||
|
("Europe/Tallinn", "Europe/Tallinn"),
|
||||||
|
("Europe/Tirane", "Europe/Tirane"),
|
||||||
|
("Europe/Tiraspol", "Europe/Tiraspol"),
|
||||||
|
("Europe/Ulyanovsk", "Europe/Ulyanovsk"),
|
||||||
|
("Europe/Uzhgorod", "Europe/Uzhgorod"),
|
||||||
|
("Europe/Vaduz", "Europe/Vaduz"),
|
||||||
|
("Europe/Vatican", "Europe/Vatican"),
|
||||||
|
("Europe/Vienna", "Europe/Vienna"),
|
||||||
|
("Europe/Vilnius", "Europe/Vilnius"),
|
||||||
|
("Europe/Volgograd", "Europe/Volgograd"),
|
||||||
|
("Europe/Warsaw", "Europe/Warsaw"),
|
||||||
|
("Europe/Zagreb", "Europe/Zagreb"),
|
||||||
|
("Europe/Zaporozhye", "Europe/Zaporozhye"),
|
||||||
|
("Europe/Zurich", "Europe/Zurich"),
|
||||||
|
("Factory", "Factory"),
|
||||||
|
("GB", "GB"),
|
||||||
|
("GB-Eire", "GB-Eire"),
|
||||||
|
("GMT", "GMT"),
|
||||||
|
("GMT+0", "GMT+0"),
|
||||||
|
("GMT-0", "GMT-0"),
|
||||||
|
("GMT0", "GMT0"),
|
||||||
|
("Greenwich", "Greenwich"),
|
||||||
|
("HST", "HST"),
|
||||||
|
("Hongkong", "Hongkong"),
|
||||||
|
("Iceland", "Iceland"),
|
||||||
|
("Indian/Antananarivo", "Indian/Antananarivo"),
|
||||||
|
("Indian/Chagos", "Indian/Chagos"),
|
||||||
|
("Indian/Christmas", "Indian/Christmas"),
|
||||||
|
("Indian/Cocos", "Indian/Cocos"),
|
||||||
|
("Indian/Comoro", "Indian/Comoro"),
|
||||||
|
("Indian/Kerguelen", "Indian/Kerguelen"),
|
||||||
|
("Indian/Mahe", "Indian/Mahe"),
|
||||||
|
("Indian/Maldives", "Indian/Maldives"),
|
||||||
|
("Indian/Mauritius", "Indian/Mauritius"),
|
||||||
|
("Indian/Mayotte", "Indian/Mayotte"),
|
||||||
|
("Indian/Reunion", "Indian/Reunion"),
|
||||||
|
("Iran", "Iran"),
|
||||||
|
("Israel", "Israel"),
|
||||||
|
("Jamaica", "Jamaica"),
|
||||||
|
("Japan", "Japan"),
|
||||||
|
("Kwajalein", "Kwajalein"),
|
||||||
|
("Libya", "Libya"),
|
||||||
|
("MET", "MET"),
|
||||||
|
("MST", "MST"),
|
||||||
|
("MST7MDT", "MST7MDT"),
|
||||||
|
("Mexico/BajaNorte", "Mexico/BajaNorte"),
|
||||||
|
("Mexico/BajaSur", "Mexico/BajaSur"),
|
||||||
|
("Mexico/General", "Mexico/General"),
|
||||||
|
("NZ", "NZ"),
|
||||||
|
("NZ-CHAT", "NZ-CHAT"),
|
||||||
|
("Navajo", "Navajo"),
|
||||||
|
("PRC", "PRC"),
|
||||||
|
("PST8PDT", "PST8PDT"),
|
||||||
|
("Pacific/Apia", "Pacific/Apia"),
|
||||||
|
("Pacific/Auckland", "Pacific/Auckland"),
|
||||||
|
("Pacific/Bougainville", "Pacific/Bougainville"),
|
||||||
|
("Pacific/Chatham", "Pacific/Chatham"),
|
||||||
|
("Pacific/Chuuk", "Pacific/Chuuk"),
|
||||||
|
("Pacific/Easter", "Pacific/Easter"),
|
||||||
|
("Pacific/Efate", "Pacific/Efate"),
|
||||||
|
("Pacific/Enderbury", "Pacific/Enderbury"),
|
||||||
|
("Pacific/Fakaofo", "Pacific/Fakaofo"),
|
||||||
|
("Pacific/Fiji", "Pacific/Fiji"),
|
||||||
|
("Pacific/Funafuti", "Pacific/Funafuti"),
|
||||||
|
("Pacific/Galapagos", "Pacific/Galapagos"),
|
||||||
|
("Pacific/Gambier", "Pacific/Gambier"),
|
||||||
|
("Pacific/Guadalcanal", "Pacific/Guadalcanal"),
|
||||||
|
("Pacific/Guam", "Pacific/Guam"),
|
||||||
|
("Pacific/Honolulu", "Pacific/Honolulu"),
|
||||||
|
("Pacific/Johnston", "Pacific/Johnston"),
|
||||||
|
("Pacific/Kanton", "Pacific/Kanton"),
|
||||||
|
("Pacific/Kiritimati", "Pacific/Kiritimati"),
|
||||||
|
("Pacific/Kosrae", "Pacific/Kosrae"),
|
||||||
|
("Pacific/Kwajalein", "Pacific/Kwajalein"),
|
||||||
|
("Pacific/Majuro", "Pacific/Majuro"),
|
||||||
|
("Pacific/Marquesas", "Pacific/Marquesas"),
|
||||||
|
("Pacific/Midway", "Pacific/Midway"),
|
||||||
|
("Pacific/Nauru", "Pacific/Nauru"),
|
||||||
|
("Pacific/Niue", "Pacific/Niue"),
|
||||||
|
("Pacific/Norfolk", "Pacific/Norfolk"),
|
||||||
|
("Pacific/Noumea", "Pacific/Noumea"),
|
||||||
|
("Pacific/Pago_Pago", "Pacific/Pago_Pago"),
|
||||||
|
("Pacific/Palau", "Pacific/Palau"),
|
||||||
|
("Pacific/Pitcairn", "Pacific/Pitcairn"),
|
||||||
|
("Pacific/Pohnpei", "Pacific/Pohnpei"),
|
||||||
|
("Pacific/Ponape", "Pacific/Ponape"),
|
||||||
|
("Pacific/Port_Moresby", "Pacific/Port_Moresby"),
|
||||||
|
("Pacific/Rarotonga", "Pacific/Rarotonga"),
|
||||||
|
("Pacific/Saipan", "Pacific/Saipan"),
|
||||||
|
("Pacific/Samoa", "Pacific/Samoa"),
|
||||||
|
("Pacific/Tahiti", "Pacific/Tahiti"),
|
||||||
|
("Pacific/Tarawa", "Pacific/Tarawa"),
|
||||||
|
("Pacific/Tongatapu", "Pacific/Tongatapu"),
|
||||||
|
("Pacific/Truk", "Pacific/Truk"),
|
||||||
|
("Pacific/Wake", "Pacific/Wake"),
|
||||||
|
("Pacific/Wallis", "Pacific/Wallis"),
|
||||||
|
("Pacific/Yap", "Pacific/Yap"),
|
||||||
|
("Poland", "Poland"),
|
||||||
|
("Portugal", "Portugal"),
|
||||||
|
("ROC", "ROC"),
|
||||||
|
("ROK", "ROK"),
|
||||||
|
("Singapore", "Singapore"),
|
||||||
|
("Turkey", "Turkey"),
|
||||||
|
("UCT", "UCT"),
|
||||||
|
("US/Alaska", "US/Alaska"),
|
||||||
|
("US/Aleutian", "US/Aleutian"),
|
||||||
|
("US/Arizona", "US/Arizona"),
|
||||||
|
("US/Central", "US/Central"),
|
||||||
|
("US/East-Indiana", "US/East-Indiana"),
|
||||||
|
("US/Eastern", "US/Eastern"),
|
||||||
|
("US/Hawaii", "US/Hawaii"),
|
||||||
|
("US/Indiana-Starke", "US/Indiana-Starke"),
|
||||||
|
("US/Michigan", "US/Michigan"),
|
||||||
|
("US/Mountain", "US/Mountain"),
|
||||||
|
("US/Pacific", "US/Pacific"),
|
||||||
|
("US/Samoa", "US/Samoa"),
|
||||||
|
("UTC", "UTC"),
|
||||||
|
("Universal", "Universal"),
|
||||||
|
("W-SU", "W-SU"),
|
||||||
|
("WET", "WET"),
|
||||||
|
("Zulu", "Zulu"),
|
||||||
|
("localtime", "localtime"),
|
||||||
|
],
|
||||||
|
default=aircox.models.schedule.current_timezone_key,
|
||||||
|
help_text="timezone used for the date",
|
||||||
|
max_length=100,
|
||||||
|
verbose_name="timezone",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
18
aircox/migrations/0022_set_group_ownership.py
Normal file
18
aircox/migrations/0022_set_group_ownership.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
from aircox.models import Program
|
||||||
|
|
||||||
|
|
||||||
|
def set_group_ownership(*args):
|
||||||
|
for program in Program.objects.all():
|
||||||
|
program.set_group_ownership()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("aircox", "0021_alter_schedule_timezone"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(set_group_ownership),
|
||||||
|
]
|
||||||
@@ -8,6 +8,7 @@ __all__ = ("Article",)
|
|||||||
|
|
||||||
class Article(Page):
|
class Article(Page):
|
||||||
detail_url_name = "article-detail"
|
detail_url_name = "article-detail"
|
||||||
|
template_prefix = "article"
|
||||||
|
|
||||||
objects = ProgramChildQuerySet.as_manager()
|
objects = ProgramChildQuerySet.as_manager()
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ class Diffusion(Rerun):
|
|||||||
- stop: the diffusion has been manually stopped
|
- stop: the diffusion has been manually stopped
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
list_url_name = "timetable-list"
|
||||||
|
|
||||||
objects = DiffusionQuerySet.as_manager()
|
objects = DiffusionQuerySet.as_manager()
|
||||||
|
|
||||||
TYPE_ON_AIR = 0x00
|
TYPE_ON_AIR = 0x00
|
||||||
@@ -127,8 +129,6 @@ class Diffusion(Rerun):
|
|||||||
# help_text = _('use this input port'),
|
# help_text = _('use this input port'),
|
||||||
# )
|
# )
|
||||||
|
|
||||||
item_template_name = "aircox/widgets/diffusion_item.html"
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("Diffusion")
|
verbose_name = _("Diffusion")
|
||||||
verbose_name_plural = _("Diffusions")
|
verbose_name_plural = _("Diffusions")
|
||||||
@@ -192,6 +192,11 @@ class Diffusion(Rerun):
|
|||||||
now = tz.now()
|
now = tz.now()
|
||||||
return self.type == self.TYPE_ON_AIR and self.start <= now and self.end >= now
|
return self.type == self.TYPE_ON_AIR and self.start <= now and self.end >= now
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_today(self):
|
||||||
|
"""True if diffusion is currently today."""
|
||||||
|
return self.start.date() == datetime.date.today()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_live(self):
|
def is_live(self):
|
||||||
"""True if Diffusion is live (False if there are sounds files)."""
|
"""True if Diffusion is live (False if there are sounds files)."""
|
||||||
|
|||||||
@@ -10,18 +10,29 @@ from .program import ProgramChildQuerySet
|
|||||||
__all__ = ("Episode",)
|
__all__ = ("Episode",)
|
||||||
|
|
||||||
|
|
||||||
|
class EpisodeQuerySet(ProgramChildQuerySet):
|
||||||
|
def with_podcasts(self):
|
||||||
|
return self.filter(sound__is_public=True).distinct()
|
||||||
|
|
||||||
|
|
||||||
class Episode(Page):
|
class Episode(Page):
|
||||||
objects = ProgramChildQuerySet.as_manager()
|
objects = EpisodeQuerySet.as_manager()
|
||||||
detail_url_name = "episode-detail"
|
detail_url_name = "episode-detail"
|
||||||
item_template_name = "aircox/widgets/episode_item.html"
|
list_url_name = "episode-list"
|
||||||
|
template_prefix = "episode"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def program(self):
|
def program(self):
|
||||||
return getattr(self.parent, "program", None)
|
return self.parent_subclass
|
||||||
|
|
||||||
|
@program.setter
|
||||||
|
def program(self, value):
|
||||||
|
self.parent = value
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def podcasts(self):
|
def podcasts(self):
|
||||||
"""Return serialized data about podcasts."""
|
"""Return serialized data about podcasts."""
|
||||||
|
from .sound import Sound
|
||||||
from ..serializers import PodcastSerializer
|
from ..serializers import PodcastSerializer
|
||||||
|
|
||||||
podcasts = [PodcastSerializer(s).data for s in self.sound_set.public().order_by("type")]
|
podcasts = [PodcastSerializer(s).data for s in self.sound_set.public().order_by("type")]
|
||||||
@@ -31,16 +42,19 @@ class Episode(Page):
|
|||||||
else:
|
else:
|
||||||
cover = None
|
cover = None
|
||||||
|
|
||||||
|
archive_index = 1
|
||||||
for index, podcast in enumerate(podcasts):
|
for index, podcast in enumerate(podcasts):
|
||||||
|
if podcast["type"] == Sound.TYPE_ARCHIVE:
|
||||||
|
if archive_index > 1:
|
||||||
|
podcast["name"] = f"{self.title} - {archive_index}"
|
||||||
|
else:
|
||||||
|
podcast["name"] = self.title
|
||||||
|
|
||||||
podcasts[index]["cover"] = cover
|
podcasts[index]["cover"] = cover
|
||||||
podcasts[index]["page_url"] = self.get_absolute_url()
|
podcasts[index]["page_url"] = self.get_absolute_url()
|
||||||
podcasts[index]["page_title"] = self.title
|
podcasts[index]["page_title"] = self.title
|
||||||
return podcasts
|
return podcasts
|
||||||
|
|
||||||
@program.setter
|
|
||||||
def program(self, value):
|
|
||||||
self.parent = value
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("Episode")
|
verbose_name = _("Episode")
|
||||||
verbose_name_plural = _("Episodes")
|
verbose_name_plural = _("Episodes")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
import operator
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -9,6 +10,7 @@ from django.utils.translation import gettext_lazy as _
|
|||||||
from .diffusion import Diffusion
|
from .diffusion import Diffusion
|
||||||
from .sound import Sound, Track
|
from .sound import Sound, Track
|
||||||
from .station import Station
|
from .station import Station
|
||||||
|
from .page import Renderable
|
||||||
|
|
||||||
logger = logging.getLogger("aircox")
|
logger = logging.getLogger("aircox")
|
||||||
|
|
||||||
@@ -46,13 +48,15 @@ class LogQuerySet(models.QuerySet):
|
|||||||
return self.filter(track__isnull=not with_it)
|
return self.filter(track__isnull=not with_it)
|
||||||
|
|
||||||
|
|
||||||
class Log(models.Model):
|
class Log(Renderable, models.Model):
|
||||||
"""Log sounds and diffusions that are played on the station.
|
"""Log sounds and diffusions that are played on the station.
|
||||||
|
|
||||||
This only remember what has been played on the outputs, not on each
|
This only remember what has been played on the outputs, not on each
|
||||||
source; Source designate here which source is responsible of that.
|
source; Source designate here which source is responsible of that.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
template_prefix = "log"
|
||||||
|
|
||||||
TYPE_STOP = 0x00
|
TYPE_STOP = 0x00
|
||||||
"""Source has been stopped, e.g. manually."""
|
"""Source has been stopped, e.g. manually."""
|
||||||
# Rule: \/ diffusion != null \/ sound != null
|
# Rule: \/ diffusion != null \/ sound != null
|
||||||
@@ -160,21 +164,22 @@ class Log(models.Model):
|
|||||||
object_list += [cls(obj) for obj in items]
|
object_list += [cls(obj) for obj in items]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def merge_diffusions(cls, logs, diffs, count=None):
|
def merge_diffusions(cls, logs, diffs, count=None, diff_count=None, group_logs=False):
|
||||||
"""Merge logs and diffusions together.
|
"""Merge logs and diffusions together.
|
||||||
|
|
||||||
`logs` can either be a queryset or a list ordered by `Log.date`.
|
`logs` can either be a queryset or a list ordered by `Log.date`.
|
||||||
"""
|
"""
|
||||||
# TODO: limit count
|
|
||||||
# FIXME: log may be iterable (in stats view)
|
|
||||||
if isinstance(logs, models.QuerySet):
|
if isinstance(logs, models.QuerySet):
|
||||||
logs = list(logs.order_by("-date"))
|
logs = list(logs.order_by("-date"))
|
||||||
diffs = deque(diffs.on_air().before().order_by("-start"))
|
diffs = diffs.on_air().order_by("-start")
|
||||||
|
if diff_count:
|
||||||
|
diffs = diffs[:diff_count]
|
||||||
|
diffs = deque(diffs)
|
||||||
object_list = []
|
object_list = []
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if not len(diffs):
|
if not len(diffs):
|
||||||
object_list += logs
|
cls._append_logs(object_list, logs, len(logs), group=group_logs)
|
||||||
break
|
break
|
||||||
|
|
||||||
if not len(logs):
|
if not len(logs):
|
||||||
@@ -184,13 +189,8 @@ class Log(models.Model):
|
|||||||
diff = diffs.popleft()
|
diff = diffs.popleft()
|
||||||
|
|
||||||
# - takes all logs after diff start
|
# - takes all logs after diff start
|
||||||
index = next(
|
index = cls._next_index(logs, diff.end, len(logs), pred=operator.le)
|
||||||
(i for i, v in enumerate(logs) if v.date <= diff.end),
|
cls._append_logs(object_list, logs, index, group=group_logs)
|
||||||
len(logs),
|
|
||||||
)
|
|
||||||
if index is not None and index > 0:
|
|
||||||
object_list += logs[:index]
|
|
||||||
logs = logs[index:]
|
|
||||||
|
|
||||||
if len(logs):
|
if len(logs):
|
||||||
# FIXME
|
# FIXME
|
||||||
@@ -199,10 +199,7 @@ class Log(models.Model):
|
|||||||
# object_list.append(logs[0])
|
# object_list.append(logs[0])
|
||||||
|
|
||||||
# - skips logs while diff is running
|
# - skips logs while diff is running
|
||||||
index = next(
|
index = cls._next_index(logs, diff.start, len(logs))
|
||||||
(i for i, v in enumerate(logs) if v.date < diff.start),
|
|
||||||
len(logs),
|
|
||||||
)
|
|
||||||
if index is not None and index > 0:
|
if index is not None and index > 0:
|
||||||
logs = logs[index:]
|
logs = logs[index:]
|
||||||
|
|
||||||
@@ -211,6 +208,40 @@ class Log(models.Model):
|
|||||||
|
|
||||||
return object_list if count is None else object_list[:count]
|
return object_list if count is None else object_list[:count]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _next_index(cls, items, date, default, pred=operator.lt):
|
||||||
|
iter = (i for i, v in enumerate(items) if pred(v.date, date))
|
||||||
|
return next(iter, default)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _append_logs(cls, object_list, logs, count, group=False):
|
||||||
|
logs = logs[:count]
|
||||||
|
if not logs:
|
||||||
|
return object_list
|
||||||
|
|
||||||
|
if group:
|
||||||
|
grouped = cls._group_logs_by_time(logs)
|
||||||
|
object_list.extend(grouped)
|
||||||
|
else:
|
||||||
|
object_list += logs
|
||||||
|
return object_list
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _group_logs_by_time(cls, logs):
|
||||||
|
last_time = -1
|
||||||
|
cum = []
|
||||||
|
for log in logs:
|
||||||
|
hour = log.date.time().hour
|
||||||
|
if hour != last_time:
|
||||||
|
if cum:
|
||||||
|
yield cum
|
||||||
|
cum = []
|
||||||
|
last_time = hour
|
||||||
|
# reverse from lowest to highest date
|
||||||
|
cum.insert(0, log)
|
||||||
|
if cum:
|
||||||
|
yield cum
|
||||||
|
|
||||||
def print(self):
|
def print(self):
|
||||||
r = []
|
r = []
|
||||||
if self.diffusion:
|
if self.diffusion:
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ from model_utils.managers import InheritanceQuerySet
|
|||||||
from .station import Station
|
from .station import Station
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
|
"Renderable",
|
||||||
"Category",
|
"Category",
|
||||||
"PageQuerySet",
|
"PageQuerySet",
|
||||||
"Page",
|
"Page",
|
||||||
@@ -25,7 +26,17 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
headline_re = re.compile(r"(<p>)?" r"(?P<headline>[^\n]{1,140}(\n|[^\.]*?\.))" r"(</p>)?")
|
headline_clean_re = re.compile(r"\n(\s| )+", re.MULTILINE)
|
||||||
|
headline_re = re.compile(r"(?P<headline>([\S+]|\s+){1,240}\S+)", re.MULTILINE)
|
||||||
|
|
||||||
|
|
||||||
|
class Renderable:
|
||||||
|
template_prefix = "page"
|
||||||
|
template_name = "aircox/widgets/{prefix}.html"
|
||||||
|
|
||||||
|
def get_template_name(self, widget):
|
||||||
|
"""Return template name for the provided widget."""
|
||||||
|
return self.template_name.format(prefix=self.template_prefix, widget=widget)
|
||||||
|
|
||||||
|
|
||||||
class Category(models.Model):
|
class Category(models.Model):
|
||||||
@@ -50,6 +61,9 @@ class BasePageQuerySet(InheritanceQuerySet):
|
|||||||
def trash(self):
|
def trash(self):
|
||||||
return self.filter(status=Page.STATUS_TRASH)
|
return self.filter(status=Page.STATUS_TRASH)
|
||||||
|
|
||||||
|
def by_last(self):
|
||||||
|
return self.order_by("-pub_date")
|
||||||
|
|
||||||
def parent(self, parent=None, id=None):
|
def parent(self, parent=None, id=None):
|
||||||
"""Return pages having this parent."""
|
"""Return pages having this parent."""
|
||||||
return self.filter(parent=parent) if id is None else self.filter(parent__id=id)
|
return self.filter(parent=parent) if id is None else self.filter(parent__id=id)
|
||||||
@@ -60,7 +74,7 @@ class BasePageQuerySet(InheritanceQuerySet):
|
|||||||
return self.filter(title__icontains=q)
|
return self.filter(title__icontains=q)
|
||||||
|
|
||||||
|
|
||||||
class BasePage(models.Model):
|
class BasePage(Renderable, models.Model):
|
||||||
"""Base class for publishable content."""
|
"""Base class for publishable content."""
|
||||||
|
|
||||||
STATUS_DRAFT = 0x00
|
STATUS_DRAFT = 0x00
|
||||||
@@ -102,11 +116,14 @@ class BasePage(models.Model):
|
|||||||
objects = BasePageQuerySet.as_manager()
|
objects = BasePageQuerySet.as_manager()
|
||||||
|
|
||||||
detail_url_name = None
|
detail_url_name = None
|
||||||
item_template_name = "aircox/widgets/page_item.html"
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def cover_url(self):
|
||||||
|
return self.cover_id and self.cover.url
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{}".format(self.title or self.pk)
|
return "{}".format(self.title or self.pk)
|
||||||
|
|
||||||
@@ -117,12 +134,17 @@ class BasePage(models.Model):
|
|||||||
if count:
|
if count:
|
||||||
self.slug += "-" + str(count)
|
self.slug += "-" + str(count)
|
||||||
|
|
||||||
if self.parent and not self.cover:
|
if self.parent:
|
||||||
self.cover = self.parent.cover
|
if self.parent == self:
|
||||||
|
self.parent = None
|
||||||
|
if not self.cover:
|
||||||
|
self.cover = self.parent.cover
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse(self.detail_url_name, kwargs={"slug": self.slug}) if self.is_published else "#"
|
if self.is_published:
|
||||||
|
return reverse(self.detail_url_name, kwargs={"slug": self.slug})
|
||||||
|
return ""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_draft(self):
|
def is_draft(self):
|
||||||
@@ -138,17 +160,28 @@ class BasePage(models.Model):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def display_title(self):
|
def display_title(self):
|
||||||
if self.is_published():
|
if self.is_published:
|
||||||
return self.title
|
return self.title
|
||||||
return self.parent.display_title()
|
return self.parent and self.parent.title or ""
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def headline(self):
|
def display_headline(self):
|
||||||
if not self.content:
|
if not self.content or not self.is_published:
|
||||||
return ""
|
return self.parent and self.parent.display_headline or ""
|
||||||
content = bleach.clean(self.content, tags=[], strip=True)
|
content = bleach.clean(self.content, tags=[], strip=True)
|
||||||
|
content = headline_clean_re.sub("\n", content)
|
||||||
|
if content.startswith("\n"):
|
||||||
|
content = content[1:]
|
||||||
headline = headline_re.search(content)
|
headline = headline_re.search(content)
|
||||||
return mark_safe(headline.groupdict()["headline"]) if headline else ""
|
if not headline:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
headline = headline.groupdict()["headline"]
|
||||||
|
suffix = "<b>...</b>" if len(headline) < len(content) else ""
|
||||||
|
|
||||||
|
headline = headline.split("\n")[:3]
|
||||||
|
headline[-1] += suffix
|
||||||
|
return mark_safe(" ".join(headline))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_init_kwargs_from(cls, page, **kwargs):
|
def get_init_kwargs_from(cls, page, **kwargs):
|
||||||
@@ -188,6 +221,23 @@ class Page(BasePage):
|
|||||||
)
|
)
|
||||||
|
|
||||||
objects = PageQuerySet.as_manager()
|
objects = PageQuerySet.as_manager()
|
||||||
|
detail_url_name = ""
|
||||||
|
list_url_name = "page-list"
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def parent_subclass(self):
|
||||||
|
if self.parent_id:
|
||||||
|
return Page.objects.get_subclass(id=self.parent_id)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
if not self.is_published and self.parent_subclass:
|
||||||
|
return self.parent_subclass.get_absolute_url()
|
||||||
|
return super().get_absolute_url()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_list_url(cls, kwargs={}):
|
||||||
|
return reverse(cls.list_url_name, kwargs=kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("Publication")
|
verbose_name = _("Publication")
|
||||||
@@ -209,45 +259,37 @@ class StaticPage(BasePage):
|
|||||||
|
|
||||||
detail_url_name = "static-page-detail"
|
detail_url_name = "static-page-detail"
|
||||||
|
|
||||||
ATTACH_TO_HOME = 0x00
|
class Target(models.TextChoices):
|
||||||
ATTACH_TO_DIFFUSIONS = 0x01
|
NONE = "", _("None")
|
||||||
ATTACH_TO_LOGS = 0x02
|
HOME = "home", _("Home Page")
|
||||||
ATTACH_TO_PROGRAMS = 0x03
|
TIMETABLE = "timetable-list", _("Timetable")
|
||||||
ATTACH_TO_EPISODES = 0x04
|
PROGRAMS = "program-list", _("Programs list")
|
||||||
ATTACH_TO_ARTICLES = 0x05
|
EPISODES = "episode-list", _("Episodes list")
|
||||||
|
ARTICLES = "article-list", _("Articles list")
|
||||||
|
PAGES = "page-list", _("Publications list")
|
||||||
|
PODCASTS = "podcast-list", _("Podcasts list")
|
||||||
|
|
||||||
ATTACH_TO_CHOICES = (
|
attach_to = models.CharField(
|
||||||
(ATTACH_TO_HOME, _("Home page")),
|
|
||||||
(ATTACH_TO_DIFFUSIONS, _("Diffusions page")),
|
|
||||||
(ATTACH_TO_LOGS, _("Logs page")),
|
|
||||||
(ATTACH_TO_PROGRAMS, _("Programs list")),
|
|
||||||
(ATTACH_TO_EPISODES, _("Episodes list")),
|
|
||||||
(ATTACH_TO_ARTICLES, _("Articles list")),
|
|
||||||
)
|
|
||||||
VIEWS = {
|
|
||||||
ATTACH_TO_HOME: "home",
|
|
||||||
ATTACH_TO_DIFFUSIONS: "diffusion-list",
|
|
||||||
ATTACH_TO_LOGS: "log-list",
|
|
||||||
ATTACH_TO_PROGRAMS: "program-list",
|
|
||||||
ATTACH_TO_EPISODES: "episode-list",
|
|
||||||
ATTACH_TO_ARTICLES: "article-list",
|
|
||||||
}
|
|
||||||
|
|
||||||
attach_to = models.SmallIntegerField(
|
|
||||||
_("attach to"),
|
_("attach to"),
|
||||||
choices=ATTACH_TO_CHOICES,
|
choices=Target.choices,
|
||||||
|
max_length=32,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
help_text=_("display this page content to related element"),
|
help_text=_("display this page content to related element"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_related_view(self):
|
||||||
|
from ..views import attached
|
||||||
|
|
||||||
|
return self.attach_to and attached.get(self.attach_to) or None
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
if self.attach_to:
|
if self.attach_to:
|
||||||
return reverse(self.VIEWS[self.attach_to])
|
return reverse(self.attach_to)
|
||||||
return super().get_absolute_url()
|
return super().get_absolute_url()
|
||||||
|
|
||||||
|
|
||||||
class Comment(models.Model):
|
class Comment(Renderable, models.Model):
|
||||||
page = models.ForeignKey(
|
page = models.ForeignKey(
|
||||||
Page,
|
Page,
|
||||||
models.CASCADE,
|
models.CASCADE,
|
||||||
@@ -260,7 +302,7 @@ class Comment(models.Model):
|
|||||||
date = models.DateTimeField(auto_now_add=True)
|
date = models.DateTimeField(auto_now_add=True)
|
||||||
content = models.TextField(_("content"), max_length=1024)
|
content = models.TextField(_("content"), max_length=1024)
|
||||||
|
|
||||||
item_template_name = "aircox/widgets/comment_item.html"
|
template_prefix = "comment"
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def parent(self):
|
def parent(self):
|
||||||
@@ -268,7 +310,7 @@ class Comment(models.Model):
|
|||||||
return Page.objects.select_subclasses().filter(id=self.page_id).first()
|
return Page.objects.select_subclasses().filter(id=self.page_id).first()
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return self.parent.get_absolute_url()
|
return self.parent.get_absolute_url() + f"#comment-{self.pk}"
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("Comment")
|
verbose_name = _("Comment")
|
||||||
@@ -281,7 +323,7 @@ class NavItem(models.Model):
|
|||||||
station = models.ForeignKey(Station, models.CASCADE, verbose_name=_("station"))
|
station = models.ForeignKey(Station, models.CASCADE, verbose_name=_("station"))
|
||||||
menu = models.SlugField(_("menu"), max_length=24)
|
menu = models.SlugField(_("menu"), max_length=24)
|
||||||
order = models.PositiveSmallIntegerField(_("order"))
|
order = models.PositiveSmallIntegerField(_("order"))
|
||||||
text = models.CharField(_("title"), max_length=64)
|
text = models.CharField(_("title"), max_length=64, blank=True, null=True)
|
||||||
url = models.CharField(_("url"), max_length=256, blank=True, null=True)
|
url = models.CharField(_("url"), max_length=256, blank=True, null=True)
|
||||||
page = models.ForeignKey(
|
page = models.ForeignKey(
|
||||||
StaticPage,
|
StaticPage,
|
||||||
@@ -300,14 +342,21 @@ class NavItem(models.Model):
|
|||||||
def get_url(self):
|
def get_url(self):
|
||||||
return self.url if self.url else self.page.get_absolute_url() if self.page else None
|
return self.url if self.url else self.page.get_absolute_url() if self.page else None
|
||||||
|
|
||||||
|
def get_label(self):
|
||||||
|
if self.text:
|
||||||
|
return self.text
|
||||||
|
elif self.page:
|
||||||
|
return self.page.title
|
||||||
|
|
||||||
def render(self, request, css_class="", active_class=""):
|
def render(self, request, css_class="", active_class=""):
|
||||||
url = self.get_url()
|
url = self.get_url()
|
||||||
|
label = self.get_label()
|
||||||
if active_class and request.path.startswith(url):
|
if active_class and request.path.startswith(url):
|
||||||
css_class += " " + active_class
|
css_class += " " + active_class
|
||||||
|
|
||||||
if not url:
|
if not url:
|
||||||
return self.text
|
return label
|
||||||
elif not css_class:
|
elif not css_class:
|
||||||
return format_html('<a href="{}">{}</a>', url, self.text)
|
return format_html('<a href="{}">{}</a>', url, label)
|
||||||
else:
|
else:
|
||||||
return format_html('<a href="{}" class="{}">{}</a>', url, css_class, self.text)
|
return format_html('<a href="{}" class="{}">{}</a>', url, css_class, label)
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from django.conf import settings as conf
|
from django.conf import settings as conf
|
||||||
|
from django.contrib.auth.models import Group, Permission
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import F
|
from django.db.models import F
|
||||||
from django.db.models.functions import Concat, Substr
|
from django.db.models.functions import Concat, Substr
|
||||||
@@ -58,9 +60,11 @@ class Program(Page):
|
|||||||
default=True,
|
default=True,
|
||||||
help_text=_("update later diffusions according to schedule changes"),
|
help_text=_("update later diffusions according to schedule changes"),
|
||||||
)
|
)
|
||||||
|
editors = models.ForeignKey(Group, models.CASCADE, blank=True, null=True, verbose_name=_("editors"))
|
||||||
|
|
||||||
objects = ProgramQuerySet.as_manager()
|
objects = ProgramQuerySet.as_manager()
|
||||||
detail_url_name = "program-detail"
|
detail_url_name = "program-detail"
|
||||||
|
list_url_name = "program-list"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def path(self):
|
def path(self):
|
||||||
@@ -80,6 +84,14 @@ class Program(Page):
|
|||||||
def excerpts_path(self):
|
def excerpts_path(self):
|
||||||
return os.path.join(self.path, settings.SOUND_ARCHIVES_SUBDIR)
|
return os.path.join(self.path, settings.SOUND_ARCHIVES_SUBDIR)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def editors_group_name(self):
|
||||||
|
return f"{self.title} editors"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def change_permission_codename(self):
|
||||||
|
return f"change_program_{self.slug}"
|
||||||
|
|
||||||
def __init__(self, *kargs, **kwargs):
|
def __init__(self, *kargs, **kwargs):
|
||||||
super().__init__(*kargs, **kwargs)
|
super().__init__(*kargs, **kwargs)
|
||||||
if self.slug:
|
if self.slug:
|
||||||
@@ -109,6 +121,19 @@ class Program(Page):
|
|||||||
os.makedirs(path, exist_ok=True)
|
os.makedirs(path, exist_ok=True)
|
||||||
return os.path.exists(path)
|
return os.path.exists(path)
|
||||||
|
|
||||||
|
def set_group_ownership(self):
|
||||||
|
editors, created = Group.objects.get_or_create(name=self.editors_group_name)
|
||||||
|
if created:
|
||||||
|
self.editors = editors
|
||||||
|
super().save()
|
||||||
|
permission, _ = Permission.objects.get_or_create(
|
||||||
|
name=f"change program {self.title}",
|
||||||
|
codename=self.change_permission_codename,
|
||||||
|
content_type=ContentType.objects.get_for_model(self),
|
||||||
|
)
|
||||||
|
if permission not in editors.permissions.all():
|
||||||
|
editors.permissions.add(permission)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("Program")
|
verbose_name = _("Program")
|
||||||
verbose_name_plural = _("Programs")
|
verbose_name_plural = _("Programs")
|
||||||
@@ -134,6 +159,8 @@ class Program(Page):
|
|||||||
shutil.move(abspath, self.abspath)
|
shutil.move(abspath, self.abspath)
|
||||||
Sound.objects.filter(path__startswith=path_).update(file=Concat("file", Substr(F("file"), len(path_))))
|
Sound.objects.filter(path__startswith=path_).update(file=Concat("file", Substr(F("file"), len(path_))))
|
||||||
|
|
||||||
|
self.set_group_ownership()
|
||||||
|
|
||||||
|
|
||||||
class ProgramChildQuerySet(PageQuerySet):
|
class ProgramChildQuerySet(PageQuerySet):
|
||||||
def station(self, station=None, id=None):
|
def station(self, station=None, id=None):
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class Schedule(Rerun):
|
|||||||
second_and_fourth = 0b001010, _("2nd and 4th {day} of the month")
|
second_and_fourth = 0b001010, _("2nd and 4th {day} of the month")
|
||||||
every = 0b011111, _("{day}")
|
every = 0b011111, _("{day}")
|
||||||
one_on_two = 0b100000, _("one {day} on two")
|
one_on_two = 0b100000, _("one {day} on two")
|
||||||
|
# every_weekday = 0b10000000 _("from Monday to Friday")
|
||||||
|
|
||||||
date = models.DateField(
|
date = models.DateField(
|
||||||
_("date"),
|
_("date"),
|
||||||
@@ -71,6 +72,10 @@ class Schedule(Rerun):
|
|||||||
verbose_name = _("Schedule")
|
verbose_name = _("Schedule")
|
||||||
verbose_name_plural = _("Schedules")
|
verbose_name_plural = _("Schedules")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
self._initial = kwargs
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{} - {}, {}".format(
|
return "{} - {}, {}".format(
|
||||||
self.program.title,
|
self.program.title,
|
||||||
@@ -110,16 +115,28 @@ class Schedule(Rerun):
|
|||||||
date = tz.datetime.combine(date, self.time)
|
date = tz.datetime.combine(date, self.time)
|
||||||
return date.replace(tzinfo=self.tz)
|
return date.replace(tzinfo=self.tz)
|
||||||
|
|
||||||
def dates_of_month(self, date):
|
def dates_of_month(self, date, frequency=None, sched_date=None):
|
||||||
"""Return normalized diffusion dates of provided date's month."""
|
"""Return normalized diffusion dates of provided date's month.
|
||||||
if self.frequency == Schedule.Frequency.ponctual:
|
|
||||||
|
:param Date date: date of the month to get dates from;
|
||||||
|
:param Schedule.Frequency frequency: frequency (defaults to ``self.frequency``)
|
||||||
|
:param Date sched_date: schedule start date (defaults to ``self.date``)
|
||||||
|
:return list of diffusion dates
|
||||||
|
"""
|
||||||
|
if frequency is None:
|
||||||
|
frequency = self.frequency
|
||||||
|
|
||||||
|
if sched_date is None:
|
||||||
|
sched_date = self.date
|
||||||
|
|
||||||
|
if frequency == Schedule.Frequency.ponctual:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
sched_wday, freq = self.date.weekday(), self.frequency
|
sched_wday = sched_date.weekday()
|
||||||
date = date.replace(day=1)
|
date = date.replace(day=1)
|
||||||
|
|
||||||
# last of the month
|
# last of the month
|
||||||
if freq == Schedule.Frequency.last:
|
if frequency == Schedule.Frequency.last:
|
||||||
date = date.replace(day=calendar.monthrange(date.year, date.month)[1])
|
date = date.replace(day=calendar.monthrange(date.year, date.month)[1])
|
||||||
date_wday = date.weekday()
|
date_wday = date.weekday()
|
||||||
|
|
||||||
@@ -134,33 +151,42 @@ class Schedule(Rerun):
|
|||||||
date_wday, month = date.weekday(), date.month
|
date_wday, month = date.weekday(), date.month
|
||||||
date += tz.timedelta(days=(7 if date_wday > sched_wday else 0) - date_wday + sched_wday)
|
date += tz.timedelta(days=(7 if date_wday > sched_wday else 0) - date_wday + sched_wday)
|
||||||
|
|
||||||
if freq == Schedule.Frequency.one_on_two:
|
if frequency == Schedule.Frequency.one_on_two:
|
||||||
# - adjust date with modulo 14 (= 2 weeks in days)
|
# - adjust date with modulo 14 (= 2 weeks in days)
|
||||||
# - there are max 3 "weeks on two" per month
|
# - there are max 3 "weeks on two" per month
|
||||||
if (date - self.date).days % 14:
|
if (date - sched_date).days % 14:
|
||||||
date += tz.timedelta(days=7)
|
date += tz.timedelta(days=7)
|
||||||
dates = (date + tz.timedelta(days=14 * i) for i in range(0, 3))
|
dates = (date + tz.timedelta(days=14 * i) for i in range(0, 3))
|
||||||
else:
|
else:
|
||||||
dates = (date + tz.timedelta(days=7 * week) for week in range(0, 5) if freq & (0b1 << week))
|
dates = (date + tz.timedelta(days=7 * week) for week in range(0, 5) if frequency & (0b1 << week))
|
||||||
|
|
||||||
return [self.normalize(date) for date in dates if date.month == month]
|
return [self.normalize(date) for date in dates if date.month == month]
|
||||||
|
|
||||||
def diffusions_of_month(self, date):
|
def diffusions_of_month(self, date, frequency=None, sched_date=None):
|
||||||
"""Get episodes and diffusions for month of provided date, including
|
"""Get episodes and diffusions for month of provided date, including
|
||||||
reruns.
|
reruns.
|
||||||
|
|
||||||
|
:param Date date: date of the month to get diffusions from;
|
||||||
|
:param Schedule.Frequency frequency: frequency (defaults to ``self.frequency``)
|
||||||
|
:param Date sched_date: schedule start date (defaults to ``self.date``)
|
||||||
:returns: tuple([Episode], [Diffusion])
|
:returns: tuple([Episode], [Diffusion])
|
||||||
"""
|
"""
|
||||||
from .diffusion import Diffusion
|
from .diffusion import Diffusion
|
||||||
from .episode import Episode
|
from .episode import Episode
|
||||||
|
|
||||||
if self.initial is not None or self.frequency == Schedule.Frequency.ponctual:
|
if frequency is None:
|
||||||
|
frequency = self.frequency
|
||||||
|
|
||||||
|
if sched_date is None:
|
||||||
|
sched_date = self.date
|
||||||
|
|
||||||
|
if self.initial is not None or frequency == Schedule.Frequency.ponctual:
|
||||||
return [], []
|
return [], []
|
||||||
|
|
||||||
# dates for self and reruns as (date, initial)
|
# dates for self and reruns as (date, initial)
|
||||||
reruns = [(rerun, rerun.date - self.date) for rerun in self.rerun_set.all()]
|
reruns = [(rerun, rerun.date - sched_date) for rerun in self.rerun_set.all()]
|
||||||
|
|
||||||
dates = {date: None for date in self.dates_of_month(date)}
|
dates = {date: None for date in self.dates_of_month(date, frequency, sched_date)}
|
||||||
dates.update(
|
dates.update(
|
||||||
(rerun.normalize(date.date() + delta), date) for date in list(dates.keys()) for rerun, delta in reruns
|
(rerun.normalize(date.date() + delta), date) for date in list(dates.keys()) for rerun, delta in reruns
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ def user_default_groups(sender, instance, created, *args, **kwargs):
|
|||||||
|
|
||||||
@receiver(signals.post_save, sender=Page)
|
@receiver(signals.post_save, sender=Page)
|
||||||
def page_post_save(sender, instance, created, *args, **kwargs):
|
def page_post_save(sender, instance, created, *args, **kwargs):
|
||||||
if not created and instance.cover:
|
if not created and instance.cover and "raw" not in kwargs:
|
||||||
Page.objects.filter(parent=instance, cover__isnull=True).update(cover=instance.cover)
|
Page.objects.filter(parent=instance, cover__isnull=True).update(cover=instance.cover)
|
||||||
|
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ def program_post_save(sender, instance, created, *args, **kwargs):
|
|||||||
|
|
||||||
@receiver(signals.pre_save, sender=Schedule)
|
@receiver(signals.pre_save, sender=Schedule)
|
||||||
def schedule_pre_save(sender, instance, *args, **kwargs):
|
def schedule_pre_save(sender, instance, *args, **kwargs):
|
||||||
if getattr(instance, "pk") is not None:
|
if getattr(instance, "pk") is not None and "raw" not in kwargs:
|
||||||
instance._initial = Schedule.objects.get(pk=instance.pk)
|
instance._initial = Schedule.objects.get(pk=instance.pk)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class Station(models.Model):
|
|||||||
max_length=2048,
|
max_length=2048,
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text=_("Audio streams urls used by station's player. One url " "a line."),
|
help_text=_("Audio streams urls used by station's player. One url a line."),
|
||||||
)
|
)
|
||||||
default_cover = FilerImageField(
|
default_cover = FilerImageField(
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
@@ -76,6 +76,11 @@ class Station(models.Model):
|
|||||||
blank=True,
|
blank=True,
|
||||||
related_name="+",
|
related_name="+",
|
||||||
)
|
)
|
||||||
|
music_stream_title = models.CharField(
|
||||||
|
_("Music stream's title"),
|
||||||
|
max_length=64,
|
||||||
|
default=_("Music stream"),
|
||||||
|
)
|
||||||
|
|
||||||
objects = StationQuerySet.as_manager()
|
objects = StationQuerySet.as_manager()
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
||||||
<title>Vue App</title>
|
|
||||||
<script defer src="js/chunk-vendors.js"></script><script defer src="js/chunk-common.js"></script><script defer src="js/core.js"></script><link href="css/chunk-vendors.css" rel="stylesheet"><link href="css/chunk-common.css" rel="stylesheet"></head>
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
7766
aircox/static/aircox/css/public.css
Normal file
7766
aircox/static/aircox/css/public.css
Normal file
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@
|
|||||||
\**********************/
|
\**********************/
|
||||||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _assets_styles_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assets/styles.scss */ \"./src/assets/styles.scss\");\n/* harmony import */ var _assets_admin_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assets/admin.scss */ \"./src/assets/admin.scss\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.js */ \"./src/index.js\");\n/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./app */ \"./src/app.js\");\n/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components */ \"./src/components/index.js\");\n/* harmony import */ var _track__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./track */ \"./src/track.js\");\n\n\n\n\n\n\nconst AdminApp = {\n ..._app__WEBPACK_IMPORTED_MODULE_3__[\"default\"],\n components: {\n ..._app__WEBPACK_IMPORTED_MODULE_3__[\"default\"].components,\n ..._components__WEBPACK_IMPORTED_MODULE_4__.admin\n },\n data() {\n return {\n ...super.data,\n Track: _track__WEBPACK_IMPORTED_MODULE_5__[\"default\"]\n };\n }\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (AdminApp);\nwindow.App = AdminApp;\n\n//# sourceURL=webpack://aircox-assets/./src/admin.js?");
|
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _assets_admin_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assets/admin.scss */ \"./src/assets/admin.scss\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.js */ \"./src/index.js\");\n/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./app */ \"./src/app.js\");\n/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components */ \"./src/components/index.js\");\n/* harmony import */ var _track__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./track */ \"./src/track.js\");\n\n\n\n\n\nconst AdminApp = {\n ..._app__WEBPACK_IMPORTED_MODULE_2__[\"default\"],\n components: {\n ..._app__WEBPACK_IMPORTED_MODULE_2__[\"default\"].components,\n ..._components__WEBPACK_IMPORTED_MODULE_3__.admin\n },\n data() {\n return {\n ...super.data,\n Track: _track__WEBPACK_IMPORTED_MODULE_4__[\"default\"]\n };\n }\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (AdminApp);\nwindow.App = AdminApp;\n\n//# sourceURL=webpack://aircox-assets/./src/admin.js?");
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
29
aircox/static/aircox/js/ckeditor-init.js
Normal file
29
aircox/static/aircox/js/ckeditor-init.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/* global CKEDITOR, django */
|
||||||
|
/* Modified in order to be manually loaded after vue.js */
|
||||||
|
|
||||||
|
function initialiseCKEditor() {
|
||||||
|
var textareas = Array.prototype.slice.call(
|
||||||
|
document.querySelectorAll("textarea[data-type=ckeditortype]"),
|
||||||
|
)
|
||||||
|
for (var i = 0; i < textareas.length; ++i) {
|
||||||
|
var t = textareas[i]
|
||||||
|
if (
|
||||||
|
t.getAttribute("data-processed") == "0" &&
|
||||||
|
t.id.indexOf("__prefix__") == -1
|
||||||
|
) {
|
||||||
|
t.setAttribute("data-processed", "1")
|
||||||
|
var ext = JSON.parse(t.getAttribute("data-external-plugin-resources"))
|
||||||
|
for (var j = 0; j < ext.length; ++j) {
|
||||||
|
CKEDITOR.plugins.addExternal(ext[j][0], ext[j][1], ext[j][2])
|
||||||
|
}
|
||||||
|
CKEDITOR.replace(t.id, JSON.parse(t.getAttribute("data-config")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initialiseCKEditorInInlinedForms() {
|
||||||
|
if (typeof django === "object" && django.jQuery) {
|
||||||
|
django.jQuery(document).on("formset:added", initialiseCKEditor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//})()
|
||||||
@@ -10,13 +10,23 @@
|
|||||||
/******/ "use strict";
|
/******/ "use strict";
|
||||||
/******/ var __webpack_modules__ = ({
|
/******/ var __webpack_modules__ = ({
|
||||||
|
|
||||||
/***/ "./src/core.js":
|
/***/ "./src/public.js":
|
||||||
/*!*********************!*\
|
/*!***********************!*\
|
||||||
!*** ./src/core.js ***!
|
!*** ./src/public.js ***!
|
||||||
\*********************/
|
\***********************/
|
||||||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./src/index.js\");\n/* harmony import */ var _app_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./app.js */ \"./src/app.js\");\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_app_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\nwindow.App = _app_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"];\n\n//# sourceURL=webpack://aircox-assets/./src/core.js?");
|
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _assets_public_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assets/public.scss */ \"./src/assets/public.scss\");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.js */ \"./src/index.js\");\n/* harmony import */ var _app_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./app.js */ \"./src/app.js\");\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_app_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\nwindow.App = _app_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"];\n\n//# sourceURL=webpack://aircox-assets/./src/public.js?");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./src/assets/public.scss":
|
||||||
|
/*!********************************!*\
|
||||||
|
!*** ./src/assets/public.scss ***!
|
||||||
|
\********************************/
|
||||||
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack://aircox-assets/./src/assets/public.scss?");
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
@@ -156,7 +166,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ind
|
|||||||
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
||||||
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
||||||
/******/ var installedChunks = {
|
/******/ var installedChunks = {
|
||||||
/******/ "core": 0
|
/******/ "public": 0
|
||||||
/******/ };
|
/******/ };
|
||||||
/******/
|
/******/
|
||||||
/******/ // no chunk on demand loading
|
/******/ // no chunk on demand loading
|
||||||
@@ -208,7 +218,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ind
|
|||||||
/******/ // startup
|
/******/ // startup
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
|
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
|
||||||
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["chunk-vendors","chunk-common"], function() { return __webpack_require__("./src/core.js"); })
|
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["chunk-vendors","chunk-common"], function() { return __webpack_require__("./src/public.js"); })
|
||||||
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
|
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
|
||||||
/******/
|
/******/
|
||||||
/******/ })()
|
/******/ })()
|
||||||
16095
aircox/static/aircox/vue.esm-browser.js
Normal file
16095
aircox/static/aircox/vue.esm-browser.js
Normal file
File diff suppressed because it is too large
Load Diff
1
aircox/static/aircox/vue.esm-browser.prod.js
Normal file
1
aircox/static/aircox/vue.esm-browser.prod.js
Normal file
File diff suppressed because one or more lines are too long
34
aircox/templates/accounts/profile.html
Normal file
34
aircox/templates/accounts/profile.html
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{% extends "aircox/base.html" %}
|
||||||
|
{% load i18n aircox %}
|
||||||
|
|
||||||
|
{% block head_title %}
|
||||||
|
{% block title %}{{ user.username }}{% endblock %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content-container %}
|
||||||
|
<div class="container content page-content">
|
||||||
|
<h2 class="subtitle">Mon Profil</h2>
|
||||||
|
{% translate "Username" %} : {{ user.username|title }}<br/>
|
||||||
|
<!-- Connexion: {{ user.last_login }} -->
|
||||||
|
|
||||||
|
<h2 class="subtitle is-1">Mes émissions</h2>
|
||||||
|
{% if programs|length %}
|
||||||
|
<ul>
|
||||||
|
{% for p in programs %}
|
||||||
|
<li>{{ p.title }} :
|
||||||
|
|
||||||
|
<a href="{% url 'program-detail' slug=p.slug %}">
|
||||||
|
<span title="{% translate 'View' %} {{ page }}">{% translate 'View' %}</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="{% url 'program-edit' pk=p.pk %}">
|
||||||
|
<span title="{% translate 'Edit' %} {{ page }}">{% translate 'Edit' %} </span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
{% trans 'You are not listed as a program editor yet' %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<li>
|
<li>
|
||||||
{% if choice.type %}
|
{% if choice.type %}
|
||||||
<form method="GET" action="?{{ choice.query_string }}"
|
<form method="GET" action="?{{ choice.query_string }}"
|
||||||
onsubmit="return this.{{ choice.name }}.value ? true : false"">
|
onsubmit="return this.{{ choice.name }}.value ? true : false">
|
||||||
<label for="filter-{{ choice.name }}">{{ choice.label }}: </label>
|
<label for="filter-{{ choice.name }}">{{ choice.label }}: </label>
|
||||||
<input id="filter-{{ choice.name }}" type="{{ choice.type }}" name="{{ choice.name }}"
|
<input id="filter-{{ choice.name }}" type="{{ choice.type }}" name="{{ choice.name }}"
|
||||||
value="{{ choice.value }}" {{ choice.extra }}/>
|
value="{{ choice.value }}" {{ choice.extra }}/>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<template #title>
|
<template #title>
|
||||||
<h5 class="title is-4">{% trans "Playlist" %}</h5>
|
<h5 class="title is-4">{% trans "Playlist" %}</h5>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:top="{items}">
|
<template #top="{items}">
|
||||||
<input type="hidden" name="{{ formset.prefix }}-TOTAL_FORMS"
|
<input type="hidden" name="{{ formset.prefix }}-TOTAL_FORMS"
|
||||||
:value="items.length || 0"/>
|
:value="items.length || 0"/>
|
||||||
<input type="hidden" name="{{ formset.prefix }}-INITIAL_FORMS"
|
<input type="hidden" name="{{ formset.prefix }}-INITIAL_FORMS"
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>{% block title %}{% endblock %}</title>
|
<title>{% block title %}{% endblock %}</title>
|
||||||
|
|
||||||
<!-- <link rel="stylesheet" type="text/css" href="{% static "aircox/vendor.css" %}"> -->
|
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "admin/css/base.css" %}">
|
<link rel="stylesheet" type="text/css" href="{% static "admin/css/base.css" %}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "aircox/css/chunk-common.css" %}"/>
|
<link rel="stylesheet" type="text/css" href="{% static "aircox/css/chunk-common.css" %}"/>
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "aircox/css/chunk-vendors.css" %}"/>
|
<link rel="stylesheet" type="text/css" href="{% static "aircox/css/chunk-vendors.css" %}"/>
|
||||||
@@ -33,23 +32,26 @@
|
|||||||
function vuePre(selector) {
|
function vuePre(selector) {
|
||||||
const elms = document.querySelectorAll(selector)
|
const elms = document.querySelectorAll(selector)
|
||||||
for(const elm of elms) {
|
for(const elm of elms) {
|
||||||
elm.setAttribute('v-pre', true)
|
// elm.setAttribute('v-pre', "")
|
||||||
|
elm.parentNode.setAttribute('v-pre', '')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('load', function() {
|
window.addEventListener('load', function() {
|
||||||
{% block init-scripts %}
|
{% block init-scripts %}
|
||||||
|
vuePre(".django-ckeditor-widget")
|
||||||
|
vuePre("fieldset")
|
||||||
|
window.source_ = document.body.innerHTML
|
||||||
aircox.init(null, {
|
aircox.init(null, {
|
||||||
hotReload: false,
|
|
||||||
{% if not init_app %}
|
{% if not init_app %}
|
||||||
initBuilder: false,
|
initApp: false,
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if init_el %}
|
{% if init_el %}
|
||||||
el: "{{ init_el }}",
|
el: "{{ init_el }}",
|
||||||
{% endif %}
|
{% endif %}
|
||||||
})
|
})
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
})
|
}, true)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- Container -->
|
<!-- Container -->
|
||||||
@@ -71,7 +73,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<div class="navbar-dropdown is-boxed">
|
<div class="navbar-dropdown is-boxed">
|
||||||
{% for diffusion in diffusions %}
|
{% for diffusion in diffusions %}
|
||||||
<a class="navbar-item {% if diffusion.is_now %}has-background-primary{% endif %}" href="{% url "admin:aircox_episode_change" diffusion.episode.pk %}">
|
<a class="navbar-item {% if diffusion.is_now %}active{% endif %}" href="{% url "admin:aircox_episode_change" diffusion.episode.pk %}">
|
||||||
{{ diffusion.start|time }} |
|
{{ diffusion.start|time }} |
|
||||||
{{ diffusion.episode.title }}
|
{{ diffusion.episode.title }}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{% extends "admin/index.html" %}
|
{% extends "admin/index.html" %}
|
||||||
{% load i18n thumbnail %}
|
{% load i18n thumbnail aircox %}
|
||||||
|
|
||||||
|
|
||||||
{% block app %}
|
{% block app %}
|
||||||
@@ -12,43 +12,11 @@
|
|||||||
<span>{% translate "Today" %}</span>
|
<span>{% translate "Today" %}</span>
|
||||||
</h1>
|
</h1>
|
||||||
{% if diffusions %}
|
{% if diffusions %}
|
||||||
<table class="table is-fullwidth is-striped">
|
<div class="grid-3">
|
||||||
<tbody>
|
{% for obj in diffusions %}
|
||||||
{% for diffusion in diffusions %}
|
{% page_widget "card" obj.episode diffusion=obj timetable=True admin=True tag_class="" %}
|
||||||
{% with episode=diffusion.episode %}
|
{% endfor %}
|
||||||
<tr {% if diffusion.is_now %}class="is-selected"{% endif %}>
|
</div>
|
||||||
<td>{{ diffusion.start|time }} - {{ diffusion.end|time }}</td>
|
|
||||||
<td><img src="{% thumbnail episode.cover 64x64 crop %}"/></td>
|
|
||||||
<td>
|
|
||||||
<a href="{% url "admin:aircox_episode_change" episode.pk %}">{{ episode.title }}</a>
|
|
||||||
|
|
||||||
{% if diffusion.type == diffusion.TYPE_ON_AIR %}
|
|
||||||
<span class="tag is-info">
|
|
||||||
<span class="icon is-small">
|
|
||||||
{% if diffusion.is_live %}
|
|
||||||
<i class="fa fa-microphone"
|
|
||||||
title="{% translate "Live diffusion" %}"></i>
|
|
||||||
{% else %}
|
|
||||||
<i class="fa fa-music"
|
|
||||||
title="{% translate "Differed diffusion" %}"></i>
|
|
||||||
{% endif %}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
{{ diffusion.get_type_display }}
|
|
||||||
</span>
|
|
||||||
{% elif diffusion.type == diffusion.TYPE_CANCEL %}
|
|
||||||
<span class="tag is-danger">
|
|
||||||
{{ diffusion.get_type_display }}</span>
|
|
||||||
{% elif diffusion.type == diffusion.TYPE_UNCONFIRMED %}
|
|
||||||
<span class="tag is-warning">
|
|
||||||
{{ diffusion.get_type_display }}</span>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endwith %}
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="block has-text-centered">
|
<div class="block has-text-centered">
|
||||||
{% trans "No diffusion is scheduled for today." %}
|
{% trans "No diffusion is scheduled for today." %}
|
||||||
@@ -62,10 +30,12 @@
|
|||||||
<span>{% translate "Latest comments" %}</span>
|
<span>{% translate "Latest comments" %}</span>
|
||||||
</h1>
|
</h1>
|
||||||
{% if comments %}
|
{% if comments %}
|
||||||
{% include "aircox/widgets/page_list.html" with object_list=comments with_title=True %}
|
{% for object in comments|slice:":5" %}
|
||||||
<div class="has-text-centered">
|
{% page_widget "item" object with_title=True %}
|
||||||
<a href="{% url "admin:aircox_comment_changelist" %}" class="float-center">{% translate "All comments" %}</a>
|
{% endfor %}
|
||||||
</div>
|
<div class="has-text-centered">
|
||||||
|
<a href="{% url "admin:aircox_comment_changelist" %}" class="float-center">{% translate "All comments" %}</a>
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="block has-text-centered">{% trans "No comment posted yet" %}</p>
|
<p class="block has-text-centered">{% trans "No comment posted yet" %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -1,30 +1,2 @@
|
|||||||
{% extends "aircox/page_detail.html" %}
|
{% extends "aircox/page_detail.html" %}
|
||||||
{% comment %}Detail page for regular articles{% endcomment %}
|
{% comment %}Detail page for regular articles{% endcomment %}
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block sidebar %}
|
|
||||||
{{ block.super }}
|
|
||||||
|
|
||||||
{% if sidebar_object_list %}
|
|
||||||
<section>
|
|
||||||
{% comment %}Translators: in page detail sidebar{% endcomment %}
|
|
||||||
<h4 class="title is-4">{% translate "Latest news" %}</h4>
|
|
||||||
|
|
||||||
{% for object in sidebar_object_list %}
|
|
||||||
{% include "aircox/widgets/page_item.html" %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<nav class="pagination is-centered">
|
|
||||||
<ul class="pagination-list">
|
|
||||||
<li>
|
|
||||||
<a href="{% url "article-list" %}" class="pagination-link"
|
|
||||||
aria-label="{% translate "Show all news" %}">
|
|
||||||
{% translate "More news" %}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
{% load static i18n thumbnail aircox %}<!doctype html>
|
||||||
{% comment %}
|
{% comment %}
|
||||||
Base website template. It displays various elements depending on context
|
Base website template. It displays various elements depending on context
|
||||||
variables.
|
variables.
|
||||||
@@ -10,8 +11,6 @@ Usefull context:
|
|||||||
- sidebar_url_name: url name sidebar item complete list
|
- sidebar_url_name: url name sidebar item complete list
|
||||||
- sidebar_url_parent: parent page for sidebar items complete list
|
- sidebar_url_parent: parent page for sidebar items complete list
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
{% load static i18n thumbnail aircox %}
|
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
@@ -24,9 +23,10 @@ Usefull context:
|
|||||||
{% block assets %}
|
{% block assets %}
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "aircox/css/chunk-common.css" %}"/>
|
<link rel="stylesheet" type="text/css" href="{% static "aircox/css/chunk-common.css" %}"/>
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "aircox/css/chunk-vendors.css" %}"/>
|
<link rel="stylesheet" type="text/css" href="{% static "aircox/css/chunk-vendors.css" %}"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="{% static "aircox/css/public.css" %}"/>
|
||||||
<script src="{% static "aircox/js/chunk-common.js" %}"></script>
|
<script src="{% static "aircox/js/chunk-common.js" %}"></script>
|
||||||
<script src="{% static "aircox/js/chunk-vendors.js" %}"></script>
|
<script src="{% static "aircox/js/chunk-vendors.js" %}"></script>
|
||||||
<script src="{% static "aircox/js/core.js" %}"></script>
|
<script src="{% static "aircox/js/public.js" %}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<title>
|
<title>
|
||||||
@@ -48,120 +48,104 @@ Usefull context:
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
{% block top-nav-container %}
|
<div class="navs">
|
||||||
<nav class="navbar has-shadow" role="navigation" aria-label="main navigation">
|
{% block nav %}
|
||||||
<div class="container">
|
<nav class="nav primary" role="navigation" aria-label="main navigation">
|
||||||
<div class="navbar-brand">
|
{% block nav-primary %}
|
||||||
<a href="/" title="{% translate "Home" %}" class="navbar-item">
|
<a class="nav-brand" href="{% url "home" %}">
|
||||||
<img src="{{ station.logo.url }}" class="logo"/>
|
<img src="{{ station.logo.url }}">
|
||||||
|
</a>
|
||||||
|
<a-switch class="button burger"
|
||||||
|
el=".nav.primary .nav-menu" group="nav"
|
||||||
|
aria-label="{% translate "Main menu" %}">
|
||||||
|
</a-switch>
|
||||||
|
<div class="nav-menu">
|
||||||
|
{% block nav-primary-menu %}
|
||||||
|
{% nav_items "top" css_class="nav-item" active_class="active" as items %}
|
||||||
|
{% for item, render in items %}
|
||||||
|
{{ render }}
|
||||||
|
{% endfor %}
|
||||||
|
{% if user.is_staff %}
|
||||||
|
<a class="nav-item" href="{% url "admin:index" %}" target="new">
|
||||||
|
{% translate "Admin" %}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<a class="nav-item" href="{% url "profile" %}" target="new">
|
||||||
|
{% translate "Profile" %}
|
||||||
|
</a>
|
||||||
|
<a class="nav-item" href="{% url 'logout' %}">
|
||||||
|
<i title="{% translate 'disconnect' %}" class="fa fa-power-off"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
<div class="navbar-menu">
|
|
||||||
<div class="navbar-start">
|
|
||||||
{% block top-nav %}
|
|
||||||
{% nav_items "top" css_class="navbar-item" active_class="is-active" as items %}
|
|
||||||
{% for item, render in items %}
|
|
||||||
{{ render }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
|
||||||
</div>
|
|
||||||
<div class="navbar-end">
|
|
||||||
{% block top-nav-tools %}
|
|
||||||
{% endblock %}
|
|
||||||
{% block top-nav-end %}
|
|
||||||
<div class="navbar-item">
|
|
||||||
<form action="{% url 'page-list' %}" method="GET">
|
|
||||||
<div class="control has-icons-left">
|
|
||||||
<span class="icon is-small is-left">
|
|
||||||
<i class="fa fa-search"></i>
|
|
||||||
</span>
|
|
||||||
<input type="text" name="q" class="input"
|
|
||||||
placeholder="{% translate "Search" %}" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="columns is-desktop">
|
|
||||||
<main class="column page">
|
|
||||||
<header class="header">
|
|
||||||
{% block header %}
|
|
||||||
<h1 class="title is-1">
|
|
||||||
{% block title %}
|
|
||||||
{% if page and page.title %}
|
|
||||||
{{ page.title }}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<h3 class="subtitle is-3">
|
|
||||||
{% block subtitle %}{% endblock %}
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<div class="columns is-size-4">
|
|
||||||
{% block header_nav %}
|
|
||||||
<span class="column">
|
|
||||||
{% block header_crumbs %}
|
|
||||||
{% if parent %}
|
|
||||||
<a href="{{ parent.get_absolute_url }}">
|
|
||||||
{{ parent.title }}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
</span>
|
|
||||||
{% endblock %}
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{% block main %}
|
|
||||||
{% block content %}
|
|
||||||
{% if page and page.content %}
|
|
||||||
<section class="page-content mb-2">{{ page.content|safe }}</section>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
{% endblock main %}
|
|
||||||
</main>
|
|
||||||
|
|
||||||
{% if has_sidebar %}
|
|
||||||
{% comment %}Translators: main sidebar {% endcomment %}
|
|
||||||
<aside class="column is-one-third-desktop">
|
|
||||||
{# FIXME: block cover into sidebar one #}
|
|
||||||
{% block cover %}
|
|
||||||
{% if page and page.cover %}
|
|
||||||
<img class="cover mb-4" src="{{ page.cover.url }}" class="cover"/>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
</nav>
|
||||||
|
|
||||||
{% with is_thin=True %}
|
{% block secondary-nav %}{% endblock %}
|
||||||
{% block sidebar %}
|
{% endblock %}
|
||||||
{% if sidebar_object_list %}
|
|
||||||
{% with object_list=sidebar_object_list %}
|
|
||||||
{% with list_url=sidebar_list_url %}
|
|
||||||
{% with has_headline=False %}
|
|
||||||
<section>
|
|
||||||
<h4 class="title is-4">
|
|
||||||
{% block sidebar_title %}{% translate "Recently" %}{% endblock %}
|
|
||||||
</h4>
|
|
||||||
{% include "aircox/widgets/page_list.html" %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endif %}
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
||||||
{% endwith %}
|
|
||||||
</aside>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
{% block main-container %}
|
||||||
|
<main class="page">
|
||||||
|
{% block main %}
|
||||||
|
{% spaceless %}
|
||||||
|
{% block breadcrumbs-container %}
|
||||||
|
<div class="breadcrumbs container">
|
||||||
|
{% block breadcrumbs %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% endspaceless %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% block header-container %}
|
||||||
|
{% if page or cover or title %}
|
||||||
|
<header class="container header preview preview-header {% if cover %}has-cover{% endif %}">
|
||||||
|
{% block header %}
|
||||||
|
{% if cover %}
|
||||||
|
<figure class="header-cover">
|
||||||
|
<img src="{{ cover }}" class="cover">
|
||||||
|
</figure>
|
||||||
|
{% endif %}
|
||||||
|
<div class="headings preview-card-headings">
|
||||||
|
{% block headings %}
|
||||||
|
<div>
|
||||||
|
<h1 class="title is-1 {% block title-class %}{% endblock %}">{% block title %}{{ title|default:"" }}{% endblock %}</h1>
|
||||||
|
{% include "aircox/edit-link.html" %}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{% spaceless %}
|
||||||
|
<span class="subtitle is-2">
|
||||||
|
{% block subtitle %}
|
||||||
|
{% if subtitle %}
|
||||||
|
{{ subtitle }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
</span>
|
||||||
|
{% endspaceless %}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
</header>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content-container %}
|
||||||
|
{% if page and page.content %}
|
||||||
|
<section class="container content page-content">
|
||||||
|
{% block content %}
|
||||||
|
{{ page.content|safe }}
|
||||||
|
{% endblock %}
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
{% endblock %}
|
||||||
|
</main>
|
||||||
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% block player-container %}
|
{% block player-container %}
|
||||||
<div id="player">{% include "aircox/widgets/player.html" %}</div>
|
<div id="player">{% include "aircox/widgets/player.html" %}</div>
|
||||||
|
|||||||
@@ -6,3 +6,5 @@
|
|||||||
—
|
—
|
||||||
{{ station.name }}
|
{{ station.name }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block header %}{% if page %}{{ block.super }}{% endif %}{% endblock %}
|
||||||
|
|||||||
@@ -1,86 +1,72 @@
|
|||||||
{% extends "aircox/base.html" %}
|
{% extends "./base.html" %}
|
||||||
|
|
||||||
{% comment %}Display a list of BasePages{% endcomment %}
|
{% comment %}Display a list of BasePages{% endcomment %}
|
||||||
{% load i18n aircox %}
|
{% load i18n aircox %}
|
||||||
|
|
||||||
{% block head_title %}
|
{% block head_title %}
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% if not page or not page.title %}
|
{{ block.super }}
|
||||||
{% if not parent %}{{ view.model|verbose_name:True|title }}
|
|
||||||
{% else %}
|
|
||||||
{% with parent.title as title %}
|
|
||||||
{% with model|default:"Publications"|verbose_name:True|capfirst as model %}
|
|
||||||
{% comment %}Translators: title when pages are filtered for a specific parent page, e.g.: Articles of My Incredible Show{% endcomment %}
|
|
||||||
{% blocktranslate %}{{ model }} of {{ title }}{% endblocktranslate %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endif %}
|
|
||||||
{% else %}{{ block.super }}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
—
|
—
|
||||||
{{ station.name }}
|
{{ station.name }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block main %}{{ block.super }}
|
{% block main %}
|
||||||
|
{{ block.super }}
|
||||||
|
|
||||||
{% block before_list %}{% endblock %}
|
{% block list-container %}
|
||||||
|
<section class="container clear-both list list-grid {{ list_class|default:"" }}" role="list">
|
||||||
<section role="list">
|
{% block list %}
|
||||||
{% block pages_list %}
|
|
||||||
{% with has_headline=True %}
|
{% with has_headline=True %}
|
||||||
{% for object in object_list %}
|
{% for object in object_list %}
|
||||||
{% block list_object %}
|
{% block list_object %}
|
||||||
{% include object.item_template_name|default:item_template_name %}
|
{% page_widget item_widget|default:"item" object %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% empty %}
|
{% empty %}
|
||||||
{% blocktranslate %}There is nothing published here...{% endblocktranslate %}
|
{% blocktranslate %}There is nothing published here...{% endblocktranslate %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
{% block list-pagination %}
|
||||||
{% if is_paginated %}
|
{% if is_paginated %}
|
||||||
<hr/>
|
<hr/>
|
||||||
{% update_query request.GET.copy page=None as GET %}
|
{% update_query request.GET.copy page=None as GET %}
|
||||||
{% with GET.urlencode as GET %}
|
{% with GET.urlencode as GET %}
|
||||||
<nav class="pagination is-centered" role="pagination" aria-label="{% translate "pagination" %}">
|
<nav class="nav-urls is-centered" role="pagination" aria-label="{% translate "pagination" %}">
|
||||||
{% block pagination %}
|
<ul class="urls">
|
||||||
{% if page_obj.has_previous %}
|
{% if page_obj.has_previous %}
|
||||||
<a href="?{{ GET }}&page={{ page_obj.previous_page_number }}" class="pagination-previous">
|
|
||||||
{% else %}
|
|
||||||
<a class="pagination-previous" disabled>
|
|
||||||
{% endif %}
|
|
||||||
{% comment %}Translators: Bottom of the list, "previous page"{% endcomment %}
|
{% comment %}Translators: Bottom of the list, "previous page"{% endcomment %}
|
||||||
{% translate "Previous" %}</a>
|
<a href="?{{ GET }}&page={{ page_obj.previous_page_number }}" class="left"
|
||||||
|
title="{% translate "Previous" %}"
|
||||||
|
aria-label="{% translate "Previous" %}">
|
||||||
|
<span class="icon"><i class="fa fa-chevron-left"></i></span>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if page_obj.has_next %}
|
<span>
|
||||||
<a href="?{{ GET }}&page={{ page_obj.next_page_number }}" class="pagination-next">
|
{{ page_obj.number }} / {{ page_obj.paginator.num_pages }}
|
||||||
{% else %}
|
</span>
|
||||||
<a class="pagination-next" disabled>
|
|
||||||
{% endif %}
|
{% if page_obj.has_next %}
|
||||||
{% comment %}Translators: Bottom of the list, "Nextpage"{% endcomment %}
|
{% comment %}Translators: Bottom of the list, "Nextpage"{% endcomment %}
|
||||||
{% translate "Next" %}</a>
|
<a href="?{{ GET }}&page={{ page_obj.next_page_number }}" class="right"
|
||||||
|
title="{% translate "Next" %}"
|
||||||
<ul class="pagination-list">
|
aria-label="{% translate "Next" %}">
|
||||||
{% for i in paginator.page_range %}
|
<span class="icon"><i class="fa fa-chevron-right"></i></span>
|
||||||
<li>
|
</a>
|
||||||
{% comment %}
|
{% endif %}
|
||||||
<form action="?{{ GET }}">
|
|
||||||
{% for get in GET %}
|
|
||||||
<input type="hidden" name="{{ get.0 }}" value="{{ get.1 }}" />
|
|
||||||
{% endfor %}
|
|
||||||
<input type="number" name="page" value="{{ page_obj.number }}" />
|
|
||||||
</form>
|
|
||||||
{% endcomment %}
|
|
||||||
<a class="pagination-link {% if page_obj.number == i %}is-current{% endif %}"
|
|
||||||
href="?{{ GET }}&page={{ i }}">{{ i }}</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
|
||||||
</nav>
|
</nav>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
@@ -14,16 +14,18 @@
|
|||||||
|
|
||||||
{% block subtitle %}{{ date|date:"l d F Y" }}{% endblock %}
|
{% block subtitle %}{{ date|date:"l d F Y" }}{% endblock %}
|
||||||
|
|
||||||
{% block before_list %}
|
{% block secondary-nav %}
|
||||||
{% with "diffusion-list" as url_name %}
|
<nav class="nav secondary">
|
||||||
{% include "aircox/widgets/dates_menu.html" %}
|
{% include "./widgets/dates_menu.html" with url_name="diffusion-list" %}
|
||||||
{% endwith %}
|
</nav>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block pages_list %}
|
{% block pages_list %}
|
||||||
{% with hide_schedule=True %}
|
{% with hide_schedule=True %}
|
||||||
<section role="list">
|
<section role="list" class="list">
|
||||||
{% include 'aircox/widgets/diffusion_list.html' %}
|
{% for object in object_list %}
|
||||||
|
{% page_widget "item" object.episode diffusion=object timetable=True %}
|
||||||
|
{% endfor %}
|
||||||
</section>
|
</section>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
20
aircox/templates/aircox/edit-link.html
Normal file
20
aircox/templates/aircox/edit-link.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{% load aircox i18n %}
|
||||||
|
{% block user-actions-container %}
|
||||||
|
{% has_perm page page.program.change_permission_codename simple=True as can_edit %}
|
||||||
|
{% if user.is_authenticated and can_edit %}
|
||||||
|
{% with request.resolver_match.view_name as view_name %}
|
||||||
|
|
||||||
|
{% if view_name in 'program-edit,bla' %}
|
||||||
|
<!--
|
||||||
|
<a href="{% url 'program-detail' page.slug %}" target="_self">
|
||||||
|
<span title="{% translate 'View' %} {{ page }}">{% translate 'View' %} 👁 </span>
|
||||||
|
</a>
|
||||||
|
-->
|
||||||
|
{% else %}
|
||||||
|
<a href="{% url view_name|edit_view page.pk %}" target="_self">
|
||||||
|
<span title="{% translate 'Edit' %} {{ page }}">{% translate 'Edit' %} 🖉 </span>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@@ -2,79 +2,51 @@
|
|||||||
{% comment %}List of a show's episodes for a specific{% endcomment %}
|
{% comment %}List of a show's episodes for a specific{% endcomment %}
|
||||||
{% load i18n aircox %}
|
{% load i18n aircox %}
|
||||||
|
|
||||||
{% include "aircox/program_sidebar.html" %}
|
|
||||||
|
|
||||||
|
{% block content-container %}
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<a-episode :page="{title: "{{ page.title }}", podcasts: {{ object.podcasts|json }}}">
|
<a-episode :page="{title: "{{ page.title }}", podcasts: {{ object.podcasts|json }}}">
|
||||||
<template v-slot="{podcasts,page}">
|
<template v-slot="{podcasts,page}">
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
||||||
{% if object.podcasts %}
|
{% if object.podcasts %}
|
||||||
<section>
|
{% spaceless %}
|
||||||
<a-playlist v-if="page" :set="podcasts"
|
<section class="container no-border">
|
||||||
name="{{ page.title }}"
|
<h3 class="title">{% translate "Podcasts" %}</h3>
|
||||||
list-class="menu-list" item-class="menu-item"
|
<a-playlist v-if="page" :set="podcasts"
|
||||||
:player="player" :actions="['play']"
|
name="{{ page.title }}"
|
||||||
@select="player.playItems('queue', $event.item)">
|
list-class="menu-list" item-class="menu-item"
|
||||||
<template v-slot:header>
|
:player="player" :actions="['play']"
|
||||||
<h4 class="title is-4">{% translate "Podcasts" %}</h4>
|
@select="player.playItems('queue', $event.item)">
|
||||||
</template>
|
</a-playlist>
|
||||||
</a-playlist>
|
</section>
|
||||||
{% comment %}
|
{% endspaceless %}
|
||||||
{% for object in podcasts %}
|
{% endif %}
|
||||||
{% include "aircox/widgets/podcast_item.html" %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endcomment %}
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if tracks %}
|
{% if tracks %}
|
||||||
<section>
|
<section class="container">
|
||||||
<h4 class="title is-4">{% translate "Playlist" %}</h4>
|
<h3 class="title">{% translate "Playlist" %}</h3>
|
||||||
<ol>
|
<table class="table is-hoverable is-fullwidth">
|
||||||
{% for track in tracks %}
|
<thead>
|
||||||
<li><span>{{ track.title }}</span>
|
<tr>
|
||||||
<span class="has-text-grey-dark has-text-weight-light">
|
<th></th>
|
||||||
— {{ track.artist }}
|
<th>{% translate "Artist" %}</th>
|
||||||
{% if track.info %}(<i>{{ track.info }}</i>){% endif %}
|
<th>{% translate "Title" %}</th>
|
||||||
</span>
|
<th></th>
|
||||||
</li>
|
</thead>
|
||||||
{% endfor %}
|
<tbody>
|
||||||
</ol>
|
{% for track in tracks %}
|
||||||
</section>
|
<tr>
|
||||||
{% endif %}
|
<td>{{ forloop.counter }}</td>
|
||||||
|
<td>{{ track.artist }}</td>
|
||||||
</template></a-episode>
|
<td>{{ track.title }}</td>
|
||||||
{% endblock %}
|
<td>{{ track.info|default:"" }}</td>
|
||||||
|
</tr>
|
||||||
{% block sidebar %}
|
{% endfor %}
|
||||||
<section>
|
</tbody>
|
||||||
<h4 class="title is-4">{% translate "Diffusions" %}</h4>
|
</table>
|
||||||
<ul>
|
</section>
|
||||||
{% for diffusion in object.diffusion_set.all %}
|
{% endif %}
|
||||||
<li>
|
</template>
|
||||||
{% with diffusion.start as start %}
|
</a-episode>
|
||||||
{% with diffusion.end as end %}
|
|
||||||
<time datetime="{{ start }}">{{ start|date:"D. d F Y, H:i" }}</time>
|
|
||||||
—
|
|
||||||
<time datetime="{{ end }}">{{ end|date:"H:i" }}</time>
|
|
||||||
{% endwith %}
|
|
||||||
{% endwith %}
|
|
||||||
|
|
||||||
<small>
|
|
||||||
{% if diffusion.initial %}
|
|
||||||
{% with diffusion.initial.date as date %}
|
|
||||||
<span title="{% blocktranslate %}Rerun of {{ date }}{% endblocktranslate %}">
|
|
||||||
({% translate "rerun" %})
|
|
||||||
</span>
|
|
||||||
{% endwith %}
|
|
||||||
{% endif %}
|
|
||||||
</small>
|
|
||||||
<br>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
{{ block.super }}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
37
aircox/templates/aircox/episode_form.html
Normal file
37
aircox/templates/aircox/episode_form.html
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{% extends "aircox/basepage_detail.html" %}
|
||||||
|
{% load static i18n humanize honeypot aircox %}
|
||||||
|
|
||||||
|
{% block head_extra %}
|
||||||
|
<script type="text/javascript" src="{% static "aircox/js/admin.js" %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static "aircox/js/ckeditor-init.js" %}"></script>
|
||||||
|
<!-- <script type="text/javascript" src="{% static "ckeditor/ckeditor-init.js" %}"></script> -->
|
||||||
|
<script type="text/javascript" src="{% static "ckeditor/ckeditor/ckeditor.js" %}"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block init-scripts %}
|
||||||
|
aircox.init(null, {hotReload:false, initPlayer:false, initApp:true})
|
||||||
|
initialiseCKEditor()
|
||||||
|
initialiseCKEditorInInlinedForms()
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block comments %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content-container %}
|
||||||
|
<section class="container">
|
||||||
|
<form method="post" enctype="multipart/form-data">{% csrf_token %}
|
||||||
|
<table>
|
||||||
|
{{ form.as_table }}
|
||||||
|
{% render_honeypot_field "website" %}
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
<input type="submit" value="Update" class="button is-success">
|
||||||
|
|
||||||
|
{% include "aircox/playlist_inline.html" %}
|
||||||
|
|
||||||
|
<input type="submit" value="Update" class="button is-success">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content-container %}
|
||||||
<article class="message is-danger">
|
<article class="message is-danger">
|
||||||
<div class="message-header">
|
<div class="message-header">
|
||||||
<p>{% block error_title %}{% trans "An error occurred" %}{% endblock %}</p>
|
<p>{% block error_title %}{% trans "An error occurred" %}{% endblock %}</p>
|
||||||
|
|||||||
@@ -1,85 +1,73 @@
|
|||||||
{% extends "aircox/page_list.html" %}
|
{% extends "aircox/base.html" %}
|
||||||
{% comment %}Home page{% endcomment %}
|
{% load i18n aircox %}
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block head_title %}{{ station.name }}{% endblock %}
|
{% block head_title %}{{ station.name }}{% endblock %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}{% if page %}{{ block.super }}{% endif %}{% endblock %}
|
||||||
{% if not page or not page.title %}{{ station.name }}
|
|
||||||
{% else %}{{ block.super }}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block before_list %}{% endblock %}
|
|
||||||
|
|
||||||
{% block pages_list %}
|
{% block breadcrumbs-container %}{% endblock %}
|
||||||
{% if page and page.content %}<hr/>{% endif %}
|
|
||||||
|
{% block content-container %}
|
||||||
|
{{ block.super }}
|
||||||
|
|
||||||
{% if next_diffs %}
|
{% if next_diffs %}
|
||||||
<div class="columns">
|
<section class="container">
|
||||||
{% with render_card=True %}
|
<h2 class="title">
|
||||||
{% for object in next_diffs %}
|
{% with station.name as station %}
|
||||||
{% with is_primary=object.is_now %}
|
{% blocktrans %}Today on {{ station }}{% endblocktrans %}
|
||||||
<div class="column is-relative">
|
{% endwith %}
|
||||||
<h4 class="card-super-title" title="{{ object.start }}">
|
</h2>
|
||||||
{% if is_primary %}
|
|
||||||
<span class="fas fa-play"></span>
|
|
||||||
<time datetime="{{ object.start }}">
|
|
||||||
{% translate "Currently" %}
|
|
||||||
</time>
|
|
||||||
{% else %}
|
|
||||||
{{ object.start|date:"H:i" }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if object.episode.category %}
|
<div class="mb-3">
|
||||||
// {{ object.episode.category.title }}
|
{% with next_diffs.0 as obj %}
|
||||||
{% endif %}
|
{% page_widget "wide" obj.episode diffusion=obj timetable=True %}
|
||||||
</h4>
|
{% endwith %}
|
||||||
{% include object.item_template_name %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endwith %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endwith %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if object_list %}
|
<hr/>
|
||||||
<h4 class="title is-4">{% translate "Today" %}</h4>
|
|
||||||
<section role="list">
|
<a-carousel section-class="card-grid">
|
||||||
{% include 'aircox/widgets/diffusion_list.html' %}
|
{% for obj in next_diffs|slice:"1:" %}
|
||||||
|
{% if object != diffusion %}
|
||||||
|
{% page_widget "card" obj.episode diffusion=obj timetable=True %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</a-carousel>
|
||||||
</section>
|
</section>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block pagination %}
|
{% if logs %}
|
||||||
<ul class="pagination-list">
|
<section class="container">
|
||||||
<li>
|
<h2 class="title">{% translate "It just happened" %}</h2>
|
||||||
<a href="{% url "page-list" %}" class="pagination-link"
|
|
||||||
aria-label="{% translate "Show all publication" %}">
|
<div class="list-grid" role="list">
|
||||||
{% translate "More publications..." %}
|
{% include "./widgets/logs.html" with object_list=logs %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<nav class="nav-urls">
|
||||||
|
<a href="{% url "timetable-list" %}"
|
||||||
|
aria-label="{% translate "Show all program's for today" %}">
|
||||||
|
{% translate "Today" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</nav>
|
||||||
</ul>
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
{% if podcasts %}
|
||||||
|
<section class="container">
|
||||||
|
<h2 class="title is-3 p-2">{% translate "Last podcasts" %}</h2>
|
||||||
|
{% include "./widgets/carousel.html" with objects=podcasts url_name="podcast-list" url_label=_("All podcasts") %}
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if publications %}
|
||||||
|
<section class="container">
|
||||||
|
<h2 class="title">{% translate "Last publications" %}</h2>
|
||||||
|
{% include "./widgets/carousel.html" with objects=publications url_name="page-list" url_label=_("All publications") %}
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block pages_list %}{% endblock %}
|
||||||
{% block sidebar %}
|
|
||||||
<section>
|
|
||||||
<h4 class="title is-4">{% translate "Previously on air" %}</h4>
|
|
||||||
{% with has_cover=False %}
|
|
||||||
{% with logs as object_list %}
|
|
||||||
{% include "aircox/widgets/log_list.html" %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endwith %}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h4 class="title is-4">{% translate "Last publications" %}</h4>
|
|
||||||
{% with hide_schedule=True %}
|
|
||||||
{% with has_headline=False %}
|
|
||||||
{% for object in last_publications %}
|
|
||||||
{% include object.item_template_name|default:'aircox/widgets/page_item.html' %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endwith %}
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
{% extends "aircox/page_list.html" %}
|
|
||||||
{% comment %}List of logs for a specific date{% endcomment %}
|
|
||||||
{% load i18n humanize aircox %}
|
|
||||||
|
|
||||||
{% block title %}
|
|
||||||
{% if not page or not page.title %}
|
|
||||||
{% with station.name as station %}
|
|
||||||
{% blocktranslate %}That happened on {{ station }}{% endblocktranslate %}
|
|
||||||
{% endwith %}
|
|
||||||
{% else %}
|
|
||||||
{{ block.super }}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block subtitle %}{{ date|date:"l d F Y" }}{% endblock %}
|
|
||||||
|
|
||||||
{% block before_list %}
|
|
||||||
{% with "log-list" as url_name %}
|
|
||||||
{% include "aircox/widgets/dates_menu.html" %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block pages_list %}
|
|
||||||
<section>
|
|
||||||
{# <h4 class="subtitle size-4">{{ date }}</h4> #}
|
|
||||||
{% include "aircox/widgets/log_list.html" %}
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -6,83 +6,82 @@ Base template used to display a Page
|
|||||||
Context:
|
Context:
|
||||||
- page: page
|
- page: page
|
||||||
- parent: parent page
|
- parent: parent page
|
||||||
|
- related_objects: list of object to display as related publications
|
||||||
|
- related_url: url to the full list of related_objects
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% block header_crumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ block.super }}
|
{% if parent %}
|
||||||
{% if page.category %}
|
{% include "./widgets/breadcrumbs.html" with page=parent %}
|
||||||
{% if parent %} / {% endif %} {{ page.category.title }}
|
{% if page %}
|
||||||
|
<a href="{% url page.list_url_name parent_slug=parent.slug %}">
|
||||||
|
{{ page|verbose_name:True }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% elif page %}
|
||||||
|
{% include "./widgets/breadcrumbs.html" with page=page no_title=True %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block top-nav-tools %}
|
|
||||||
{% has_perm page "change" as can_edit %}
|
|
||||||
{% if can_edit %}
|
|
||||||
<a class="navbar-item" href="{{ page|admin_url:'change' }}"
|
|
||||||
target="new">
|
|
||||||
<span class="icon is-small">
|
|
||||||
<i class="fa fa-pen"></i>
|
|
||||||
</span>
|
|
||||||
<span>{% translate "Edit" %}</span>
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
||||||
|
{% block related %}
|
||||||
|
{% if related_objects %}
|
||||||
|
<section class="container">
|
||||||
|
{% with models=object|verbose_name:True %}
|
||||||
|
<h3 class="title">{% blocktranslate %}Related {{models}}{% endblocktranslate %}</h3>
|
||||||
|
|
||||||
|
{% include "./widgets/carousel.html" with objects=related_objects url_name=object.list_url_name url_category=object.category %}
|
||||||
|
{% endwith %}
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block comments %}
|
{% block comments %}
|
||||||
{% if comments or comment_form %}
|
{% if comments %}
|
||||||
<section class="mt-6">
|
<section class="container">
|
||||||
<h4 class="title is-4">{% translate "Comments" %}</h4>
|
<h2 class="title">{% translate "Comments" %}</h2>
|
||||||
|
|
||||||
{% for comment in comments %}
|
{% for object in comments %}
|
||||||
<div class="media box">
|
{% page_widget "item" object %}
|
||||||
<div class="media-content">
|
|
||||||
<p>
|
|
||||||
<strong class="mr-2">{{ comment.nickname }}</strong>
|
|
||||||
<time datetime="{{ comment.date }}" title="{{ comment.date }}">
|
|
||||||
<small>{{ comment.date|naturaltime }}</small>
|
|
||||||
</time>
|
|
||||||
<br>
|
|
||||||
{{ comment.content }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if comment_form %}
|
{% if comment_form %}
|
||||||
|
<section class="container">
|
||||||
|
<h2 class="title">{% translate "Post a comment" %}</h2>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<h5 class="title is-5">{% translate "Post a comment" %}</h5>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% render_honeypot_field "website" %}
|
{% render_honeypot_field "website" %}
|
||||||
|
|
||||||
{% for field in comment_form %}
|
<div class="field">
|
||||||
<div class="field is-horizontal">
|
<div class="control">
|
||||||
<div class="field-label is-normal">
|
{{ comment_form.content }}
|
||||||
<label class="label">
|
|
||||||
{{ field.label_tag }}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="field-body">
|
|
||||||
<div class="field">
|
|
||||||
<p class="control is-expanded">{{ field }}</p>
|
|
||||||
{% if field.errors %}
|
|
||||||
<p class="help is-danger">{{ field.errors }}</p>
|
|
||||||
{% endif %}
|
|
||||||
{% if field.help_text %}
|
|
||||||
<p class="help">{{ field.help_text|safe }}</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% for field in comment_form %}
|
||||||
|
{% if field.name != "content" %}
|
||||||
|
<div class="field is-horizontal">
|
||||||
|
<label class="label">{{ field.label }}</label>
|
||||||
|
<div class="control">{{ field }}</div>
|
||||||
|
</div>
|
||||||
|
{% if field.errors %}
|
||||||
|
<p class="help is-danger">{{ field.errors }}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% if field.help_text %}
|
||||||
|
<p class="help">{{ field.help_text|safe }}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<div class="has-text-right">
|
<div class="has-text-right">
|
||||||
<button type="reset" class="button is-danger">{% translate "Reset" %}</button>
|
<button type="submit" class="button">{% translate "Post comment" %}</button>
|
||||||
<button type="submit" class="button is-success">{% translate "Post comment" %}</button>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
|
||||||
</section>
|
</section>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -2,61 +2,60 @@
|
|||||||
{% comment %}Display a list of Pages{% endcomment %}
|
{% comment %}Display a list of Pages{% endcomment %}
|
||||||
{% load i18n aircox %}
|
{% load i18n aircox %}
|
||||||
|
|
||||||
{% block before_list %}
|
{% block secondary-nav %}
|
||||||
{{ block.super }}
|
{% if not parent and categories %}
|
||||||
|
<nav class="nav secondary">
|
||||||
{% if view.has_filters and object_list %}
|
<div class="nav-menu nav-categories">
|
||||||
<form method="GET" action="" class="media">
|
{% for cat in categories %}
|
||||||
<div class="media-content">
|
<a class="nav-item{% if cat == category %} active{% endif %}"
|
||||||
{% block filters %}
|
href="{% url request.resolver_match.url_name category_slug=cat.slug %}">
|
||||||
<div class="field is-horizontal">
|
{{ cat.title }}
|
||||||
<div class="field-label">
|
</a>
|
||||||
<label class="label">{% translate "Search" %}</label>
|
{% endfor %}
|
||||||
</div>
|
|
||||||
<div class="field-body">
|
|
||||||
<div class="field">
|
|
||||||
<div class="control has-icons-left">
|
|
||||||
<span class="icon is-small is-left">
|
|
||||||
<i class="fa fa-search"></i>
|
|
||||||
</span>
|
|
||||||
<input class="input" type="text" name="q"
|
|
||||||
value="{{ filterset_data.q }}"
|
|
||||||
placeholder="{% translate "Search content" %}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="field is-horizontal">
|
|
||||||
<div class="field-label">
|
|
||||||
<label class="label">{% translate "Categories" %}</label>
|
|
||||||
</div>
|
|
||||||
<div class="field-body">
|
|
||||||
<div class="field is-narrow">
|
|
||||||
<div class="control">
|
|
||||||
{% for label, value in categories %}
|
|
||||||
<label class="checkbox">
|
|
||||||
<input type="checkbox" class="checkbox" name="category__id__in"
|
|
||||||
value="{{ value }}"
|
|
||||||
{% if value in filterset_data.category__id__in %}checked{% endif %} />
|
|
||||||
{{ label }}
|
|
||||||
</label>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="media-right">
|
<a-switch class="button burger"
|
||||||
<div class="field is-grouped is-grouped-right">
|
el=".nav-categories" group="nav" icon="fas fa-tags"
|
||||||
<div class="control">
|
aria-label="{% translate "Categories" %}">
|
||||||
<button class="button is-primary"/>{% translate "Apply" %}</button>
|
</a-switch>
|
||||||
</div>
|
</nav>
|
||||||
<div class="control">
|
|
||||||
<a href="?" class="button is-secondary">{% translate "Reset" %}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% if parent %}{{ parent.title }}
|
||||||
|
{% else %}{{ block.super }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block header %}
|
||||||
|
{% if page and not object %}
|
||||||
|
{% with page as object %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endwith %}
|
||||||
|
{% else %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
{% if parent and model.list_url_name %}
|
||||||
|
{% include "./widgets/breadcrumbs.html" with page=parent %}
|
||||||
|
<a href="{% url model.list_url_name %}">{{ model|verbose_name:True }}</a>
|
||||||
|
{% elif page and model.list_url_name %}
|
||||||
|
<a href="{% url model.list_url_name %}">{{ page.title }}</a>
|
||||||
|
{% if category %}
|
||||||
|
<a href="{% url request.resolver_match.url_name category_slug=category.slug %}">
|
||||||
|
{{ category.title }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<a href="{% url request.resolver_match.url_name %}">{{ model|verbose_name:True }}</a>
|
||||||
|
{% if category %}
|
||||||
|
<a href="{% url request.resolver_match.url_name category_slug=category.slug %}">
|
||||||
|
{{ category.title }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content-container %}{% endblock %}
|
||||||
|
|||||||
70
aircox/templates/aircox/playlist_inline.html
Normal file
70
aircox/templates/aircox/playlist_inline.html
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
{% comment %}Inline block to edit playlists{% endcomment %}
|
||||||
|
{% load aircox aircox_admin static i18n %}
|
||||||
|
|
||||||
|
<div id="inline-tracks" class="box mb-5">
|
||||||
|
{{ formset.non_form_errors }}
|
||||||
|
<!-- formset.management_form -->
|
||||||
|
|
||||||
|
<a-playlist-editor
|
||||||
|
:labels="{% track_inline_labels %}"
|
||||||
|
:init-data="{% track_inline_data formset=formset %}"
|
||||||
|
settings-url="{% url "api:user-settings" %}"
|
||||||
|
data-prefix="{{ formset.prefix }}-">
|
||||||
|
<template #title>
|
||||||
|
<h5 class="title is-4">{% trans "Playlist" %}</h5>
|
||||||
|
</template>
|
||||||
|
<template #top="{items}">
|
||||||
|
<input type="hidden" name="{{ formset.prefix }}-TOTAL_FORMS"
|
||||||
|
:value="items.length || 0"/>
|
||||||
|
<input type="hidden" name="{{ formset.prefix }}-INITIAL_FORMS"
|
||||||
|
value="{{ formset.initial_form_count }}"/>
|
||||||
|
<input type="hidden" name="{{ formset.prefix }}-MIN_NUM_FORMS"
|
||||||
|
value="{{ formset.min_num }}"/>
|
||||||
|
<input type="hidden" name="{{ formset.prefix }}-MAX_NUM_FORMS"
|
||||||
|
value="{{ formset.max_num }}"/>
|
||||||
|
</template>
|
||||||
|
<template #rows-header-head>
|
||||||
|
<th style="max-width:2em" title="{% trans "Track Position" %}"
|
||||||
|
aria-description="{% trans "Track Position" %}">
|
||||||
|
<span class="icon">
|
||||||
|
<i class="fa fa-arrow-down-1-9"></i>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
</template>
|
||||||
|
<template v-slot:row-head="{item,row}">
|
||||||
|
<td>
|
||||||
|
[[ row+1 ]]
|
||||||
|
<input type="hidden"
|
||||||
|
:name="'{{ formset.prefix }}-' + row + '-position'"
|
||||||
|
:value="row"/>
|
||||||
|
<input t-if="item.data.id" type="hidden"
|
||||||
|
:name="'{{ formset.prefix }}-' + row + '-id'"
|
||||||
|
:value="item.data.id || item.id"/>
|
||||||
|
|
||||||
|
{% for field in fields %}
|
||||||
|
{% if field != 'position' %}
|
||||||
|
<input type="hidden"
|
||||||
|
:name="'{{ formset.prefix }}-' + row + '-{{ field.name }}'"
|
||||||
|
v-model="item.data[attr]"/>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
|
</template>
|
||||||
|
{% for field in fields %}
|
||||||
|
<template v-slot:row-{{ field }}="{item,cell,value,attr,emit}">
|
||||||
|
<div class="field">
|
||||||
|
<a-autocomplete
|
||||||
|
:input-class="['input', item.error(attr) ? 'is-danger' : 'half-field']"
|
||||||
|
url="{% url 'api:track-autocomplete' %}?{{ field }}=${query}&field={{ field }}"
|
||||||
|
:name="'{{ formset.prefix }}-' + cell.row + '-{{ field }}'"
|
||||||
|
v-model="item.data[attr]"
|
||||||
|
title="{{ field }}"
|
||||||
|
@change="emit('change', col)"/>
|
||||||
|
<p v-for="error in item.error(attr)" class="help is-danger">
|
||||||
|
[[ error ]] !
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
{% endfor %}
|
||||||
|
</a-playlist-editor>
|
||||||
|
</div>
|
||||||
@@ -1,67 +1,65 @@
|
|||||||
{% extends "aircox/page_detail.html" %}
|
{% extends "aircox/page_detail.html" %}
|
||||||
{% comment %}Detail page of a show{% endcomment %}
|
{% comment %}Detail page of a show{% endcomment %}
|
||||||
{% load i18n %}
|
{% load i18n aircox %}
|
||||||
|
|
||||||
{% include "aircox/program_sidebar.html" %}
|
{% block top-nav-tools %}
|
||||||
|
{% has_perm page page.change_permission_codename simple=True as can_edit %}
|
||||||
|
{% if can_edit %}
|
||||||
{% block header_nav %}
|
<a class="navbar-item" href="{% url 'program-edit' page.pk %}" target="_self">
|
||||||
|
<span class="icon is-small">
|
||||||
|
<i class="fa fa-pen"></i>
|
||||||
|
</span>
|
||||||
|
<span>{% translate "Edit" %}</span>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content-container %}
|
||||||
{% block content %}
|
{% with schedules=program.schedule_set.all %}
|
||||||
{{ block.super }}
|
{% if schedules %}
|
||||||
<br>
|
<header class="container schedules">
|
||||||
{% with has_headline=False %}
|
{% for schedule in schedules %}
|
||||||
{% if articles %}
|
<div class="schedule">
|
||||||
<section>
|
<div class="heading">
|
||||||
<h4 class="title is-4">{% translate "Articles" %}</h4>
|
<span class="day">{{ schedule.get_frequency_display }}</span>
|
||||||
|
{% with schedule.start|date:"H:i" as start %}
|
||||||
{% for object in articles %}
|
{% with schedule.end|date:"H:i" as end %}
|
||||||
{% include "aircox/widgets/page_item.html" %}
|
<time datetime="{{ start }}">{{ start }}</time>
|
||||||
|
—
|
||||||
|
<time datetime="{{ end }}">{{ end }}</time>
|
||||||
|
{% endwith %}
|
||||||
|
{% endwith %}
|
||||||
|
<small>
|
||||||
|
{% if schedule.is_rerun %}
|
||||||
|
{% with schedule.initial.date as date %}
|
||||||
|
<span title="{% blocktranslate %}Rerun of {{ date }}{% endblocktranslate %}">
|
||||||
|
({% translate "Rerun" %})
|
||||||
|
</span>
|
||||||
|
{% endwith %}
|
||||||
|
{% endif %}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</header>
|
||||||
<br>
|
|
||||||
<nav class="pagination is-centered">
|
|
||||||
<ul class="pagination-list">
|
|
||||||
<li>
|
|
||||||
<a href="{% url "article-list" parent_slug=program.slug %}"
|
|
||||||
class="pagination-link"
|
|
||||||
aria-label="{% translate "Show all program's articles" %}">
|
|
||||||
{% translate "More articles" %}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block sidebar %}
|
|
||||||
<section>
|
|
||||||
<h4 class="title is-4">{% translate "Diffusions" %}</h4>
|
|
||||||
{% for schedule in program.schedule_set.all %}
|
|
||||||
{{ schedule.get_frequency_display }}
|
|
||||||
{% with schedule.start|date:"H:i" as start %}
|
|
||||||
{% with schedule.end|date:"H:i" as end %}
|
|
||||||
<time datetime="{{ start }}">{{ start }}</time>
|
|
||||||
—
|
|
||||||
<time datetime="{{ end }}">{{ end }}</time>
|
|
||||||
{% endwith %}
|
|
||||||
{% endwith %}
|
|
||||||
<small>
|
|
||||||
{% if schedule.initial %}
|
|
||||||
{% with schedule.initial.date as date %}
|
|
||||||
<span title="{% blocktranslate %}Rerun of {{ date }}{% endblocktranslate %}">
|
|
||||||
({% translate "Rerun" %})
|
|
||||||
</span>
|
|
||||||
{% endwith %}
|
|
||||||
{% endif %}
|
|
||||||
</small>
|
|
||||||
<br>
|
|
||||||
{% endfor %}
|
|
||||||
</section>
|
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
||||||
|
{% if episodes %}
|
||||||
|
<section class="container">
|
||||||
|
<h3 class="title">{% translate "Last Episodes" %}</h3>
|
||||||
|
{% include "./widgets/carousel.html" with objects=episodes url_name="episode-list" url_parent=object url_label=_("All episodes") %}
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
{% if articles %}
|
||||||
|
<section class="container">
|
||||||
|
<h3 class="title">{% translate "Last Articles" %}</h3>
|
||||||
|
{% include "./widgets/carousel.html" with objects=articles url_name="article-list" url_parent=object url_label=_("All articles") %}
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
28
aircox/templates/aircox/program_form.html
Normal file
28
aircox/templates/aircox/program_form.html
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{% extends "aircox/page_detail.html" %}
|
||||||
|
{% load static i18n humanize honeypot aircox %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block head_extra %}
|
||||||
|
{{ form.media }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block init-scripts %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block comments %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content-container %}
|
||||||
|
<section class="container">
|
||||||
|
<div>
|
||||||
|
<form method="post" enctype="multipart/form-data">{% csrf_token %}
|
||||||
|
<table>
|
||||||
|
{{ form.as_table }}
|
||||||
|
{% render_honeypot_field "website" %}
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
<input type="submit" value="Update" class="button is-success">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
|
|
||||||
{% block sidebar_title %}
|
|
||||||
{% with program.title as program %}
|
|
||||||
{% blocktranslate %}Recently on {{ program }}{% endblocktranslate %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endblock %}
|
|
||||||
28
aircox/templates/aircox/timetable_list.html
Normal file
28
aircox/templates/aircox/timetable_list.html
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{% extends "aircox/page_list.html" %}
|
||||||
|
{% comment %}List of diffusions as a timetable{% endcomment %}
|
||||||
|
{% load i18n aircox humanize %}
|
||||||
|
|
||||||
|
{% block subtitle %}{{ date|date:"l d F Y" }}{% endblock %}
|
||||||
|
|
||||||
|
{% block secondary-nav %}
|
||||||
|
<nav class="nav secondary">
|
||||||
|
{% include "./widgets/dates_menu.html" with url_name=view.redirect_date_url %}
|
||||||
|
</nav>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
{{ block.super }}
|
||||||
|
<a href="{% url "timetable-list" date=date %}">{{ date|date:"l d F Y" }}</a>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block list-container %}
|
||||||
|
{% with list_class="list-grid" %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endwith %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block list %}
|
||||||
|
{% include "./widgets/logs.html" with object_list=object_list timetable=True %}
|
||||||
|
{% endblock %}
|
||||||
4
aircox/templates/aircox/widgets/article.html
Normal file
4
aircox/templates/aircox/widgets/article.html
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{% extends "./page.html" %}
|
||||||
|
{% load humanize %}
|
||||||
|
|
||||||
|
{% block subtitle %}{{ object.pub_date.date }}{% endblock %}
|
||||||
@@ -11,63 +11,48 @@ Context variables:
|
|||||||
- is_thin (=False): if True, smaller cover and display less info
|
- is_thin (=False): if True, smaller cover and display less info
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% if render_card %}
|
{% block outer %}
|
||||||
<article class="card {% if is_primary %}is-primary{% endif %}">
|
<article class="preview preview-item{% if is_primary %}is-primary{% endif %}{% block card_class %}{% endblock %}">
|
||||||
<header class="card-image">
|
{% block inner %}
|
||||||
<a href="{{ object.get_absolute_url }}">
|
<header class="headings"
|
||||||
<figure class="image is-4by3">
|
style="background-image: url({{ object.cover.url }})">
|
||||||
<img src="{% thumbnail object.cover|default:station.default_cover 480x480 %}">
|
{% block headings %}
|
||||||
</figure>
|
<div>
|
||||||
</a>
|
<span class="heading subtitle">{% block subtitle %}{% endblock %}</span>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
</header>
|
</header>
|
||||||
<div class="card-header">
|
|
||||||
<h4 class="title">
|
|
||||||
<a href="{{ object.get_absolute_url }}">
|
|
||||||
{% block card_title %}{{ object.title }}{% endblock %}
|
|
||||||
</a>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
|
<div class="">
|
||||||
|
<div>
|
||||||
|
<h2 class="heading title">{% block title %}{% endblock %}</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% else %}
|
<summary class="heading-container">
|
||||||
<article class="media item {% block css %}{% endblock%}">
|
{% block content %}
|
||||||
{% if has_cover|default_if_none:True %}
|
{% if content and with_content %}
|
||||||
<div class="media-left">
|
{% autoescape off %}
|
||||||
{% if is_thin %}
|
{{ content|striptags|truncatewords:64|linebreaks }}
|
||||||
<img src="{% thumbnail object.cover|default:station.default_cover 64x64 crop=scale %}"
|
{% endautoescape %}
|
||||||
class="cover is-tiny">
|
|
||||||
{% else %}
|
|
||||||
<img src="{% thumbnail object.cover|default:station.default_cover 128x128 crop=scale %}"
|
|
||||||
class="cover is-small">
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="media-content">
|
|
||||||
<h5 class="title is-5 has-text-weight-normal">
|
|
||||||
{% block title %}
|
|
||||||
{% if object.is_published %}
|
|
||||||
<a href="{{ object.get_absolute_url }}">{{ object.title }}</a>
|
|
||||||
{% else %}
|
|
||||||
{{ object.title }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</h5>
|
</summary>
|
||||||
<div class="subtitle is-6 has-text-weight-light">
|
|
||||||
{% block subtitle %}
|
|
||||||
{% if object.category %}{{ object.category.title }}{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if has_headline|default_if_none:True %}
|
<div class="actions">
|
||||||
<div class="headline">
|
{% block actions %}
|
||||||
{% block headline %}{{ object.headline }}{% endblock %}
|
<a class="button float-right" href="{{ object.get_absolute_url|escape }}">
|
||||||
|
<span class="icon">
|
||||||
|
<i class="fas fa-external-link"></i>
|
||||||
|
</span>
|
||||||
|
<label>{% translate "More infos" %}</label>
|
||||||
|
</a>
|
||||||
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% if not no_actions %}
|
{% if with_container %}
|
||||||
{% block actions %}{% endblock %}
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</article>
|
</article>
|
||||||
{% endif %}
|
{% endblock %}
|
||||||
|
|||||||
15
aircox/templates/aircox/widgets/breadcrumbs.html
Normal file
15
aircox/templates/aircox/widgets/breadcrumbs.html
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{% load aircox %}
|
||||||
|
|
||||||
|
<a href="{% url page.list_url_name %}">
|
||||||
|
{{ page|verbose_name:True }}
|
||||||
|
</a>
|
||||||
|
{% if page.category and not no_cat %}
|
||||||
|
<a href="{% url page.list_url_name category_slug=page.category.slug %}">
|
||||||
|
{{ page.category.title }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if not no_title %}
|
||||||
|
<a href="{{ page.get_absolute_url }}">
|
||||||
|
{{ page.title|truncatechars:24 }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
23
aircox/templates/aircox/widgets/card.html
Normal file
23
aircox/templates/aircox/widgets/card.html
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{% extends "./preview.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block tag-class %}{{ block.super }} preview-card{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
<div class="card-content">
|
||||||
|
{% if cover %}
|
||||||
|
{% if url %}<a href="{{ url }}">{% endif %}
|
||||||
|
<figure style="background-image: url({{ cover }});" class="preview-cover">
|
||||||
|
<img src="{{ cover }}" class="hide">
|
||||||
|
</figure>
|
||||||
|
{% if url %}</a>{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<footer class="actions">
|
||||||
|
{% block actions %}{{ block.super }}{% endblock %}
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% block headings-container %}{{ block.super }}{% endblock %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
28
aircox/templates/aircox/widgets/carousel.html
Normal file
28
aircox/templates/aircox/widgets/carousel.html
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{% load aircox %}
|
||||||
|
{% comment %}
|
||||||
|
Context:
|
||||||
|
- objects: list of objects to display
|
||||||
|
- url_name: url name to show the full list
|
||||||
|
- url_parent: parent page for the full list
|
||||||
|
- url_label: label of url button
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
|
<a-carousel section-class="card-grid">
|
||||||
|
{% for object in objects %}
|
||||||
|
{% page_widget "card" object %}
|
||||||
|
{% endfor %}
|
||||||
|
</a-carousel>
|
||||||
|
|
||||||
|
{% if url_name %}
|
||||||
|
<nav class="nav-urls">
|
||||||
|
{% if url_parent %}
|
||||||
|
<a href="{% url url_name parent_slug=url_parent.slug %}">
|
||||||
|
{% elif url_category %}
|
||||||
|
<a href="{% url url_name category_slug=url_category.slug %}">
|
||||||
|
{% else %}
|
||||||
|
<a href="{% url url_name %}">
|
||||||
|
{% endif %}
|
||||||
|
{{ url_label|default:_("Show all") }}
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
{% endif %}
|
||||||
51
aircox/templates/aircox/widgets/comment.html
Normal file
51
aircox/templates/aircox/widgets/comment.html
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
{% extends "./page.html" %}
|
||||||
|
{% load i18n humanize aircox %}
|
||||||
|
|
||||||
|
{% block tag-class %}{{ block.super }} comment{% endblock %}
|
||||||
|
{% block tag-extra %} id="comment-{{ object.pk }}"{% endblock %}
|
||||||
|
|
||||||
|
{% block outer %}
|
||||||
|
{% with url=object.get_absolute_url %}
|
||||||
|
{% if with_title %}
|
||||||
|
{{ block.super }}
|
||||||
|
{{ block.super }}
|
||||||
|
{% else %}
|
||||||
|
{{ block.super }}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{{ object.nickname }} — {{ object.date }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block subtitle %}
|
||||||
|
{% if with_title %}
|
||||||
|
{{ object.parent.title }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}{{ object.content }}{% endblock %}
|
||||||
|
|
||||||
|
{% block actions %}
|
||||||
|
{{ block.super }}
|
||||||
|
|
||||||
|
{% if request.user.is_staff %}
|
||||||
|
<a href="{% url "admin:aircox_comment_change" object.pk %}" class="button"
|
||||||
|
title="{% trans "Edit comment" %}"
|
||||||
|
aria-label="{% trans "Edit comment" %}">
|
||||||
|
<span class="fa fa-edit"></span>
|
||||||
|
</a>
|
||||||
|
<a class="button is-danger"
|
||||||
|
title="{% trans "Delete comment" %}"
|
||||||
|
aria-label="{% trans "Delete comment" %}"
|
||||||
|
href="{% url "admin:aircox_comment_delete" object.pk %}">
|
||||||
|
<span class="fa fa-trash-alt"></span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
{# <a href="mailto:{{ object.email }}">{{ object.nickname }}</a> #}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@@ -11,36 +11,33 @@ An empty date results to a title or a separator
|
|||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
<div class="media" role="menu"
|
<a-switch class="button burger"
|
||||||
aria-label="{% translate "pick a date" %}">
|
el=".nav-dates" icon="far fa-calendar" group="nav"
|
||||||
<div class="media-content">
|
aria-label="{% translate "Dates" %}">
|
||||||
<div class="tabs is-toggle">
|
</a-switch>
|
||||||
<ul>
|
|
||||||
{% for day in dates %}
|
|
||||||
<li class="{% if day == date %}is-active{% endif %}">
|
|
||||||
<a href="{% url url_name date=day %}">
|
|
||||||
{{ day|date:"D. d" }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="media-right">
|
<div class="nav-menu nav-dates">
|
||||||
<form action="{% url url_name %}" method="GET" class="navbar-body"
|
{% for day in dates %}
|
||||||
aria-label="{% translate "Jump to date" %}">
|
<a href="{% url url_name date=day %}" class="nav-item {% if day == date %}active{% endif %}">
|
||||||
<div class="field has-addons">
|
{{ day|date:"l d" }}
|
||||||
<div class="control has-icons-left">
|
</a>
|
||||||
<span class="icon is-small is-left"><span class="far fa-calendar"></span></span>
|
{% endfor %}
|
||||||
<input type="{{ date_input|default:"date" }}" class="input date"
|
|
||||||
name="date" value="{{ date|date:"Y-m-d" }}">
|
<a-dropdown class="nav-item align-right flex-grow-0 dropdown is-right"
|
||||||
</div>
|
content-class="dropdown-menu"
|
||||||
<div class="control">
|
button-tag="span" button-class="dropdown-trigger"
|
||||||
{% comment %}Translators: form button to select a date{% endcomment %}
|
button-icon-open="fa-solid fa-plus" button-icon-close="fa-solid fa-minus">
|
||||||
<button class="button is-primary">{% translate "Go" %}</button>
|
<template #default>
|
||||||
|
<div class="dropdown-content">
|
||||||
|
<div class="dropdown-item">
|
||||||
|
<h4>{% translate "Pick a date" %}</h4>
|
||||||
|
<v-calendar mode="date" borderless
|
||||||
|
:initial-page="{month: {{date.month}}, year: {{date.year}}}"
|
||||||
|
@dayclick="(event) => window.aircox.pickDate({% url url_name %}, event)"
|
||||||
|
color="yellow"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</template>
|
||||||
</div>
|
</a-dropdown>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,19 +3,4 @@ Context:
|
|||||||
- object_list: object list
|
- object_list: object list
|
||||||
- date: date for list
|
- date: date for list
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
<table id="timetable{% if date %}-{{ date|date:"Y-m-d" }}{% endif %}" class="timetable">
|
{% load aircox %}
|
||||||
{% for diffusion in object_list %}
|
|
||||||
<tr class="{% if diffusion.is_now %}has-background-primary{% endif %}">
|
|
||||||
<td class="pr-2 pb-2">
|
|
||||||
<time datetime="{{ diffusion.start|date:"c" }}">
|
|
||||||
{{ diffusion.start|date:"H:i" }} - {{ diffusion.end|date:"H:i" }}
|
|
||||||
</time>
|
|
||||||
</td>
|
|
||||||
<td class="pb-2">
|
|
||||||
{% with diffusion.episode as object %}
|
|
||||||
{% include "aircox/widgets/episode_item.html" %}
|
|
||||||
{% endwith %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
|
|||||||
68
aircox/templates/aircox/widgets/episode.html
Normal file
68
aircox/templates/aircox/widgets/episode.html
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
{% extends "./page.html" %}
|
||||||
|
{% load i18n humanize aircox %}
|
||||||
|
|
||||||
|
{% block outer %}
|
||||||
|
{% with diffusion.is_now as is_active %}
|
||||||
|
{% if admin %}
|
||||||
|
{% with object|admin_url:"change" as url %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endwith %}
|
||||||
|
{% else %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block subtitle %}
|
||||||
|
{% if diffusion %}
|
||||||
|
{% if timetable %}
|
||||||
|
{{ diffusion.start|date:"H:i" }}
|
||||||
|
—
|
||||||
|
{{ diffusion.end|date:"H:i" }}
|
||||||
|
{% else %}
|
||||||
|
{{ diffusion.start|naturalday }},
|
||||||
|
{{ diffusion.start|date:"H:i" }}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block actions %}
|
||||||
|
{{ block.super }}
|
||||||
|
|
||||||
|
{% if admin and diffusion %}
|
||||||
|
{% if diffusion.type == diffusion.TYPE_ON_AIR %}
|
||||||
|
<span class="tag is-info">
|
||||||
|
<span class="icon is-small">
|
||||||
|
{% if diffusion.is_live %}
|
||||||
|
<i class="fa fa-microphone"
|
||||||
|
title="{% translate "Live diffusion" %}"></i>
|
||||||
|
{% else %}
|
||||||
|
<i class="fa fa-music"
|
||||||
|
title="{% translate "Differed diffusion" %}"></i>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{{ diffusion.get_type_display }}
|
||||||
|
</span>
|
||||||
|
{% elif diffusion.type == diffusion.TYPE_CANCEL %}
|
||||||
|
<span class="tag is-danger">
|
||||||
|
{{ diffusion.get_type_display }}</span>
|
||||||
|
{% elif diffusion.type == diffusion.TYPE_UNCONFIRMED %}
|
||||||
|
<span class="tag is-warning">
|
||||||
|
{{ diffusion.get_type_display }}</span>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if object.sound_set.count %}
|
||||||
|
<button class="button action" @click="player.playButtonClick($event)"
|
||||||
|
data-sounds="{{ object.podcasts|json }}">
|
||||||
|
<span class="icon is-small">
|
||||||
|
<span class="fas fa-play"></span>
|
||||||
|
</span>
|
||||||
|
<label>{% translate "Listen" %}</label>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@@ -1,47 +1,26 @@
|
|||||||
{% extends "aircox/widgets/page_item.html" %}
|
{% extends "./basepage_item.html" %}
|
||||||
{% comment %}
|
{% load i18n humanize %}
|
||||||
List item for an episode.
|
|
||||||
|
|
||||||
Context variables:
|
|
||||||
- object: episode
|
|
||||||
- diffusion: episode's diffusion
|
|
||||||
- hide_schedule: if True, do not display start time
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
{% load i18n easy_thumbnails_tags aircox %}
|
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% if not object.is_published and object.program.is_published %}
|
{% if not object.is_published and object.program.is_published %}
|
||||||
<a href="{{ object.program.get_absolute_url }}">
|
<a href="{{ object.program.get_absolute_url }}">
|
||||||
{{ object.program.title }}
|
{{ object.program.title }}
|
||||||
{% if diffusion %}
|
</a>
|
||||||
—
|
|
||||||
{{ diffusion.start|date:"d F" }}
|
|
||||||
{% endif %}
|
|
||||||
</a>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block class %}
|
||||||
|
{% if object.is_now %}is-active{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block subtitle %}
|
{% block subtitle %}
|
||||||
{{ block.super }}
|
|
||||||
|
|
||||||
{% if diffusion %}
|
{% if diffusion %}
|
||||||
{% if not hide_schedule %}
|
{{ diffusion.start|naturalday }},
|
||||||
{% if object.category %}—{% endif %}
|
{{ diffusion.start|date:"g:i" }}
|
||||||
<time datetime="{{ diffusion.start|date:"c" }}" title="{{ diffusion.start }}">
|
{% else %}
|
||||||
{{ diffusion.start|date:"d M, H:i" }}
|
{{ block.super }}
|
||||||
</time>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if diffusion.initial %}
|
|
||||||
{% with diffusion.initial.date as date %}
|
|
||||||
<span title="{% blocktranslate %}Rerun of {{ date }}{% endblocktranslate %}">
|
|
||||||
{% translate "(rerun)" %}
|
|
||||||
</span>
|
|
||||||
{% endwith %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@@ -56,3 +35,21 @@ Context variables:
|
|||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block actions %}
|
||||||
|
{% has_perm page object.program.change_permission_codename simple=True as can_edit %}
|
||||||
|
{% if can_edit %}
|
||||||
|
<a class="button" href="{% url 'episode-edit' object.pk %}" target="_self">
|
||||||
|
<span class="icon is-small"><i class="fas fa-pen" alt="{% trans 'edit' %}"></i></span>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if object.sound_set.public.count %}
|
||||||
|
<button class="button" @click="player.playButtonClick($event)"
|
||||||
|
data-sounds="{{ object.podcasts|json }}">
|
||||||
|
<span class="icon is-small">
|
||||||
|
<span class="fas fa-play"></span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
42
aircox/templates/aircox/widgets/item.html
Normal file
42
aircox/templates/aircox/widgets/item.html
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{% extends "./preview.html" %}
|
||||||
|
{% load i18n aircox %}
|
||||||
|
|
||||||
|
{% block tag-class %}{{ block.super }} list-item is-fullwidth{% endblock %}
|
||||||
|
|
||||||
|
{% block headings %}
|
||||||
|
<a href="{{ url|escape }}" class="heading title {% block title-class %}{% endblock %}">
|
||||||
|
{% block title %}{{ title|default:"" }}{% endblock %}
|
||||||
|
</a>
|
||||||
|
<span class="heading subtitle {% block subtitle-class %}{% endblock %}">
|
||||||
|
{% block subtitle %}{{ subtitle|default:"" }}{% endblock %}
|
||||||
|
</span>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
{% block headings-container %}{{ block.super }}{% endblock %}
|
||||||
|
{% block content-container %}
|
||||||
|
<div class="media">
|
||||||
|
{% if object.cover %}
|
||||||
|
<a href="{{ object.get_absolute_url }}"
|
||||||
|
class="media-left preview-cover small"
|
||||||
|
style="background-image: url({{ object.cover.url }})">
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
<div class="media-content flex-column">
|
||||||
|
<section class="content flex-grow-1">
|
||||||
|
{% block content %}
|
||||||
|
{% if content and with_content %}
|
||||||
|
{% autoescape off %}
|
||||||
|
{{ content|striptags|linebreaks }}
|
||||||
|
{% endautoescape %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
</section>
|
||||||
|
{% block actions-container %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
23
aircox/templates/aircox/widgets/log.html
Normal file
23
aircox/templates/aircox/widgets/log.html
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{% load i18n aircox %}
|
||||||
|
{% comment %}
|
||||||
|
List item for a log, either for a logged track or diffusion (as diffusion).
|
||||||
|
|
||||||
|
Context objects:
|
||||||
|
- object: object to render
|
||||||
|
- hide_schedule: if true, hide the schedule
|
||||||
|
|
||||||
|
In case of modification, you might want to check on `assets/vue/player.vue`
|
||||||
|
for design review.
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
|
{% block outer %}
|
||||||
|
{% if object|is_diffusion %}
|
||||||
|
{% page_widget widget object.episode diffusion=object timetable=timetable|default:False %}
|
||||||
|
{% elif object|is_log %}
|
||||||
|
{% include "./track_item.html" with object=object.track log=object timetable=timetable|default:False %}
|
||||||
|
{% else %}
|
||||||
|
{% for obj in object %}
|
||||||
|
{% include "./track_item.html" with object=obj.track log=obj timetable=timetable|default:False %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
{% load i18n aircox %}
|
|
||||||
{% comment %}
|
|
||||||
List item for a log, either for a logged track or diffusion (as diffusion).
|
|
||||||
|
|
||||||
Context objects:
|
|
||||||
- object: object to render
|
|
||||||
- hide_schedule: if true, hide the schedule
|
|
||||||
|
|
||||||
In case of modification, you might want to check on `assets/vue/player.vue`
|
|
||||||
for design review.
|
|
||||||
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
{% if object|is_diffusion %}
|
|
||||||
{% with object as diffusion %}
|
|
||||||
{% include "aircox/widgets/diffusion_item.html" %}
|
|
||||||
{% endwith %}
|
|
||||||
{% else %}
|
|
||||||
{% with object.track as object %}
|
|
||||||
{% include "aircox/widgets/track_item.html" %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endif %}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
{% comment %}
|
|
||||||
Render list of logs (as widget).
|
|
||||||
|
|
||||||
Context:
|
|
||||||
- object_list: list of logs to display
|
|
||||||
- is_thin: if True, hide some information in order to fit in a thin container
|
|
||||||
{% endcomment %}
|
|
||||||
{% load aircox %}
|
|
||||||
|
|
||||||
{% with True as hide_schedule %}
|
|
||||||
<table class="table is-striped is-hoverable is-fullwidth" role="list">
|
|
||||||
{% for object in object_list %}
|
|
||||||
<tr {% if object|is_diffusion and object.is_now %}class="is-selected"{% endif %}>
|
|
||||||
<td>
|
|
||||||
{% if object|is_diffusion %}
|
|
||||||
<time datetime="{{ object.start }}" title="{{ object.start }}">
|
|
||||||
{{ object.start|date:"H:i" }}
|
|
||||||
{% if not is_thin %} - {{ object.end|date:"H:i" }}{% endif %}
|
|
||||||
</time>
|
|
||||||
{% else %}
|
|
||||||
<time datetime="{{ object.date }}" title="{{ object.date }}">
|
|
||||||
{{ object.date|date:"H:i" }}
|
|
||||||
</time>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>{% include "aircox/widgets/log_item.html" %}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
{% endwith %}
|
|
||||||
35
aircox/templates/aircox/widgets/logs.html
Normal file
35
aircox/templates/aircox/widgets/logs.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{% comment %}
|
||||||
|
Context:
|
||||||
|
- object_list: list of logs
|
||||||
|
- timetable: defaults to False
|
||||||
|
- widget: defaults to "item"
|
||||||
|
{% endcomment %}
|
||||||
|
{% load aircox %}
|
||||||
|
|
||||||
|
{% with timetable|default:False as timetable %}
|
||||||
|
{% with widget|default:"item" as widget %}
|
||||||
|
{% for object in object_list %}
|
||||||
|
{% if object.episode %}
|
||||||
|
{% page_widget widget object.episode diffusion=object timetable=True %}
|
||||||
|
{% elif object|is_log %}
|
||||||
|
{% include "./track_item.html" with object=object.track log=object timetable=True %}
|
||||||
|
{% else %}
|
||||||
|
<div class="preview list-item logs">
|
||||||
|
<header class="headings">
|
||||||
|
<span class="heading title">
|
||||||
|
<span class="icon pr-2">
|
||||||
|
<i class="fas fa-music"></i>
|
||||||
|
</span>
|
||||||
|
{{ station.music_stream_title }}
|
||||||
|
</span>
|
||||||
|
</header>
|
||||||
|
<div class="media d-block content">
|
||||||
|
{% for obj in object %}
|
||||||
|
{% include "./track_item.html" with object=obj.track log=obj timetable=True %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endwith %}
|
||||||
43
aircox/templates/aircox/widgets/page.html
Normal file
43
aircox/templates/aircox/widgets/page.html
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{% extends widget_template %}
|
||||||
|
{% load i18n aircox %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block outer %}
|
||||||
|
{% with cover|default:object.cover_url as cover %}
|
||||||
|
{% if admin %}
|
||||||
|
{% with object|admin_url:"change" as url %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endwith %}
|
||||||
|
{% else %}
|
||||||
|
{% with url|default:object.get_absolute_url as url %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endwith %}
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% if title %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% elif object %}
|
||||||
|
{{ object.display_title }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% if content %}
|
||||||
|
{{ content }}
|
||||||
|
{% elif object %}
|
||||||
|
{{ block.super }}
|
||||||
|
{{ object.display_headline }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block actions %}
|
||||||
|
{% if url and "card" not in widget_template %}
|
||||||
|
<a href="{{ url }}">{% translate "Show" %}</a>
|
||||||
|
{% endif %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endblock %}
|
||||||
13
aircox/templates/aircox/widgets/page_card.html
Normal file
13
aircox/templates/aircox/widgets/page_card.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{% extends widget|default:"./card.html" %}
|
||||||
|
|
||||||
|
{% block outer %}
|
||||||
|
{% if object %}
|
||||||
|
{% with content=object.get_display_excerpt() %}
|
||||||
|
{% with title=object.get_display_title() %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endwith %}
|
||||||
|
{% endwith %}
|
||||||
|
{% else %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@@ -3,3 +3,11 @@
|
|||||||
{% block card_title %}
|
{% block card_title %}
|
||||||
{% block title %}{{ block.super }}{% endblock %}
|
{% block title %}{{ block.super }}{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block card_subtitle %}
|
||||||
|
{% block subtitle %}{{ block.super }}{% endblock %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block card_class %}
|
||||||
|
{% block class %}{{ block.super }}{% endblock %}
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ Context:
|
|||||||
- object_list: object list
|
- object_list: object list
|
||||||
- list_url: url to complete list page
|
- list_url: url to complete list page
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
{% load i18n %}
|
{% load i18n aircox %}
|
||||||
|
|
||||||
{% for object in object_list %}
|
{% for object in object_list %}
|
||||||
{% include object.item_template_name %}
|
{% page_widget "item" object %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if list_url %}
|
{% if list_url %}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ The audio player
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="box is-fullwidth is-fixed-bottom is-paddingless player"
|
<div class="is-fullwidth is-fixed-bottom is-paddingless player-container"
|
||||||
role="{% translate "player" %}"
|
role="{% translate "player" %}"
|
||||||
aria-description="{% translate "Audio player used to listen to the radio and podcasts" %}">
|
aria-description="{% translate "Audio player used to listen to the radio and podcasts" %}">
|
||||||
<noscript>
|
<noscript>
|
||||||
@@ -22,24 +22,29 @@ The audio player
|
|||||||
:live-args="{% player_live_attr %}"
|
:live-args="{% player_live_attr %}"
|
||||||
button-title="{% translate "Play or pause audio" %}">
|
button-title="{% translate "Play or pause audio" %}">
|
||||||
<template v-slot:content="{ loaded, live, current }">
|
<template v-slot:content="{ loaded, live, current }">
|
||||||
<h4 v-if="loaded" class="title is-4">
|
<h4 v-if="loaded" class="title">
|
||||||
[[ loaded.name ]]
|
<a v-if="current?.data?.page_url" :href="current.data.page_url">
|
||||||
|
[[ loaded.name ]]
|
||||||
|
</a>
|
||||||
|
<template v-else>[[ loaded.name ]]</template>
|
||||||
</h4>
|
</h4>
|
||||||
<h4 v-else-if="current && current.data.type == 'track'"
|
<h4 v-else-if="current && current.data.type == 'track'"
|
||||||
class="title is-4" aria-description="{% translate "Track currently on air" %}">
|
class="title" aria-description="{% translate "Track currently on air" %}">
|
||||||
<span class="has-text-info is-size-3">♬</span>
|
<span class="icon hg-color-2 mr-3">
|
||||||
|
<i class="fas fa-music"></i>
|
||||||
|
</span>
|
||||||
<span>[[ current.data.title ]]</span>
|
<span>[[ current.data.title ]]</span>
|
||||||
<span class="has-text-grey-dark has-text-weight-light">
|
<span class="has-text-grey-dark has-text-weight-light">
|
||||||
— [[ current.data.artist ]]
|
— [[ current.data.artist ]]
|
||||||
<i v-if="current.data.info">([[ current.data.info ]])</i>
|
<i v-if="current.data.info">([[ current.data.info ]])</i>
|
||||||
</span>
|
</span>
|
||||||
</h4>
|
</h4>
|
||||||
<div v-else-if="live && current && current.data.type == 'diffusion'">
|
<h4 v-else-if="live && current && current.data.type == 'diffusion'"
|
||||||
<h4 class="title is-4" aria-description="{% translate "Diffusion currently on air" %}">
|
class="title"
|
||||||
<a :href="current.data.url">[[ current.data.title ]]</a>
|
aria-description="{% translate "Diffusion currently on air" %}">
|
||||||
|
<a :href="current.data.url" v-if="current.data.url">[[ current.data.title ]]</a>
|
||||||
|
<template v-else>[[ current.data.title ]]</template>
|
||||||
</h4>
|
</h4>
|
||||||
<div class="">[[ current.data.info ]]</div>
|
|
||||||
</div>
|
|
||||||
<h4 v-else class="title is-4" aria-description="{% translate "Currently playing" %}">
|
<h4 v-else class="title is-4" aria-description="{% translate "Currently playing" %}">
|
||||||
{{ request.station.name }}
|
{{ request.station.name }}
|
||||||
</h4>
|
</h4>
|
||||||
|
|||||||
59
aircox/templates/aircox/widgets/preview.html
Normal file
59
aircox/templates/aircox/widgets/preview.html
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
{% comment %}
|
||||||
|
Content related context:
|
||||||
|
- object: object to display
|
||||||
|
- cover: cover
|
||||||
|
- title: title
|
||||||
|
- subtitle: subtitle
|
||||||
|
- content: content to display
|
||||||
|
|
||||||
|
Styling related context:
|
||||||
|
- is_active: add "active" css class
|
||||||
|
- is_small: add "small" css class
|
||||||
|
- is_tiny: add "tiny" css class
|
||||||
|
- tag
|
||||||
|
- tag_class: css class to set to main tag
|
||||||
|
- tag_extra: extra tag attributes
|
||||||
|
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
|
{% block outer %}
|
||||||
|
<{{ tag|default:"article" }} class="preview {% if not cover %}no-cover {% endif %}{% if is_active %}active {% endif %}{% block tag-class %}{{ tag_class|default:"" }} {% endblock %}" {% block tag-extra %}{% endblock %}>
|
||||||
|
{% block inner %}
|
||||||
|
{% block headings-container %}
|
||||||
|
<header class="headings{% block headings-class %}{% endblock %}"{% block headings-tag-extra %}{% endblock %}>
|
||||||
|
{% block headings %}
|
||||||
|
{% block title-container %}
|
||||||
|
<a href="{{ url|escape }}" class="heading title {% block title-class %}{% endblock %}"{% if title %} title="{{ title|escape }}"{% endif %}>
|
||||||
|
{% block title %}{{ title|default:"" }}{% endblock %}
|
||||||
|
</a>
|
||||||
|
{% endblock %}
|
||||||
|
{% block subtitle-container %}
|
||||||
|
<span class="heading subtitle {% block subtitle-class %}{% endblock %}">
|
||||||
|
{% block subtitle %}{{ subtitle|default:"" }}{% endblock %}
|
||||||
|
</span>
|
||||||
|
{% endblock %}
|
||||||
|
{% endblock %}
|
||||||
|
</header>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content-container %}
|
||||||
|
<section class="content headings-container">
|
||||||
|
{% block content %}
|
||||||
|
{% if content and with_content %}
|
||||||
|
{% autoescape off %}
|
||||||
|
{{ content|striptags|linebreaks }}
|
||||||
|
{% endautoescape %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block actions-container %}
|
||||||
|
<div class="actions">
|
||||||
|
{% block actions %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% endblock %}
|
||||||
|
</{{ tag|default:"article" }}>
|
||||||
|
{% endblock %}
|
||||||
@@ -5,9 +5,20 @@ Context:
|
|||||||
- object: track to render
|
- object: track to render
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
<span class="has-text-info is-size-5">♬</span>
|
<span class="track">
|
||||||
<span>{{ object.title }}</span>
|
<span class="icon hg-color-2">
|
||||||
<span class="has-text-grey-dark has-text-weight-light">
|
<i class="fas fa-music"></i>
|
||||||
— {{ object.artist }}
|
</span>
|
||||||
{% if object.info %}(<i>{{ object.info }}</i>){% endif %}
|
<label>
|
||||||
|
{% if log %}
|
||||||
|
<span>{{ log.date|date:"H:i" }} — </span>
|
||||||
|
{% endif %}
|
||||||
|
<span class="has-text-weight-bold">{{ object.title }}</span>
|
||||||
|
{% if object.artist and object.artist != object.title %}
|
||||||
|
<span>
|
||||||
|
— {{ object.artist }}
|
||||||
|
{% if object.info %}(<i>{{ object.info }}</i>){% endif %}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
</label>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
43
aircox/templates/aircox/widgets/wide.html
Normal file
43
aircox/templates/aircox/widgets/wide.html
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{% extends "./preview.html" %}
|
||||||
|
{% load i18n aircox %}
|
||||||
|
|
||||||
|
{% block tag-class %}{{ block.super }} list-item wide is-fullwidth{% endblock %}
|
||||||
|
|
||||||
|
{% block headings %}
|
||||||
|
<a href="{{ url|escape }}" class="heading title {% block title-class %}{% endblock %}">
|
||||||
|
{% block title %}{{ title|default:"" }}{% endblock %}
|
||||||
|
</a>
|
||||||
|
<span class="heading subtitle {% block subtitle-class %}{% endblock %}">
|
||||||
|
{% block subtitle %}{{ subtitle|default:"" }}{% endblock %}
|
||||||
|
</span>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block inner %}
|
||||||
|
{% block content-container %}
|
||||||
|
<div class="media">
|
||||||
|
{% if object.cover %}
|
||||||
|
<a href="{{ object.get_absolute_url }}"
|
||||||
|
class="media-left preview-cover"
|
||||||
|
style="background-image: url({{ object.cover.url }})">
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
<div class="media-content">
|
||||||
|
{% block headings-container %}{{ block.super }}{% endblock %}
|
||||||
|
|
||||||
|
<section class="content">
|
||||||
|
{% block content %}
|
||||||
|
{% if content and with_content %}
|
||||||
|
{% autoescape off %}
|
||||||
|
{{ content|striptags|linebreaks }}
|
||||||
|
{% endautoescape %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{% block actions-container %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
18
aircox/templates/registration/login.html
Normal file
18
aircox/templates/registration/login.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{% extends "aircox/base.html" %}
|
||||||
|
{% load i18n aircox %}
|
||||||
|
|
||||||
|
{% block content-container %}
|
||||||
|
<div class="container content page-content">
|
||||||
|
<h2>{% trans "Log in" %}</h2>
|
||||||
|
<br/>
|
||||||
|
<form method="post" action="{% url 'login' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<table>
|
||||||
|
{{ form.as_table }}
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
<button class="button" type="submit">{% trans "Log in" %}</button>
|
||||||
|
<input type="hidden" name="next" value="{{ next }}">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -3,14 +3,41 @@ import random
|
|||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.contrib.admin.templatetags.admin_urls import admin_urlname
|
from django.contrib.admin.templatetags.admin_urls import admin_urlname
|
||||||
|
from django.template.loader import render_to_string
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from aircox.models import Diffusion, Log
|
from aircox.models import Diffusion, Log
|
||||||
|
|
||||||
|
|
||||||
random.seed()
|
random.seed()
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter(name="admin_url")
|
||||||
|
def admin_url(obj, action):
|
||||||
|
meta = obj._meta
|
||||||
|
return reverse(f"admin:{meta.app_label}_{meta.model_name}_{action}", args=[obj.id])
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag(name="page_widget", takes_context=True)
|
||||||
|
def do_page_widget(context, widget, object, dir="aircox/widgets", **ctx):
|
||||||
|
"""Render widget for the provided page and context."""
|
||||||
|
ctx["request"] = context["request"]
|
||||||
|
ctx["object"] = object
|
||||||
|
ctx["widget"] = widget
|
||||||
|
if object.pk and not ctx.get("tag_id"):
|
||||||
|
model = type(object)._meta.model_name
|
||||||
|
ctx["tag_id"] = f"{widget}_{model}_{object.pk}"
|
||||||
|
ctx["widget_template"] = f"{dir}/{widget}.html"
|
||||||
|
return render_to_string(object.get_template_name(widget), ctx)
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter(name="page_template")
|
||||||
|
def do_page_template(self, page, component):
|
||||||
|
"""For a provided page object and component name, return template name."""
|
||||||
|
return page.get_template(component)
|
||||||
|
|
||||||
|
|
||||||
@register.filter(name="admin_url")
|
@register.filter(name="admin_url")
|
||||||
def do_admin_url(obj, arg, pass_id=True):
|
def do_admin_url(obj, arg, pass_id=True):
|
||||||
"""Reverse admin url for object."""
|
"""Reverse admin url for object."""
|
||||||
@@ -30,11 +57,14 @@ def do_get_tracks(obj):
|
|||||||
|
|
||||||
|
|
||||||
@register.simple_tag(name="has_perm", takes_context=True)
|
@register.simple_tag(name="has_perm", takes_context=True)
|
||||||
def do_has_perm(context, obj, perm, user=None):
|
def do_has_perm(context, obj, perm, user=None, simple=False):
|
||||||
"""Return True if ``user.has_perm('[APP].[perm]_[MODEL]')``"""
|
"""Return True if ``user.has_perm('[APP].[perm]_[MODEL]')``"""
|
||||||
if user is None:
|
if user is None:
|
||||||
user = context["request"].user
|
user = context["request"].user
|
||||||
return user.has_perm("{}.{}_{}".format(obj._meta.app_label, perm, obj._meta.model_name))
|
if simple:
|
||||||
|
return user.has_perm("aircox.{}".format(perm)) or user.is_superuser
|
||||||
|
else:
|
||||||
|
return user.has_perm("{}.{}_{}".format(obj._meta.app_label, perm, obj._meta.model_name))
|
||||||
|
|
||||||
|
|
||||||
@register.filter(name="is_diffusion")
|
@register.filter(name="is_diffusion")
|
||||||
@@ -43,6 +73,12 @@ def do_is_diffusion(obj):
|
|||||||
return isinstance(obj, Diffusion)
|
return isinstance(obj, Diffusion)
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter(name="is_log")
|
||||||
|
def do_is_log(obj):
|
||||||
|
"""Return True if object is a Diffusion."""
|
||||||
|
return isinstance(obj, Log)
|
||||||
|
|
||||||
|
|
||||||
@register.filter(name="json")
|
@register.filter(name="json")
|
||||||
def do_json(obj, fields=""):
|
def do_json(obj, fields=""):
|
||||||
"""Return object as json."""
|
"""Return object as json."""
|
||||||
@@ -70,9 +106,19 @@ def do_nav_items(context, menu, **kwargs):
|
|||||||
return [(item, item.render(request, **kwargs)) for item in station.navitem_set.filter(menu=menu)]
|
return [(item, item.render(request, **kwargs)) for item in station.navitem_set.filter(menu=menu)]
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter(name="nav_active")
|
||||||
|
def do_nav_active(obj, request):
|
||||||
|
if request.path.startswith(obj.get_url()):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag(name="update_query")
|
@register.simple_tag(name="update_query")
|
||||||
def do_update_query(obj, **kwargs):
|
def do_update_query(obj, **kwargs):
|
||||||
"""Replace provided querydict's values with **kwargs."""
|
"""Replace provided querydict's values with **kwargs.
|
||||||
|
|
||||||
|
Values set to ``None`` will be dropped.
|
||||||
|
"""
|
||||||
for k, v in kwargs.items():
|
for k, v in kwargs.items():
|
||||||
if v is not None:
|
if v is not None:
|
||||||
obj[k] = list(v) if hasattr(v, "__iter__") else [v]
|
obj[k] = list(v) if hasattr(v, "__iter__") else [v]
|
||||||
@@ -85,4 +131,11 @@ def do_update_query(obj, **kwargs):
|
|||||||
def do_verbose_name(obj, plural=False):
|
def do_verbose_name(obj, plural=False):
|
||||||
"""Return model's verbose name (singular or plural) or `obj` if it is a
|
"""Return model's verbose name (singular or plural) or `obj` if it is a
|
||||||
string (can act for default values)."""
|
string (can act for default values)."""
|
||||||
return obj if isinstance(obj, str) else obj._meta.verbose_name_plural if plural else obj._meta.verbose_name
|
if isinstance(obj, str):
|
||||||
|
return obj
|
||||||
|
return obj._meta.verbose_name_plural if plural else obj._meta.verbose_name
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter(name="edit_view")
|
||||||
|
def do_edit_view(obj):
|
||||||
|
return "%s-edit" % obj.split("-")[0]
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from datetime import time, timedelta
|
from datetime import time, timedelta
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
@@ -157,3 +158,15 @@ def tracks(episode, sound):
|
|||||||
items += [baker.prepare(models.Track, sound=sound, position=i, timestamp=i * 60) for i in range(0, 3)]
|
items += [baker.prepare(models.Track, sound=sound, position=i, timestamp=i * 60) for i in range(0, 3)]
|
||||||
models.Track.objects.bulk_create(items)
|
models.Track.objects.bulk_create(items)
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def user():
|
||||||
|
return User.objects.create_user(username="user1", password="bar")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def png_content():
|
||||||
|
image_file = "{}/image.png".format(os.path.dirname(__file__))
|
||||||
|
with open(image_file, "rb") as fh:
|
||||||
|
return fh.read()
|
||||||
|
|||||||
BIN
aircox/tests/image.png
Normal file
BIN
aircox/tests/image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 B |
46
aircox/tests/test_permissions.py
Normal file
46
aircox/tests/test_permissions.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import pytest
|
||||||
|
from django.contrib.auth.models import User, Group
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db()
|
||||||
|
def test_no_admin(user, client):
|
||||||
|
client.force_login(user)
|
||||||
|
response = client.get("/admin/")
|
||||||
|
assert response.status_code != 200
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db()
|
||||||
|
def test_user_cannot_change_program_or_episode(user, client, program):
|
||||||
|
assert not user.has_perm("aircox.change_program")
|
||||||
|
assert not user.has_perm("aircox.change_episode")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db()
|
||||||
|
def test_group_can_change_program(user, client, program):
|
||||||
|
assert program.editors in Group.objects.all()
|
||||||
|
assert not user.has_perm("aircox.%s" % program.change_permission_codename)
|
||||||
|
user.groups.add(program.editors)
|
||||||
|
user = User.objects.get(pk=user.pk) # reload user in order to have permissions set
|
||||||
|
assert program.editors in user.groups.all()
|
||||||
|
assert user.has_perm("aircox.%s" % program.change_permission_codename)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db()
|
||||||
|
def test_group_change_program(user, client, program):
|
||||||
|
client.force_login(user)
|
||||||
|
response = client.get(reverse("program-edit", kwargs={"pk": program.pk}))
|
||||||
|
assert response.status_code == 403
|
||||||
|
user.groups.add(program.editors)
|
||||||
|
response = client.get(reverse("program-edit", kwargs={"pk": program.pk}))
|
||||||
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db()
|
||||||
|
def test_group_change_episode(user, client, program, episode):
|
||||||
|
client.force_login(user)
|
||||||
|
response = client.get(reverse("episode-edit", kwargs={"pk": episode.pk}))
|
||||||
|
assert response.status_code == 403
|
||||||
|
user.groups.add(program.editors)
|
||||||
|
response = client.get(reverse("episode-edit", kwargs={"pk": episode.pk}))
|
||||||
|
assert response.status_code == 200
|
||||||
22
aircox/tests/test_profile.py
Normal file
22
aircox/tests/test_profile.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import pytest
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db()
|
||||||
|
def test_authenticate(user, client, program):
|
||||||
|
r = client.get(reverse("login"))
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert b"id_username" in r.content
|
||||||
|
r = client.post(reverse("login"), kwargs={"username": "foo", "password": "bar"})
|
||||||
|
assert b"errorlist" in r.content
|
||||||
|
assert client.login(username="user1", password="bar")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db()
|
||||||
|
def test_profile_programs(user, client, program):
|
||||||
|
client.force_login(user)
|
||||||
|
r = client.get(reverse("profile"))
|
||||||
|
assert program.title not in r.content.decode("utf-8")
|
||||||
|
user.groups.add(program.editors)
|
||||||
|
r = client.get(reverse("profile"))
|
||||||
|
assert program.title in r.content.decode("utf-8")
|
||||||
67
aircox/tests/test_program.py
Normal file
67
aircox/tests/test_program.py
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
from itertools import chain
|
||||||
|
import json
|
||||||
|
import pytest
|
||||||
|
from django.urls import reverse
|
||||||
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
|
|
||||||
|
from aircox.models import Program
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db()
|
||||||
|
def test_edit_program(user, client, program):
|
||||||
|
client.force_login(user)
|
||||||
|
response = client.get(reverse("program-detail", kwargs={"slug": program.slug}))
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert "🖉 ".encode() not in response.content
|
||||||
|
user.groups.add(program.editors)
|
||||||
|
response = client.get(reverse("program-detail", kwargs={"slug": program.slug}))
|
||||||
|
assert "🖉 ".encode() in response.content
|
||||||
|
assert b"foobar" not in response.content
|
||||||
|
response = client.post(reverse("program-edit", kwargs={"pk": program.pk}), {"content": "foobar"})
|
||||||
|
response = client.get(reverse("program-detail", kwargs={"slug": program.slug}))
|
||||||
|
assert b"foobar" in response.content
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db()
|
||||||
|
def test_add_cover(user, client, program, png_content):
|
||||||
|
assert program.cover is None
|
||||||
|
user.groups.add(program.editors)
|
||||||
|
client.force_login(user)
|
||||||
|
cover = SimpleUploadedFile("cover1.png", png_content, content_type="image/png")
|
||||||
|
r = client.post(
|
||||||
|
reverse("program-edit", kwargs={"pk": program.pk}), {"content": "foobar", "new_cover": cover}, follow=True
|
||||||
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
p = Program.objects.get(pk=program.pk)
|
||||||
|
assert "cover1.png" in p.cover.url
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db()
|
||||||
|
def test_edit_tracklist(user, client, program, episode, tracks):
|
||||||
|
user.groups.add(program.editors)
|
||||||
|
client.force_login(user)
|
||||||
|
episode.status = 0x10 # published
|
||||||
|
episode.save()
|
||||||
|
r = client.get(reverse("program-detail", kwargs={"slug": episode.program.slug}))
|
||||||
|
assert r.status_code == 200
|
||||||
|
r = client.get(reverse("episode-detail", kwargs={"slug": episode.slug}))
|
||||||
|
assert r.status_code == 200
|
||||||
|
r2 = client.get(reverse("episode-edit", kwargs={"pk": episode.pk}))
|
||||||
|
assert r2.status_code == 200
|
||||||
|
|
||||||
|
tracklist = [t.id for t in episode.track_set.all().order_by("position")]
|
||||||
|
tracklist_details_reversed = [(t.id, t.artist, t.title) for t in episode.track_set.all().order_by("-position")]
|
||||||
|
tracklist_details_reversed = list(chain(*tracklist_details_reversed))
|
||||||
|
data = """{{"website": [""], "content": ["foobar"], "new_podcast": [""], "form-TOTAL_FORMS": ["3"],
|
||||||
|
"form-INITIAL_FORMS": ["3"], "form-MIN_NUM_FORMS": ["0"], "form-MAX_NUM_FORMS": ["1000"], "form-0-position": ["0"],
|
||||||
|
"form-0-id": ["{}"], "form-0-": ["", "", "", "", "", ""], "form-0-artist": ["{}"], "form-0-title": ["{}"],
|
||||||
|
"form-0-tags": [""], "form-0-album": [""], "form-0-year": [""], "form-1-position": ["1"], "form-1-id": ["{}"],
|
||||||
|
"form-1-": ["", "", "", "", "", ""], "form-1-artist": ["{}"], "form-1-title": ["{}"], "form-1-tags": [""],
|
||||||
|
"form-1-album": [""], "form-1-year": [""], "form-2-position": ["2"], "form-2-id": ["{}"], "form-2-": ["", "", "",
|
||||||
|
"", "", ""], "form-2-artist": ["{}"], "form-2-title": ["{}"], "form-2-tags": [""], "form-2-album": [""],
|
||||||
|
"form-2-year": [""]}}""".format(
|
||||||
|
*tracklist_details_reversed
|
||||||
|
)
|
||||||
|
r = client.post(reverse("episode-edit", kwargs={"pk": episode.pk}), json.loads(data), follow=True)
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert set(episode.track_set.all().values_list("id", flat=True)) == set(tracklist)
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django.urls import reverse
|
|
||||||
|
|
||||||
from aircox import models
|
from aircox import models
|
||||||
from aircox.test import Interface
|
from aircox.test import Interface
|
||||||
@@ -37,29 +36,13 @@ class TestBaseView:
|
|||||||
def test_station(self, base_view, station):
|
def test_station(self, base_view, station):
|
||||||
assert base_view.station == station
|
assert base_view.station == station
|
||||||
|
|
||||||
@pytest.mark.django_db
|
|
||||||
def test_get_sidebar_queryset(self, base_view, pages, published_pages):
|
|
||||||
query = base_view.get_sidebar_queryset().values_list("id", flat=True)
|
|
||||||
page_ids = {r.id for r in published_pages}
|
|
||||||
assert set(query) == page_ids
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
|
||||||
def test_get_sidebar_url(self, base_view):
|
|
||||||
assert base_view.get_sidebar_url() == reverse("page-list")
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_get_context_data(self, base_view, station, published_pages):
|
def test_get_context_data(self, base_view, station, published_pages):
|
||||||
base_view.has_sidebar = True
|
|
||||||
base_view.get_sidebar_queryset = lambda: published_pages
|
|
||||||
context = base_view.get_context_data()
|
context = base_view.get_context_data()
|
||||||
assert context == {
|
assert context == {
|
||||||
"view": base_view,
|
"view": base_view,
|
||||||
"station": station,
|
"station": station,
|
||||||
"page": None, # get_page() returns None
|
"page": None, # get_page() returns None
|
||||||
"has_sidebar": base_view.has_sidebar,
|
|
||||||
"has_filters": False,
|
|
||||||
"sidebar_object_list": published_pages[: base_view.list_count],
|
|
||||||
"sidebar_list_url": base_view.get_sidebar_url(),
|
|
||||||
"audio_streams": station.streams,
|
"audio_streams": station.streams,
|
||||||
"model": base_view.model,
|
"model": base_view.model,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,45 +38,40 @@ api = [
|
|||||||
urls = [
|
urls = [
|
||||||
path("", views.HomeView.as_view(), name="home"),
|
path("", views.HomeView.as_view(), name="home"),
|
||||||
path("api/", include((api, "aircox"), namespace="api")),
|
path("api/", include((api, "aircox"), namespace="api")),
|
||||||
# path('', views.PageDetailView.as_view(model=models.Article),
|
# ---- ---- objects views
|
||||||
# name='home'),
|
# ---- articles
|
||||||
|
path(
|
||||||
|
_("articles/<slug:slug>/"),
|
||||||
|
views.ArticleDetailView.as_view(),
|
||||||
|
name="article-detail",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
_("articles/"),
|
_("articles/"),
|
||||||
views.ArticleListView.as_view(model=models.Article),
|
views.ArticleListView.as_view(model=models.Article),
|
||||||
name="article-list",
|
name="article-list",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
_("articles/<slug:slug>/"),
|
_("articles/c/<slug:category_slug>/"),
|
||||||
views.ArticleDetailView.as_view(),
|
views.ArticleListView.as_view(model=models.Article),
|
||||||
name="article-detail",
|
name="article-list",
|
||||||
),
|
),
|
||||||
path(_("episodes/"), views.EpisodeListView.as_view(), name="episode-list"),
|
# ---- timetable
|
||||||
|
path(_("timetable/"), views.TimeTableView.as_view(), name="timetable-list"),
|
||||||
path(
|
path(
|
||||||
_("episodes/<slug:slug>/"),
|
_("timetable/<date:date>/"),
|
||||||
views.EpisodeDetailView.as_view(),
|
views.TimeTableView.as_view(),
|
||||||
name="episode-detail",
|
name="timetable-list",
|
||||||
),
|
),
|
||||||
path(_("week/"), views.DiffusionListView.as_view(), name="diffusion-list"),
|
# ---- pages
|
||||||
path(
|
|
||||||
_("week/<date:date>/"),
|
|
||||||
views.DiffusionListView.as_view(),
|
|
||||||
name="diffusion-list",
|
|
||||||
),
|
|
||||||
path(_("logs/"), views.LogListView.as_view(), name="log-list"),
|
|
||||||
path(_("logs/<date:date>/"), views.LogListView.as_view(), name="log-list"),
|
|
||||||
# path('<page_path:path>', views.route_page, name='page'),
|
|
||||||
path(
|
path(
|
||||||
_("publications/"),
|
_("publications/"),
|
||||||
views.PageListView.as_view(model=models.Page),
|
views.PageListView.as_view(model=models.Page, attach_to_value=models.StaticPage.Target.PAGES),
|
||||||
name="page-list",
|
name="page-list",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
_("pages/"),
|
_("publications/c/<slug:category_slug>"),
|
||||||
views.BasePageListView.as_view(
|
views.PageListView.as_view(model=models.Page, attach_to_value=models.StaticPage.Target.PAGES),
|
||||||
model=models.StaticPage,
|
name="page-list",
|
||||||
queryset=models.StaticPage.objects.filter(attach_to__isnull=True),
|
|
||||||
),
|
|
||||||
name="static-page-list",
|
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
_("pages/<slug:slug>/"),
|
_("pages/<slug:slug>/"),
|
||||||
@@ -86,30 +81,57 @@ urls = [
|
|||||||
),
|
),
|
||||||
name="static-page-detail",
|
name="static-page-detail",
|
||||||
),
|
),
|
||||||
path(_("programs/"), views.ProgramListView.as_view(), name="program-list"),
|
|
||||||
path(
|
path(
|
||||||
_("programs/<slug:slug>/"),
|
_("pages/"),
|
||||||
|
views.BasePageListView.as_view(
|
||||||
|
model=models.StaticPage,
|
||||||
|
queryset=models.StaticPage.objects.filter(attach_to__isnull=True),
|
||||||
|
),
|
||||||
|
name="static-page-list",
|
||||||
|
),
|
||||||
|
# ---- programs
|
||||||
|
path(_("programs/"), views.ProgramListView.as_view(), name="program-list"),
|
||||||
|
path(_("programs/c/<slug:category_slug>/"), views.ProgramListView.as_view(), name="program-list"),
|
||||||
|
path(
|
||||||
|
_("programs/<slug:slug>"),
|
||||||
views.ProgramDetailView.as_view(),
|
views.ProgramDetailView.as_view(),
|
||||||
name="program-detail",
|
name="program-detail",
|
||||||
),
|
),
|
||||||
|
path(_("programs/<slug:parent_slug>/articles"), views.ArticleListView.as_view(), name="article-list"),
|
||||||
|
path(_("programs/<slug:parent_slug>/podcasts"), views.PodcastListView.as_view(), name="podcast-list"),
|
||||||
|
path(_("programs/<slug:parent_slug>/episodes"), views.EpisodeListView.as_view(), name="episode-list"),
|
||||||
|
path(_("programs/<slug:parent_slug>/diffusions"), views.DiffusionListView.as_view(), name="diffusion-list"),
|
||||||
path(
|
path(
|
||||||
_("programs/<slug:parent_slug>/episodes/"),
|
_("programs/<slug:parent_slug>/publications"),
|
||||||
views.EpisodeListView.as_view(),
|
views.PageListView.as_view(model=models.Page, attach_to_value=models.StaticPage.Target.PAGES),
|
||||||
name="episode-list",
|
name="page-list",
|
||||||
|
),
|
||||||
|
# ---- episodes
|
||||||
|
path(_("programs/episodes/"), views.EpisodeListView.as_view(), name="episode-list"),
|
||||||
|
path(_("programs/episodes/c/<slug:category_slug>"), views.EpisodeListView.as_view(), name="episode-list"),
|
||||||
|
path(
|
||||||
|
_("programs/episodes/<slug:slug>"),
|
||||||
|
views.EpisodeDetailView.as_view(),
|
||||||
|
name="episode-detail",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
_("programs/<slug:parent_slug>/articles/"),
|
_("programs/episodes/<pk>/edit/"),
|
||||||
views.ArticleListView.as_view(),
|
views.EpisodeUpdateView.as_view(),
|
||||||
name="article-list",
|
name="episode-edit",
|
||||||
),
|
),
|
||||||
|
path(_("podcasts/"), views.PodcastListView.as_view(), name="podcast-list"),
|
||||||
|
path(_("podcasts/c/<slug:category_slug>/"), views.PodcastListView.as_view(), name="podcast-list"),
|
||||||
|
# ---- others
|
||||||
path(
|
path(
|
||||||
_("programs/<slug:parent_slug>/publications/"),
|
_("program/<pk>/edit/"),
|
||||||
views.ProgramPageListView.as_view(),
|
views.ProgramUpdateView.as_view(),
|
||||||
name="program-page-list",
|
name="program-edit",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"errors/no-station",
|
"errors/no-station",
|
||||||
views.errors.NoStationErrorView.as_view(),
|
views.errors.NoStationErrorView.as_view(),
|
||||||
name="errors-no-station",
|
name="errors-no-station",
|
||||||
),
|
),
|
||||||
|
path("gestion/", views.ProfileView.as_view(), name="profile"),
|
||||||
|
path("accounts/profile/", views.ProfileView.as_view(), name="profile"),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
from . import admin, errors
|
from . import admin, errors
|
||||||
from .article import ArticleDetailView, ArticleListView
|
from .article import ArticleDetailView, ArticleListView
|
||||||
from .base import BaseAPIView, BaseView
|
from .base import BaseAPIView, BaseView
|
||||||
from .diffusion import DiffusionListView
|
from .diffusion import DiffusionListView, TimeTableView
|
||||||
from .episode import EpisodeDetailView, EpisodeListView
|
from .episode import EpisodeDetailView, EpisodeListView, PodcastListView, EpisodeUpdateView
|
||||||
from .home import HomeView
|
from .home import HomeView
|
||||||
from .log import LogListAPIView, LogListView
|
from .log import LogListAPIView, LogListView
|
||||||
from .page import (
|
from .page import (
|
||||||
@@ -11,11 +11,13 @@ from .page import (
|
|||||||
PageDetailView,
|
PageDetailView,
|
||||||
PageListView,
|
PageListView,
|
||||||
)
|
)
|
||||||
|
from .profile import ProfileView
|
||||||
from .program import (
|
from .program import (
|
||||||
ProgramDetailView,
|
ProgramDetailView,
|
||||||
ProgramListView,
|
ProgramListView,
|
||||||
ProgramPageDetailView,
|
ProgramPageDetailView,
|
||||||
ProgramPageListView,
|
ProgramPageListView,
|
||||||
|
ProgramUpdateView,
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
@@ -26,8 +28,11 @@ __all__ = (
|
|||||||
"BaseAPIView",
|
"BaseAPIView",
|
||||||
"BaseView",
|
"BaseView",
|
||||||
"DiffusionListView",
|
"DiffusionListView",
|
||||||
|
"TimeTableView",
|
||||||
"EpisodeDetailView",
|
"EpisodeDetailView",
|
||||||
"EpisodeListView",
|
"EpisodeListView",
|
||||||
|
"PodcastListView",
|
||||||
|
"EpisodeUpdateView",
|
||||||
"HomeView",
|
"HomeView",
|
||||||
"LogListAPIView",
|
"LogListAPIView",
|
||||||
"LogListView",
|
"LogListView",
|
||||||
@@ -35,8 +40,21 @@ __all__ = (
|
|||||||
"BasePageListView",
|
"BasePageListView",
|
||||||
"PageDetailView",
|
"PageDetailView",
|
||||||
"PageListView",
|
"PageListView",
|
||||||
|
"ProfileView",
|
||||||
"ProgramDetailView",
|
"ProgramDetailView",
|
||||||
"ProgramListView",
|
"ProgramListView",
|
||||||
"ProgramPageDetailView",
|
"ProgramPageDetailView",
|
||||||
"ProgramPageListView",
|
"ProgramPageListView",
|
||||||
|
"ProgramUpdateView",
|
||||||
|
"attached",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
attached = {}
|
||||||
|
|
||||||
|
for key in __all__:
|
||||||
|
view = globals().get(key)
|
||||||
|
if key == "attached":
|
||||||
|
continue
|
||||||
|
if attach := getattr(view, "attach_to_value", None):
|
||||||
|
attached[attach] = view
|
||||||
|
|||||||
@@ -5,16 +5,10 @@ __all__ = ["ArticleDetailView", "ArticleListView"]
|
|||||||
|
|
||||||
|
|
||||||
class ArticleDetailView(PageDetailView):
|
class ArticleDetailView(PageDetailView):
|
||||||
has_sidebar = True
|
|
||||||
model = Article
|
model = Article
|
||||||
|
|
||||||
def get_sidebar_queryset(self):
|
|
||||||
qs = Article.objects.published().select_related("cover").order_by("-pub_date")
|
|
||||||
return qs
|
|
||||||
|
|
||||||
|
|
||||||
class ArticleListView(PageListView):
|
class ArticleListView(PageListView):
|
||||||
model = Article
|
model = Article
|
||||||
has_headline = True
|
|
||||||
parent_model = Program
|
parent_model = Program
|
||||||
attach_to_value = StaticPage.ATTACH_TO_ARTICLES
|
attach_to_value = StaticPage.Target.ARTICLES
|
||||||
|
|||||||
@@ -2,18 +2,14 @@ from django.http import HttpResponseRedirect
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin
|
from django.views.generic.base import ContextMixin, TemplateResponseMixin
|
||||||
|
|
||||||
from ..models import Page
|
|
||||||
|
|
||||||
__all__ = ("BaseView", "BaseAPIView")
|
__all__ = ("BaseView", "BaseAPIView")
|
||||||
|
|
||||||
|
|
||||||
class BaseView(TemplateResponseMixin, ContextMixin):
|
class BaseView(TemplateResponseMixin, ContextMixin):
|
||||||
has_sidebar = True
|
header_template_name = "aircox/widgets/header.html"
|
||||||
"""Show side navigation."""
|
related_count = 4
|
||||||
has_filters = False
|
related_carousel_count = 8
|
||||||
"""Show filters nav."""
|
|
||||||
list_count = 5
|
|
||||||
"""Item count for small lists displayed on page."""
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def station(self):
|
def station(self):
|
||||||
@@ -22,35 +18,52 @@ class BaseView(TemplateResponseMixin, ContextMixin):
|
|||||||
# def get_queryset(self):
|
# def get_queryset(self):
|
||||||
# return super().get_queryset().station(self.station)
|
# return super().get_queryset().station(self.station)
|
||||||
|
|
||||||
def get_sidebar_queryset(self):
|
def get_nav_menu(self):
|
||||||
"""Return a queryset of items to render on the side nav."""
|
menu = []
|
||||||
return Page.objects.select_subclasses().published().order_by("-pub_date")
|
for item in self.station.navitem_set.all():
|
||||||
|
try:
|
||||||
|
if item.page:
|
||||||
|
view = item.page.get_related_view()
|
||||||
|
secondary = view and view.get_secondary_nav()
|
||||||
|
else:
|
||||||
|
secondary = None
|
||||||
|
menu.append((item, secondary))
|
||||||
|
except:
|
||||||
|
import traceback
|
||||||
|
|
||||||
def get_sidebar_url(self):
|
traceback.print_exc()
|
||||||
return reverse("page-list")
|
raise
|
||||||
|
return menu
|
||||||
|
|
||||||
|
def get_secondary_nav(self):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_related_queryset(self):
|
||||||
|
"""Return a queryset of related pages or None."""
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_related_url(self):
|
||||||
|
"""Return an url to the list of related pages."""
|
||||||
|
return None
|
||||||
|
|
||||||
def get_page(self):
|
def get_page(self):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs.setdefault("station", self.station)
|
|
||||||
kwargs.setdefault("page", self.get_page())
|
kwargs.setdefault("page", self.get_page())
|
||||||
kwargs.setdefault("has_filters", self.has_filters)
|
kwargs.setdefault("header_template_name", self.header_template_name)
|
||||||
|
|
||||||
has_sidebar = kwargs.setdefault("has_sidebar", self.has_sidebar)
|
|
||||||
if has_sidebar and "sidebar_object_list" not in kwargs:
|
|
||||||
sidebar_object_list = self.get_sidebar_queryset()
|
|
||||||
if sidebar_object_list is not None:
|
|
||||||
kwargs["sidebar_object_list"] = sidebar_object_list[: self.list_count]
|
|
||||||
kwargs["sidebar_list_url"] = self.get_sidebar_url()
|
|
||||||
|
|
||||||
if "audio_streams" not in kwargs:
|
|
||||||
kwargs["audio_streams"] = self.station.streams
|
|
||||||
|
|
||||||
if "model" not in kwargs:
|
if "model" not in kwargs:
|
||||||
model = getattr(self, "model", None) or hasattr(self, "object") and type(self.object)
|
model = getattr(self, "model", None) or hasattr(self, "object") and type(self.object)
|
||||||
kwargs["model"] = model
|
kwargs["model"] = model
|
||||||
|
|
||||||
|
page = kwargs.get("page")
|
||||||
|
if page:
|
||||||
|
kwargs["title"] = page.display_title
|
||||||
|
kwargs["cover"] = page.cover and page.cover.url
|
||||||
|
|
||||||
|
if "nav_menu" not in kwargs:
|
||||||
|
kwargs["nav_menu"] = self.get_nav_menu()
|
||||||
return super().get_context_data(**kwargs)
|
return super().get_context_data(**kwargs)
|
||||||
|
|
||||||
def dispatch(self, *args, **kwargs):
|
def dispatch(self, *args, **kwargs):
|
||||||
|
|||||||
@@ -1,30 +1,55 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
from django.urls import reverse
|
||||||
from django.views.generic import ListView
|
from django.views.generic import ListView
|
||||||
|
|
||||||
from aircox.models import Diffusion, StaticPage
|
from aircox.models import Diffusion, Log, StaticPage
|
||||||
from .base import BaseView
|
from .base import BaseView
|
||||||
from .mixins import AttachedToMixin, GetDateMixin
|
from .mixins import AttachedToMixin, GetDateMixin
|
||||||
|
|
||||||
__all__ = ("DiffusionListView",)
|
__all__ = ("DiffusionListView", "TimeTableView")
|
||||||
|
|
||||||
|
|
||||||
class DiffusionListView(GetDateMixin, AttachedToMixin, BaseView, ListView):
|
class BaseDiffusionListView(AttachedToMixin, BaseView, ListView):
|
||||||
|
model = Diffusion
|
||||||
|
queryset = Diffusion.objects.on_air().order_by("-start")
|
||||||
|
|
||||||
|
|
||||||
|
class DiffusionListView(BaseDiffusionListView):
|
||||||
"""View for timetables."""
|
"""View for timetables."""
|
||||||
|
|
||||||
model = Diffusion
|
model = Diffusion
|
||||||
has_filters = True
|
|
||||||
redirect_date_url = "diffusion-list"
|
|
||||||
attach_to_value = StaticPage.ATTACH_TO_DIFFUSIONS
|
class TimeTableView(GetDateMixin, BaseDiffusionListView):
|
||||||
|
model = Diffusion
|
||||||
|
redirect_date_url = "timetable-list"
|
||||||
|
attach_to_value = StaticPage.Target.TIMETABLE
|
||||||
|
template_name = "aircox/timetable_list.html"
|
||||||
|
|
||||||
def get_date(self):
|
def get_date(self):
|
||||||
date = super().get_date()
|
date = super().get_date()
|
||||||
return date if date is not None else datetime.date.today()
|
return date if date is not None else datetime.date.today()
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_logs(self, date):
|
||||||
return super().get_queryset().date(self.date).order_by("start")
|
return Log.objects.on_air().date(self.date).filter(track__isnull=False)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_queryset(self):
|
||||||
|
return super().get_queryset().date(self.date)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_secondary_nav(cls):
|
||||||
|
date = datetime.date.today()
|
||||||
|
start = date - datetime.timedelta(days=date.weekday())
|
||||||
|
dates = [start + datetime.timedelta(days=i) for i in range(0, 7)]
|
||||||
|
return tuple((date.strftime("%A %d"), reverse("timetable-list", kwargs={"date": date})) for date in dates)
|
||||||
|
|
||||||
|
def get_context_data(self, object_list=None, **kwargs):
|
||||||
start = self.date - datetime.timedelta(days=self.date.weekday())
|
start = self.date - datetime.timedelta(days=self.date.weekday())
|
||||||
dates = [start + datetime.timedelta(days=i) for i in range(0, 7)]
|
dates = [start + datetime.timedelta(days=i) for i in range(0, 7)]
|
||||||
return super().get_context_data(date=self.date, dates=dates, **kwargs)
|
|
||||||
|
if object_list is None:
|
||||||
|
logs = self.get_logs(self.date)
|
||||||
|
object_list = Log.merge_diffusions(logs, self.object_list, group_logs=True)
|
||||||
|
object_list = list(reversed(object_list))
|
||||||
|
return super().get_context_data(date=self.date, dates=dates, object_list=object_list, **kwargs)
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
|
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||||
|
from django.forms.models import modelformset_factory
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
from aircox.forms import EpisodeForm
|
||||||
|
from aircox.models import Episode, Program, StaticPage, Track
|
||||||
from ..filters import EpisodeFilters
|
from ..filters import EpisodeFilters
|
||||||
from ..models import Episode, Program, StaticPage
|
|
||||||
from .page import PageListView
|
from .page import PageListView
|
||||||
from .program import ProgramPageDetailView
|
from .program import ProgramPageDetailView, BaseProgramMixin
|
||||||
|
from .page import PageUpdateView
|
||||||
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
"EpisodeDetailView",
|
"EpisodeDetailView",
|
||||||
"EpisodeListView",
|
"EpisodeListView",
|
||||||
|
"PodcastListView",
|
||||||
|
"EpisodeUpdateView",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -17,11 +26,62 @@ class EpisodeDetailView(ProgramPageDetailView):
|
|||||||
kwargs["tracks"] = self.object.track_set.order_by("position")
|
kwargs["tracks"] = self.object.track_set.order_by("position")
|
||||||
return super().get_context_data(**kwargs)
|
return super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
def get_related_queryset(self):
|
||||||
|
return (
|
||||||
|
self.get_queryset().parent(self.object.parent).exclude(pk=self.object.pk).published().order_by("-pub_date")
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_related_url(self):
|
||||||
|
return reverse("episode-list", kwargs={"parent_slug": self.object.parent.slug})
|
||||||
|
|
||||||
|
|
||||||
class EpisodeListView(PageListView):
|
class EpisodeListView(PageListView):
|
||||||
model = Episode
|
model = Episode
|
||||||
filterset_class = EpisodeFilters
|
filterset_class = EpisodeFilters
|
||||||
item_template_name = "aircox/widgets/episode_item.html"
|
|
||||||
has_headline = True
|
|
||||||
parent_model = Program
|
parent_model = Program
|
||||||
attach_to_value = StaticPage.ATTACH_TO_EPISODES
|
attach_to_value = StaticPage.Target.EPISODES
|
||||||
|
|
||||||
|
|
||||||
|
class PodcastListView(EpisodeListView):
|
||||||
|
attach_to_value = StaticPage.Target.PODCASTS
|
||||||
|
queryset = Episode.objects.published().with_podcasts().order_by("-pub_date")
|
||||||
|
|
||||||
|
|
||||||
|
class EpisodeUpdateView(UserPassesTestMixin, BaseProgramMixin, PageUpdateView):
|
||||||
|
model = Episode
|
||||||
|
form_class = EpisodeForm
|
||||||
|
template_name = "aircox/episode_form.html"
|
||||||
|
|
||||||
|
def get_sidebar_queryset(self):
|
||||||
|
return super().get_sidebar_queryset().filter(parent=self.program)
|
||||||
|
|
||||||
|
def test_func(self):
|
||||||
|
program = self.get_object().program
|
||||||
|
return self.request.user.has_perm("aircox.%s" % program.change_permission_codename)
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse("episode-detail", kwargs={"slug": self.get_object().slug})
|
||||||
|
|
||||||
|
def get_object(self, queryset=None):
|
||||||
|
obj = Episode.objects.get(pk=self.kwargs["pk"])
|
||||||
|
return obj
|
||||||
|
|
||||||
|
def get_formset(self, *args, **kwargs):
|
||||||
|
fields = ("position", "artist", "title", "tags", "album", "year", "info")
|
||||||
|
TrackFormSet = modelformset_factory(Track, fields=fields, extra=0)
|
||||||
|
return TrackFormSet(*args, **kwargs)
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
context["fields"] = ("position", "artist", "title", "tags", "album", "year", "info")
|
||||||
|
context["formset"] = self.get_formset(queryset=Track.objects.filter(episode=self.object))
|
||||||
|
return context
|
||||||
|
|
||||||
|
def post(self, request, *args, **kwargs):
|
||||||
|
super().post(request, *args, **kwargs)
|
||||||
|
formset = self.get_formset(request.POST)
|
||||||
|
if formset.is_valid():
|
||||||
|
formset.save()
|
||||||
|
return super().form_valid(formset)
|
||||||
|
else:
|
||||||
|
return super().form_valid(formset) # form_invalid(formset)
|
||||||
|
|||||||
@@ -1,43 +1,56 @@
|
|||||||
from datetime import date
|
from datetime import date, datetime, timedelta
|
||||||
|
|
||||||
from django.utils import timezone as tz
|
from django.utils import timezone as tz
|
||||||
from django.views.generic import ListView
|
from django.views.generic import ListView
|
||||||
|
|
||||||
from ..models import Diffusion, Log, Page, StaticPage
|
from ..models import Diffusion, Episode, Log, Page, StaticPage
|
||||||
from .base import BaseView
|
from .base import BaseView
|
||||||
|
from .mixins import AttachedToMixin
|
||||||
|
|
||||||
|
|
||||||
class HomeView(BaseView, ListView):
|
class HomeView(AttachedToMixin, BaseView, ListView):
|
||||||
template_name = "aircox/home.html"
|
template_name = "aircox/home.html"
|
||||||
|
attach_to_value = StaticPage.Target.HOME
|
||||||
model = Diffusion
|
model = Diffusion
|
||||||
attach_to_value = StaticPage.ATTACH_TO_HOME
|
queryset = Diffusion.objects.on_air().select_related("episode").order_by("-start")
|
||||||
queryset = Diffusion.objects.on_air().select_related("episode")
|
|
||||||
logs_count = 5
|
publications_queryset = Page.objects.select_subclasses().published().order_by("-pub_date")
|
||||||
publications_count = 5
|
podcasts_queryset = Episode.objects.published().with_podcasts().order_by("-pub_date")
|
||||||
has_filters = False
|
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return super().get_queryset().date(date.today())
|
now = datetime.now()
|
||||||
|
return super().get_queryset().after(now - timedelta(hours=24)).before(now).order_by("-start")
|
||||||
|
|
||||||
def get_logs(self, diffusions):
|
def get_logs(self, diffusions):
|
||||||
today = date.today()
|
today = date.today()
|
||||||
logs = Log.objects.on_air().date(today).filter(track__isnull=False)
|
now = datetime.now()
|
||||||
# diffs = Diffusion.objects.on_air().date(today)
|
# diffs = Diffusion.objects.on_air().date(today)
|
||||||
return Log.merge_diffusions(logs, diffusions, self.logs_count)
|
object_list = self.object_list
|
||||||
|
diffs = list(object_list[: self.related_count])
|
||||||
|
logs = Log.objects.on_air().filter(track__isnull=False, date__lte=now)
|
||||||
|
if diffs:
|
||||||
|
min_date = diffs[-1].start - timedelta(hours=1)
|
||||||
|
logs = logs.after(min_date)
|
||||||
|
else:
|
||||||
|
logs = logs.date(today)
|
||||||
|
return Log.merge_diffusions(
|
||||||
|
logs, object_list, diff_count=self.related_count, count=self.related_count + 2, group_logs=True
|
||||||
|
)
|
||||||
|
|
||||||
def get_next_diffs(self):
|
def get_next_diffs(self):
|
||||||
now = tz.now()
|
now = tz.now()
|
||||||
current_diff = Diffusion.objects.on_air().now(now).first()
|
query = Diffusion.objects.on_air().select_related("episode")
|
||||||
next_diffs = Diffusion.objects.on_air().after(now)
|
current_diff = query.now(now).first()
|
||||||
|
next_diffs = query.after(now)
|
||||||
if current_diff:
|
if current_diff:
|
||||||
diffs = [current_diff] + list(next_diffs.exclude(pk=current_diff.pk)[:2])
|
diffs = [current_diff] + list(next_diffs.exclude(pk=current_diff.pk)[:9])
|
||||||
else:
|
else:
|
||||||
diffs = next_diffs[:3]
|
diffs = next_diffs[: self.related_carousel_count]
|
||||||
return diffs
|
return diffs
|
||||||
|
|
||||||
def get_last_publications(self):
|
def get_publications(self):
|
||||||
# note: with postgres db, possible to use distinct()
|
# note: with postgres db, possible to use distinct()
|
||||||
qs = Page.objects.select_subclasses().published().order_by("-pub_date")
|
qs = self.publications_queryset.all()
|
||||||
parents = set()
|
parents = set()
|
||||||
items = []
|
items = []
|
||||||
for publication in qs:
|
for publication in qs:
|
||||||
@@ -45,13 +58,25 @@ class HomeView(BaseView, ListView):
|
|||||||
if parent_id is not None and parent_id in parents:
|
if parent_id is not None and parent_id in parents:
|
||||||
continue
|
continue
|
||||||
items.append(publication)
|
items.append(publication)
|
||||||
if len(items) == self.publications_count:
|
if len(items) == self.related_count:
|
||||||
break
|
break
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
def get_podcasts(self):
|
||||||
|
return self.podcasts_queryset.all()[: self.related_carousel_count]
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
next_diffs = self.get_next_diffs()
|
||||||
context["logs"] = self.get_logs(context["object_list"])
|
current_diff = next_diffs and next_diffs[0]
|
||||||
context["next_diffs"] = self.get_next_diffs()
|
|
||||||
context["last_publications"] = self.get_last_publications()[:5]
|
kwargs.update(
|
||||||
return context
|
{
|
||||||
|
"object": current_diff.episode,
|
||||||
|
"diffusion": current_diff,
|
||||||
|
"logs": self.get_logs(self.object_list),
|
||||||
|
"next_diffs": next_diffs,
|
||||||
|
"publications": self.get_publications(),
|
||||||
|
"podcasts": self.get_podcasts(),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return super().get_context_data(**kwargs)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user