Saturday, April 28, 2012

Re: Display Video inside a Text field -Django Templates

Hi,

You will need to identify the video url in the post, then depending on
the url try do some processing, like getting the title or thumbnail
and render it back to your template. If you want to play the video,
you will need a video player. Eg. If it is a youtube link, then embed
the youtube player and use youtube api's if needed to render and load.


Pratik Mandrekar

On Apr 28, 7:56 am, Nikhil Verma <varma.nikhi...@gmail.com> wrote:
> Hi All
>
> I have a TextField to which after applying css it looks like a markup
> editor where i write some text, paste file links upload image etc.Now  if
> the user paste a video link to that editor the video should display inide
> that editor/TextField like in other websites eg: facebook(On click Video
> link it displays on the same page).
>
> Can anybody tell me the steps how can i play the video inside a TextField ?
>
> I searched lot about iframe.In my template i have the textfield in which
> the user paste the link of video saves it and it displays.Now if the user
> click on that video link the video should display inside  that markup
> editor/textfield.
>
> My views :-
>
> def edit_post(request, post_id):
>
>     from djangobb_forum.templatetags.forum_extras import forum_editable_by
>
>     post = get_object_or_404(Post, pk=post_id)
>     topic = post.topic
>     if not forum_editable_by(post, request.user):
>         return HttpResponseRedirect(post.get_absolute_url())
>     form = build_form(EditPostForm, request, topic=topic, instance=post)
>     if form.is_valid():
>         post = form.save(commit=False)
>         post.updated_by = request.user
>         post.save()
>         return HttpResponseRedirect(post.get_absolute_url())
>
>     return {'form': form,
>             'post': post,
>            }
>
> Template
>
> {% if post.user.forum_profile.signature %}
>
>     <div class="postsignature">
>     <br />
>
>     {{ post.user.forum_profile.signature|safe }} # This is the textfield.
>
>     </div>
>
> {% endif %}
>
> --
> Regards
> Nikhil Verma
> +91-958-273-3156

--
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