Removed commented property from comment model.
scope_path is set to the commented Work anyway and back references don't work. This means we can also comment on any other linkable.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- a/app/soc/models/comment.py Fri Mar 06 15:23:22 2009 +0000
+++ b/app/soc/models/comment.py Fri Mar 06 15:52:12 2009 +0000
@@ -41,13 +41,6 @@
commented on.
"""
- #: A required many:1 relationship with a Work, where the comment entity
- #: provides additional textual information about the commented work.
- #: There is a backreference in Work called comments, which is a db.Query
- #: instance
- commented = db.ReferenceProperty(reference_class=soc.models.work.Work,
- required=False, collection_name="comments")
-
#: A required many:1 relationship with a comment entity indicating
#: the user who provided that comment. There is a backreference in Work
#: called comments, which is a db.Query instance.
--- a/app/soc/models/work.py Fri Mar 06 15:23:22 2009 +0000
+++ b/app/soc/models/work.py Fri Mar 06 15:52:12 2009 +0000
@@ -39,10 +39,6 @@
reviews) a 1:many relationship between a Work and the zero or more
Reviews of that Work. This relation is implemented as the 'reviews'
back-reference Query of the Review model 'reviewed' reference.
-
- comments) a 1:many relationship between a work and zero or more comments
- about that work. This is implemented as the 'comments' back-reference
- of the Comment.commented reference property.
"""
#: Required 1:1 relationship indicating the User who initially authored the
--- a/app/soc/views/models/comment.py Fri Mar 06 15:23:22 2009 +0000
+++ b/app/soc/views/models/comment.py Fri Mar 06 15:52:12 2009 +0000
@@ -91,7 +91,7 @@
widget=helper.widgets.TinyMCE(attrs={'rows':10, 'cols':40})),
'scope_path': forms.CharField(widget=forms.HiddenInput, required=True),
}
- new_params['extra_dynaexclude'] = ['author', 'commented', 'link_id', 'modified_by']
+ new_params['extra_dynaexclude'] = ['author', 'link_id', 'modified_by']
new_params['edit_extra_dynaproperties'] = {
'link_id': forms.CharField(widget=forms.HiddenInput, required=True),
@@ -109,7 +109,7 @@
entity = context['entity']
if entity:
- on = entity.commented
+ on = entity.scope
else:
seed = context['seed']
on = seed['commented']
@@ -145,7 +145,7 @@
"""
form.fields['created_by'].initial = entity.author.name
- form.fields['on'].initial = entity.commented.name
+ form.fields['on'].initial = entity.scope.name
form.fields['link_id'].initial = entity.link_id
form.fields['scope_path'].initial = entity.scope_path