Permalink
Browse files

fix

  • Loading branch information...
1 parent f0ab0b3 commit 22123571d4cdf2171dcb20740d9b7f27bc14ecec @gugu gugu committed Apr 5, 2012
Showing with 7 additions and 8 deletions.
  1. +7 −8 actstream/models.py
View
@@ -164,14 +164,13 @@ def setup_generic_relations():
if not model:
continue
for field in ('actor', 'target', 'action_object'):
- if hasattr(model, '%s_actions' % field):
- delattr(model, '%s_actions' % field)
- generic.GenericRelation(Action,
- content_type_field='%s_content_type' % field,
- object_id_field='%s_object_id' % field,
- related_name='actions_with_%s_%s_as_%s' % (
- model._meta.app_label, model._meta.module_name, field),
- ).contribute_to_class(model, '%s_actions' % field)
+ if not hasattr(model, '%s_actions' % field):
+ generic.GenericRelation(Action,
+ content_type_field='%s_content_type' % field,
+ object_id_field='%s_object_id' % field,
+ related_name='actions_with_%s_%s_as_%s' % (
+ model._meta.app_label, model._meta.module_name, field),
+ ).contribute_to_class(model, '%s_actions' % field)
# @@@ I'm not entirely sure why this works
setattr(Action, 'actions_with_%s_%s_as_%s' % (

0 comments on commit 2212357

Please sign in to comment.