django-filer
django-filer copied to clipboard
Filer models should have a foreign key to `sites.Site`
FIler models should have a ForeignKey("sites.Site", null=True, blank=True).This field can be hidden in /admin/.
It will let people to take advantage of the site framework when they need it.
I asked the question few times on IRC but nobody picked it up there so I am trying the issue tracker....
what would the use case be?
hello @stefanfoulis
The use case is that have multiple sites sharing one instence of django-filer. We customize the admin to only show the items that belong the the current site.
In our case we would like to be able to filter the folders and files and images ... to only show the one that belong to the current site. I do not thing that this is a common case so I am fine with null=True, blank=True and let implementators to wire in the logic they want.
django-cms has such field so it would also align the 2 packages.
What do you think about this ?
This could probably be solved by using permissions on root folders per site (over an auth.Group per site). That way the users would only see the Folders for their respective sites. Would that solve your use-case?
I have to give it a try once we will have loaded some "real data" into the filer. last time I check performance tax on the usage of the permission machinery was a no go on a large installation several hundred thousands of images.
But in theory this could solve the use case that I am trying to achieve.
@stefanfoulis thank you very much for your feedback.
I see... performance. I see where that can be an issue.
I wouldn't like adding a field (even if it dormant) that has no functionality for the default user of django-filer. Not sure about the performance impact in your case, but maybe you could create your own model with a OneToOne to Folder to save the site. Then add some signals to maintain that field and override admin to do the filtering.
<braindump>
I think django-cms handles site visibility over permissions. So if we want to be consistent, we'd run into the same bottleneck.
How would you expect this to behave?
Best thing for performance would probably be, that folders are simply filtered by SITE_ID from settings. But that would mean that even a superadmin can only edit files from a different site, if he logs into admin on the other domain. A folder would strictly be assigned to a specific site. And if there is no data-sharing between sites, they may as well be in completely different databases.
Another possibility would be to handle sites like another level in the folder hierarchy. Basically that there is a "root" for each site. And you can select from which site you'd like to browse the files. With a special section for files that are shared between all sites. Allowing a Folder/File to be in multiple sites at once would probably make things to complex for users to understand.
I wish we'd find a more performant way to handle hierarchical permissions. I've been thinking about limiting permissions to Groups and "caching"/de-normalizing group_ids with read/write/delete to a Folder in a comma separated list (CharField) directly on the Folder model: no more joins. But it feels a bit hacky.
</braindump>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This will now be closed due to inactivity, but feel free to reopen it.