New Question How to Let a user upload a Video and then show the content on Templates in Django?

30 views
Skip to first unread message

djangorobert

unread,
Mar 12, 2018, 3:16:52 PM3/12/18
to Django users
Hi Im not sure if i am the only one in the Django community who has been trying to add this feauture for a couple of years Basically what i want is to let the user upload videos.
I know that you could add the line in your models with a ImageField is that right? 

but then in the template with a 


{{ object.photo.url}}.

you could do something like that 

but when i load the page it just does not load the pictures or videos 

any help would be great thanks 


carlos

unread,
Mar 12, 2018, 3:29:11 PM3/12/18
to django...@googlegroups.com
what use Imagefield?,  you use FileField is you need the user upload a video like mp4. avi, mpg etc.
and in your html use tag <video> for render. {{object.video}}
example
<video width="320" height="240" controls>
  <source src="{{object.video}}" type="video/mp4">
Your browser does not support the video tag.
</video>



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0e2b1c19-5aa9-4dab-bec7-b61a689006f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
att.
Carlos Rocha

djangorobert

unread,
Mar 12, 2018, 5:11:35 PM3/12/18
to Django users
Hi Carlos I figured it out actually i put this {{user.profile.vid.url}}


On Monday, March 12, 2018 at 2:29:11 PM UTC-5, sacrac wrote:
what use Imagefield?,  you use FileField is you need the user upload a video like mp4. avi, mpg etc.
and in your html use tag <video> for render. {{object.video}}
example
<video width="320" height="240" controls>
  <source src="{{object.video}}" type="video/mp4">
Your browser does not support the video tag.
</video>


On Mon, Mar 12, 2018 at 1:16 PM, djangorobert <djangoc...@gmail.com> wrote:
Hi Im not sure if i am the only one in the Django community who has been trying to add this feauture for a couple of years Basically what i want is to let the user upload videos.
I know that you could add the line in your models with a ImageField is that right? 

but then in the template with a 


{{ object.photo.url}}.

you could do something like that 

but when i load the page it just does not load the pictures or videos 

any help would be great thanks 


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.



--
att.
Carlos Rocha

anuch thakker

unread,
Mar 12, 2018, 5:11:40 PM3/12/18
to Django users
try to create one folder "{% static 'your folder name /file name' %}"also create static folder
Reply all
Reply to author
Forward
0 new messages