Skip to content
Browse files

Issue #25: Only folders for the current site.

Also filter folders that has been registerred in the current site.
  • Loading branch information...
1 parent a21d6ff commit 14daa6218e6313afb63094f6dd834e3e46fff8ee @erlenddalen committed May 27, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 media_tree/admin/filenode_admin.py
View
7 media_tree/admin/filenode_admin.py
@@ -140,8 +140,11 @@ def formfield_for_dbfield(self, db_field, **kwargs):
if db_field.name == 'parent' and issubclass(db_field.rel.to, FileNode):
# overriding formfield_for_dbfield, thus bypassign both Django's and mptt's
# formfield_for_foreignkey method, and also preventing Django from wrapping
- # field with RelatedFieldWidgetWrapper ("add" button resulting in a file add form)
- valid_targets = FileNode.tree.filter(**db_field.rel.limit_choices_to)
+ # field with RelatedFieldWidgetWrapper ("add" button resulting in a file add form)
+
+ # Issue 25 - Only allow folders registerred in the current site.
+ valid_targets = FileNode.tree.filter(**db_field.rel.limit_choices_to).filter(
+ site=Site.objects.get_current())
request = kwargs['request']
node = get_request_attr(request, 'save_node', None)
if node:

0 comments on commit 14daa62

Please sign in to comment.
Something went wrong with that request. Please try again.