Code Monkey home page Code Monkey logo

Comments (9)

bradleyg avatar bradleyg commented on August 21, 2024

Can you post your S3DIRECT_DESTINATIONS?

from django-s3direct.

fabiohild avatar fabiohild commented on August 21, 2024

Hey Bradley, thanks for the help! My S3DIRECT_DESTINATIONS are as follows:

S3DIRECT_DESTINATIONS = {

    # Allow logged in users to upload any type of file and give it a private acl:
    'avatar': ('profiles/avatars', lambda u: True, ['image/jpeg', 'image/png'],),
}

On the models.py:

avatar = S3DirectField(upload_to='media/profiles/avatars', null=True, blank=True, verbose_name="Avatar")

Thank you very much!

from django-s3direct.

bradleyg avatar bradleyg commented on August 21, 2024

S3DirectField doesn't take an "upload_to" argument. It takes a "dest".

avatar = S3DirectField(dest='avatar')

from django-s3direct.

fabiohild avatar fabiohild commented on August 21, 2024

No luck here Bradley, I added destinations for all the files I'm uploading, and changed the upload_to to dest=, but when I try to do a schemamigration or syncdb I get this:

class Course(models.Model):
  File "/Users/fabio/Desktop/loredrop/src/courses/models.py", line 31, in Course
    cover = S3DirectField(dest='cover', blank=True, null=True)
  File "/Users/fabio/Desktop/loredrop/lib/python2.7/site-packages/s3direct/fields.py", line 10, in __init__
    super(S3DirectField, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'dest'
(loredrop)$ 

My S3Destinations are as follows:

S3DIRECT_DESTINATIONS = {

    'avatar': ('media/profiles/avatars', lambda u: True, ['image/jpeg', 'image/png', 'image/gif'],),
    'cover': ('media/courses/covers', lambda u: True, ['image/jpeg', 'image/png', 'image/gif'],),
    'image': ('media/courses/images', lambda u: True, ['image/jpeg', 'image/png', 'image/gif'],),
    'video': ('media/courses/videos', lambda u: True, ['video/mp4'],),

}

The model for the field above is:

cover = S3DirectField(dest='cover', blank=True, null=True)

Thank you very much for the help! Really appreciate it!

from django-s3direct.

bradleyg avatar bradleyg commented on August 21, 2024

And you're definitely on the latest version? 0.3.8?

from django-s3direct.

fabiohild avatar fabiohild commented on August 21, 2024

Updated to the last version and running Django 1.6.8, does it have to be 1.7?

I've updated it and went through the read-me again, made sure I deleted all the obsolete stuff. Now the fields are showing up but when I select a file it doesn't upload it or display the progress bar. It is actually behaving like a regular filefield. but not uploading at all.

Is there something else I should do? Update Django maybe? Thank you.

from django-s3direct.

bradleyg avatar bradleyg commented on August 21, 2024

I just tried on Django 1.6.8 and all working fine. Are the any errors javascript in the browser console?

from django-s3direct.

fabiohild avatar fabiohild commented on August 21, 2024

Hi Bradley,

Not sure how, but I managed to get everything working. Thank you very much for the help and for the patience with my newbie questions.

Thanks!

from django-s3direct.

bradleyg avatar bradleyg commented on August 21, 2024

Great! I'll close :)

from django-s3direct.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.