Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin images and folder empty, data still present #438

Closed
RRMoelker opened this issue Aug 25, 2014 · 16 comments
Closed

Admin images and folder empty, data still present #438

RRMoelker opened this issue Aug 25, 2014 · 16 comments
Assignees
Milestone

Comments

@RRMoelker
Copy link

I've run into a problem where the filer admin files and folders are no longer visible. I traced it back to a change from version 0.9.5 to 0.9.6.

This is how the admin looks in 0.9.5:
filer_0 9 5
(edited image to remove user data)

This is how the admin looks in 0.9.6:
filer_0 9 6
Note that in the second image the folders are no longer showing visible, but it does however state that there are 4 folders in the view.

I've encountered the issue on two different machines and disabling django-suit didn't seem to solve te problem. A set of the installed packages for the none working setup:

Django==1.5.9
django-filer==0.9.6
django-suit==0.2.9
django-autocomplete-light==1.4.14
South
django-compressor (only used for css in admin)

The autocomplete light javascript throws an error "Uncaught TypeError: undefined is not a function widget.js:343". But it does so in both the working and broken version. I think this is unrelated and is caused by loading jquery in the wrong order (jquery, autocomplete.js, jquery, filer.js).

Using an older version is a good enough fix at the moment for us, but I hope this helps somebody else.

@chris-erickson
Copy link

Same here with:

django==1.6.6
django-ckeditor-updated==4.4.0
django-filer==0.9.6
django-mptt==0.6.1
django_polymorphic==0.5.6
django-suit==0.2.8
easy_thumbnails==2.0.1
Pillow==2.5.3
south==1.0

...Many others omitted (seem unrelated).

Reverting to 0.9.5 also works for me.

@yakky
Copy link
Member

yakky commented Aug 30, 2014

It may be caused by some incompatibilities with django-suit.
Have you checked by removing it?

@SalahAdDin
Copy link

Could be some incompatibilities.

@RRMoelker
Copy link
Author

It is a Django suit issue. Thought I checked that. Anyways, problem template file is "directory_table.html" in folder "/suit/templates/admin/filer/folder/"

Removing the file solves the problem. Alternatively copy the "directory_table.html" file into you own projects "templates/admin/filer/folder/". Next replace line 18:

{% for item in paginated_items.object_list %}

by the line:

{% for item, item_perms in paginated_items.object_list %}

The object list seems to be a list of tuples now whereas is was a simple list before (total guess). The actual item_perms isn't used, but atleast the for loop is used this time around.

@chris-erickson
Copy link

It appears this issue is now resolved in django-suit: darklow/django-suit#257

@yakky
Copy link
Member

yakky commented Sep 7, 2014

Does django-suit 2.10 contains this fix?

@stefanfoulis
Copy link
Contributor

closing this issue, as it appears that the problem was fixed in django-suit. please re-open this issue if my assumption is wrong.

@yunmanger1
Copy link

@stefanfoulis

screenshot from 2016-03-14 16 50 12

Having this issue with django-cms==3.2.1 and django==1.8.7

@yunmanger1
Copy link

@stefanfoulis

I had hours of fun debugging. I almost got defeated by this bug.

These issues are not solved completely #753 #630

This line below ruins everything in production when ManifestStaticFilesStorage is used and especially when template debugging is off.

https://github.com/divio/django-filer/blob/develop/filer/models/mixins.py#L20

The admin/filer/folder/directory_listing.html includes admin/filer/folder/directory_table.html which uses icons on the model. The most interesting part is that when template debugging is disabled, no errors happen. And on local machine I have different static storage. Once I enabled template debugging on production I could see an error:

ValueError: The file 'filer/icons/unfiled_folder_16x16.png' could not be found with <sdu_site.contrib.static.PipelineGzipManifestWhitenoiseStorage object at 0x7fc016485190>.

@stefanfoulis stefanfoulis added this to the 1.2.0 milestone Mar 16, 2016
@stefanfoulis
Copy link
Contributor

@yunmanger1 thanks for the analysis!

@Chronial
Copy link
Contributor

@yunmanger1 I see you are using a custom static storage. It seems likely that this bug is not reproducible without it.
Could you reduce it to the minimum that triggers this bug?

This might also just be a bug in your custom storage class. The file it can't find is definitely there, so it should find it. I think the django-filer code you are referring to has the property of calling static() unusually early in the request, before template rending started. Maybe your storage class isn't set up properly at this point?

If this is the case it might still be worth changing django-filer, because this unusual behaviour of django-filer is surely not helping :).

@yunmanger1
Copy link

@Chronial I know exactly where it happens.

https://github.com/django/django/blob/master/django/contrib/staticfiles/storage.py#L93

If you use django.contrib.staticfiles.storage.ManifestStaticFilesStorage as a storage.

Particularly in my case I am using this:

from whitenoise.django import GzipManifestStaticFilesStorage
from pipeline.storage import PipelineMixin


class PipelineGzipManifestWhitenoiseStorage(PipelineMixin, GzipManifestStaticFilesStorage):
    pass

FILER_ADMIN_ICON_SIZES by default has ('16', '32', '48', '64') values, unfiled_folder_16x16.png is not in icons folder.

Actually @stefanfoulis removed the '16' from default icon sizes nine days ago in 1089ca1,
but this is not solution because there are other icons that are not present, for example missingfile_64x64.png or no file nofile_64x64.png which might be not used in template, but the IconsMixin will access them via static because '64' is present in FILER_ADMIN_ICON_SIZES

@stefanfoulis
Copy link
Contributor

ok, lets add those missing icons then. @mikek could you have a look at this please?

@mikek
Copy link
Contributor

mikek commented Mar 30, 2016

@stefanfoulis, after some debugging It seems that to fix this adding missing icons (sizes) should be enough. I suggest we even catch/ignore ValueError around the static() call in IconsMixin for the case when there are still some missing icons.

It does not affect collectstatic command and is not strictly related to #630.

@stefanfoulis
Copy link
Contributor

ok 👍

@mikek
Copy link
Contributor

mikek commented Apr 1, 2016

Fixed in #785

@mikek mikek closed this as completed Apr 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants