understand what you mean?
What do you mean you want to use the index for the filename instead of
the pk?
On Jul 28, 7:36 pm, Jonathan of Cambridge <readb...@gmail.com> wrote:
> I've been working on using django-filetransfers.
>
> Curious whether it works well for you.
>
> My current challenge is that I want to use the index as the file name
> for the url rather than the pk. Anyone have an idea how to do that
> easily?
>
> I'm thinking this is a simple question about databases in django.
>
> Thank you in advance,
>
> Jonathan
> --------------------------------------------------------------------------- --------------
>
> class UploadModel(models.Model):
> file = models.FileField(upload_to='uploads/%Y/%m/%d/%H/%M/%S/')
>
> class UploadForm(forms.ModelForm):
> class Meta:
> model = UploadModel
>
> from filetransfers.api import serve_file
>
> def download_handler(request, pk):
> upload = get_object_or_404(UploadModel, pk=pk)
> return serve_file(request, upload.file)
>
> On Jul 23, 1:17 am, Vusal Alishov <vusal.alis...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hello, I want to upload image in django-admin interface to few
> > folders.
> > My models image field such: image =
> > models.ImageField(upload_to='images')
> > How can I do it?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment