I met the django-uploadify (multiple file uploading) application, but the only template-use is described in wiki of the project. I need to integrate it with django admin. Any ideas?
#rebus and #Mordi have good suggestions; one of those is probably your best bet. Still...
The current implementation of file uploads in web browsers is single file only. That's a limitation of the HTML standards and the browsers themselves. When you see multiple file upload capability (all at once / select multiple) in some web app, something like Flash or Java is in play. You could potentially use a Flash or Java applet (check out Uploadify - about the easiest to work with you'll find), if you wanted, but you'd have to do some work tying it into Django: namely mapping the output of the applet to the input the Django Admin expects on POST.
Personally I found this package to be painful when I attempted to do this locally. It is 7 years old and not maintained. django-filer is a more modern implementation that has this exact functionality built into the admin panel, it was quick to set up and it seems to be maintained a lot better. And the UI is excellent!
If your really set on using uploadify my attempt was quite painful. When I went to the website to download the uploadify jQuery plugin it was a paid download. After looking a bit I found a fork, and was able to get it going locally, but because the python package is old it required a lot of changes from python 2.7..
To integrate this with your project in the admin will definitely require you to write your own custom admin template. In your admin.py you would have to override the default template and methods, this faq has some insights. In your new template you would include the uploadify jquery script and put the upload file field inside the form where your model fields would be. When you upload files the signal sender in the package will fire, and you would just have to intercept the signal and handle it with your intended logic
Very easy to implement multiple image upload with this project:
https://github.com/tstone/django-uploadify
Related
I am trying to rebuild our website in Django, and I am currently facing a series of rather difficult challenges for which I am not prepared. I was hoping to get some help in the matter.
The website I am building is an online archival platform for artists called Lekha. The core of Lekha is the dashboard page (which you can check out on this link, just sign in with the email stacko#test.com and the password test if you have the patience).
On the dashboard page, users have access to a hierarchical filesystem that we would like to function like a desktop filesystem for ease of use. Users can use the filesystem to organize their 'artworks' into folders. These artworks themselves are a collection of media, along with the metadata of the artwork. To upload this media and fill in the metadata, users will use a form. If users want to edit an artwork's metadata, they can do so through an auto-populated form on the same page.
The issue that I am facing is that I am struggling to find an elegant way to make all of this happen without reloading the page. Users need to be able to add, delete, and rename folders in the filesystem without reloading the page (just like dropbox). They also need to be able to add 'artwork' database entries using a popup form, and edit 'artworks' they have created through an auto-populated form that is also served to them without reloading the page (as it is currently implemented on our existing dashboard page).
All of the Django tutorials I have seen delete items using a dedicated /delete/ page, but this would require reloading the page. Based on my research, the solution I am looking for has to do with asynchronous updating through AJAX.
I wanted to ask all the Django experts out there what the best way to go about this would be. Are there any best practices I should know about before going into this? We are building our website to be robust and scale well.
Are there any specific libraries for asynchronous stuff in Django that are best?
How do asynchronous websites scale if we have several users on them at the same time, and should I write the backend in any specific way to account for potential scaling issues?
What is the difference between ASGI and WSGI?
Are there tools that I can use such as htmx to make my life easier?
I have a Django site and a local install of Alfresco (community edition). One of my model contains a file reference which maps to a document in Alfresco. The view should have a field that spawns a file browser that can access the repository structure within Alfresco so that the user can pick whichever file they want at whichever version.
I looked at the CMSIlib module and it seems to be providing all the interaction I need for the back end code. Although downloading a document seems clunky.
There are lots of Django file browsers but none seem to interface with CMSIlib.
Do I have to code my own or have I missed something?
The version is Alfresco Community v5.0.0 (d r99759-b2) schema 8022 Spring Surf and Spring WebScripts - v5.0.0.
To be honest, I am not a python guy ! But I heard over the official #alfresco IRC channel that cmislib is not so much of an active project, and questions about it only bump once in a while .... The RESTful api however may be considered as a good alternative in your use case:
To access alfresco content using the RESTful api, you should be querying this webscript: /alfresco/d/<d|a>/<workspace>/<store>/<nodeId>/<filename>
where :
d and a refer to direct / attached mode
<workspace>, <store> and <nodeId> reference your content nodeRef
<filename> a file name of your choice
So you should be making a GET Request an a URL that looks something like this http://<host>:<port>/alfresco/d/d/workspace/SpacesStore/8444ad61-4734-40e3-b2d4-b8b1c81347fd/myFile.ext
Note : Depending on the permission set on your node, you might need to attach an alf_ticket to the URL for an authenticated alfresco user. Please check this for further insights.
UPDATE 1:
If you have a problem identifying your file nodeRef, then you can setup a repo webscript implementing your custom logic (browsing some folder / searching for a document by name or metadata ....)
If your are not familiar with webscript development check Jeff Pott's tutorial on the subject
UPDATE 2:
To get started with your webscript development check out Alfresco docs/wiki!
Check this wiki page to learn how to retrieve children for a given node !
Or check this wiki page to learn how to develop webscripts implementing your custom business logic.
If you do not have anything against the YUI javascript library (that is no longer actively maintained), you can integrate the object-finder already available in Alfresco Share. The library is in
share/components/object-finder/object-finder.js
You will need to modify it a bit given that you are not inside Share.
To be totally honest, I do not know if it is feasible because it has other dependencies but being a browser site library, in theory can be integrated everywhere.
I'm currently learning django and working on my project. My project involves sharing my composed music and allowing free downloads to people. Is there an API for django that can enable me to upload my music and enable users to download at will?
Any advice is appreciated.
Thanks.
In general I agree with Rajat, what you are trying to achieve (at least the way you described it), can be done with standard Django forms and file handling. However, this app should have already built in a lot of the stuff you require.
You don't need an API to upload files to your servers.You only need a form to do that.And for enabling your users to download content,you only need links to the files.You can use some api to let only authenticated users download the content from your site.
You can add the file user submitted file in media folder
We then later you can locate it's path to make available for your users
I'm creating a django app which needs some document management functionality - users will upload documents, they'll be viewing lists of the documents and selecting them in fairly simple ways (Primarily, they'll be shown a set of documents in specific categories shared by others in their organisation).
Because I want to integrate this with my app, I don't need a very feature rich user interface (in fact, the app or library could be entirely unusable without further coding without that being a problem). It does have to be usable with django.
So - what are some good apps or libraries for django that provide appropriate models and UI elements suitable for integration into a larger app.?
I've looked at the django packages page, and none of the items on there are, as far as I can, see especially suitable. In particular, Mayan does not appear to have been created with integration in mind.
I haven't personally used these apps, but Django Packages is always a good starting place. Have you looked at under Document Management?
Mayan (rtd, github, homepage) looks to be actively maintained and pretty mature.
The other two listed are django-treenav and django-file-picker, though they do not seem to be as robust or as actively maintained, but they may be a good fit given your basic needs.
Of course if your needs are simple it may be just as easy to implement it yourself, django model's FileField is straightforward to use and they have great documentation on how to handle file uploads from forms - https://docs.djangoproject.com/en/dev/topics/http/file-uploads/.
Is there any app used for uploading in Pinax?
There are different apps included in Pinax that are used for uploading different things: avatars, photos, attachments. The first two are fairly specific but django-attachments is fairly generic if your goal is to attach files to objects.
We also will probably add django-adminfiles in 0.9
You need to write the form and everything yourself (or find a generic django app that does what you want). Pinax is not a CMS where you just attach apps and never actually have to write any code. It gives you an already made social networking site so that you can write the parts that you are interesting in writing (this sounds like something you want to write).