diff --git a/cms/models.py b/cms/models.py
index a97b43b..6ded6dc 100644
--- a/cms/models.py
+++ b/cms/models.py
@@ -317,6 +317,7 @@ class RelatedMeta (models.base.ModelBase):
elif rel.auto_create(instance) if callable(rel.auto_create) else \
rel.auto_create:
post = model(related = instance)
+ # TODO: hackish way: model.objects.filter(related=null,...).delete()
else:
return
post.rel_to_post()
@@ -325,7 +326,6 @@ class RelatedMeta (models.base.ModelBase):
post_save.connect(handler_rel, model._relation.model, False)
def __new__ (cl, name, bases, attrs):
- # TODO: allow proxy models and better inheritance
# TODO: check bindings
if name == 'RelatedPost':
return super().__new__(cl, name, bases, attrs)
@@ -348,7 +348,6 @@ class RelatedMeta (models.base.ModelBase):
name = rel.model._meta.object_name
if name == model._meta.object_name:
model._meta.default_related_name = '{} Post'.format(name)
-
return model
@@ -401,7 +400,7 @@ class RelatedPost (Post, metaclass = RelatedMeta):
bindings = None
"""
dict of `post_attr: rel_attr` that represent bindings of values
- between the post and the related object. Field are updated according
+ between the post and the related object. Fields are updated according
to `post_to_rel` and `rel_to_post`.
If there is a post_attr "thread", the corresponding rel_attr is used
@@ -413,6 +412,11 @@ class RelatedPost (Post, metaclass = RelatedMeta):
note: bound values can be any value, not only Django field.
"""
+ defaults = None
+ """
+ dict of `post_attr: value` that gives default value for the given
+ fields.
+ """
post_to_rel = False
"""
update related object when the post is saved, using bindings
@@ -474,7 +478,6 @@ class RelatedPost (Post, metaclass = RelatedMeta):
if save:
self.related.save()
-
def rel_to_post(self, save = True):
"""
Change the post using the related object bound values. Save the
@@ -508,13 +511,6 @@ class RelatedPost (Post, metaclass = RelatedMeta):
if has_changed and save:
self.save()
- def __init__ (self, *kargs, **kwargs):
- super().__init__(*kargs, **kwargs)
- # we use this method for sync, in order to avoid intrusive code on other
- # applications, e.g. using signals.
- if self.pk and self._relation.rel_to_post:
- self.rel_to_post(False)
-
def save (self, avoid_sync = False, save = True, *args, **kwargs):
"""
* avoid_sync: do not synchronise the post/related object;
diff --git a/cms/sections.py b/cms/sections.py
index 160be3f..7f1a78c 100644
--- a/cms/sections.py
+++ b/cms/sections.py
@@ -288,9 +288,6 @@ class List(Section):
"""
Prepare objects before context is sent to the template renderer.
Return the object_list that is prepared.
-
- Remember: since we are in a rendering process, the items should
- not be saved.
"""
return object_list
diff --git a/cms/templates/aircox/cms/list.html b/cms/templates/aircox/cms/list.html
index 8ce2d98..864de04 100644
--- a/cms/templates/aircox/cms/list.html
+++ b/cms/templates/aircox/cms/list.html
@@ -7,7 +7,7 @@
{% block content %}
-{% for item in object_list %}
+{% for object in object_list %}
{% include "aircox/cms/list_item.html" %}
{% empty %}
diff --git a/notes.md b/notes.md
index 24b2d52..672ccc2 100644
--- a/notes.md
+++ b/notes.md
@@ -2,12 +2,18 @@
- logs: archive functionnality + track stats for diffusions
- debug/prod configuration
+# TODO ajd
+- website/sections Diffusions/prepare\_object\_list -> sounds
+- players' buttons
+
+
# TODO:
- general:
- timezone shit
- translation
- programs:
+ - schedule changes -> update later diffusions according to the new schedule
- tests:
- sound_monitor
@@ -26,13 +32,11 @@
- cms.exposure; make it right, see nomenclature, + docstring
- admin cms
- sections:
+ - calendar title update
- article list with the focus
-> set html attribute based on values that are public
- website:
- - diff post init:
- - strftime on title
- - image?
- render schedule does not get the correct list
- diffusions:
- filter sounds for undiffused diffusions
@@ -44,6 +48,3 @@
- seek bar
- list of played diffusions and tracks when non-stop;
-
-
-
diff --git a/website/sections.py b/website/sections.py
index 1155cee..19167ca 100644
--- a/website/sections.py
+++ b/website/sections.py
@@ -101,10 +101,12 @@ class Diffusions(sections.List):
def prepare_object_list(self, object_list):
"""
- This function just prepare the list of object, in order to have a good
- title
+ This function just prepare the list of object, in order to:
+ - have a good title
+ - given a stream to listen to if needed
"""
for post in object_list:
+ # title
if not hasattr(post, 'related') or \
not hasattr(post.related , 'program'):
continue
@@ -113,6 +115,7 @@ class Diffusions(sections.List):
post.title = ': ' + post.title if post.title else \
' // ' + post.related.start.strftime('%A %d %B')
post.title = name + post.title
+ # sounds
return object_list
def get_object_list(self):