Versions not displaying correctly

14 views
Skip to first unread message

Jonathan Baker

unread,
Jun 30, 2013, 8:37:27 PM6/30/13
to djangofi...@googlegroups.com
I'm using a bash script to copy a handful of test images to my media/uploads dirs that FactoryBoy then uses to populate a few FileBrowseFields (just loading lots of dummy data here). When I view any of the FileBrowseFields within the admin, the FILEBROWSER_ADMIN_THUMBNAIL version is correctly created and rendered (60x60). However, if I try to call any of the other versions (from within a template) that I've specified in settings.py, they aren't created and rendered for any of the test images.

Again, the 'admin_thumbnail' version is correctly created and rendered within grappelli, but none of the other versions are created and rendered when requested via custom templates.

The catch: if I manually upload an image, I can request any custom version in a custom template and it's correctly rendered and created.

All of this is happening on an Ubuntu 12.10 machine, and I've checked that the owner, group and permissions all line up on both the test images and images that are uploaded manually.

Any help would be greatly appreciated,
Jonathan

settings.py
FILEBROWSER_VERSIONS = {
    "admin_thumbnail": {
        "verbose_name": "Admin Thumbnail",
        "width": 60,
        "height": 60,
        "opts": "crop"},
    "marquee": {
        "verbose_name": "Marquee",
        "width": 1400,
        "height": 700,
        "opts": ""},
    "casestudy_teaser_image": {
        "verbose_name": "CaseStudy Teaser Image",
        "width": 300,
        "height": 190,
        "opts": ""},
    "casestudy_image_large": {
        "verbose_name": "CaseStudy Image Large",
        "width": 495,
        "height": 245,
        "opts": ""},
    "casestudy_image_medium": {
        "verbose_name": "CaseStudy Image Medium",
        "width": 300,
        "height": 244,
        "opts": ""},
    "casestudy_image_small": {
        "verbose_name": "CaseStudy Image Small",
        "width": 165,
        "height": 244,
        "opts": ""},
    "service_icon": {
        "verbose_name": "Service Icon",
        "width": 55,
        "height": 55,
        "opts": ""},
    "staffprofile_portrait_small": {
        "verbose_name": "StaffProfile Portrait Small",
        "width": 135,
        "height": 135,
        "opts": ""},
    "staffprofile_portrait_large": {
        "verbose_name": "StaffProfile Portrait Large",
        "width": 300,
        "height": 300,
        "opts": ""},
}
FILEBROWSER_ADMIN_VERSIONS = []
FILEBROWSER_ADMIN_THUMBNAIL = 'admin_thumbnail'

index.html
{% extends "base.html" %}
{% load fb_versions %}
{% load flatblock_tags %}
{% load portfolio_extras %}

{% block title %}Index{{ block.super }}{% endblock title %}

{% block body_class %}front{% endblock body_class %}
{% block marquee %}
<div id="marquee" style="background: #{{ marquee.bg_color }} url({% version marquee.image 'marquee' %}) no-repeat center center;">
    <div class="marquee-content">
        <h2>{{ marquee.title }}</h2>
    </div>
</div>
{% endblock marquee %}
{% block main %}

{% if casestudy_list %}

<ul class="case-study-features clearfix">
    {% for casestudy in casestudy_list %}
    <li>
        <a href="{% url 'portfolio:casestudy_detail' casestudy.id casestudy.slug %}">
            <img src="{{ casestudy.teaser_image }}" alt="" />
            <div class="related-info">
                <h5>{{ casestudy.title }}</h5>
                <p>{{ casestudy.description }}</p>
            </div>
        </a>
    </li>
    {% endfor %}
</ul>
{% endif %}
<h2 class="feature title">Clients We Work With</h2>
{% clients %}
{% flatblock "index-intro" %}
{% endblock main %}

patrick kranzlmueller

unread,
Jul 1, 2013, 2:52:26 AM7/1/13
to djangofi...@googlegroups.com
what do you get when displaying the path of an image within the template (before creating a version)?
did you run the tests? any errors?


2013/7/1 Jonathan Baker <jonathand...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django FileBrowser" group.
To unsubscribe from this group and stop receiving emails from it, send an email to djangofilebrow...@googlegroups.com.
To post to this group, send email to djangofi...@googlegroups.com.
Visit this group at http://groups.google.com/group/djangofilebrowser.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jonathan Baker

unread,
Jul 2, 2013, 10:11:49 AM7/2/13
to djangofi...@googlegroups.com
Thanks for getting back to me. I discovered that the media URLs I was generated inside FactoryBoy were prepended with a '/', so once I removed that version functionality worked as expected.

As for your question, I do get one failure when running test tests:

Creating test database for alias 'default'...
................../home/jbaker/.virtualenvs/tdl/local/lib/python2.7/site-packages/django/http/request.py:193: DeprecationWarning: HttpRequest.raw_post_data has been deprecated. Use HttpRequest.body instead.
  warnings.warn('HttpRequest.raw_post_data has been deprecated. Use HttpRequest.body instead.', DeprecationWarning)

FRemoving left-over tmp dir: uploads/tmp_test_0

======================================================================
FAIL: runTest (filebrowser.tests.sites.TestSite_filebrowser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jbaker/.virtualenvs/tdl/local/lib/python2.7/site-packages/filebrowser/tests/sites.py", line 237, in runTest
    test_detail(self)
  File "/home/jbaker/.virtualenvs/tdl/local/lib/python2.7/site-packages/filebrowser/tests/sites.py", line 144, in test_detail
    test.assertTrue(test.site.storage.exists(path))
AssertionError: False is not true

From a functionality standpoint, everything appears fine. I'm able to browse and upload images through the admin, and retrieve specific versions from templates.

Thanks,
Jonathan
Reply all
Reply to author
Forward
0 new messages