New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Validate youtube url before saving #31

Closed
sunjoomoon opened this Issue Jul 11, 2014 · 5 comments

Comments

Projects
None yet
3 participants
@sunjoomoon

sunjoomoon commented Jul 11, 2014

How to validate if youtube video url format is correct before saving? Wrong url format saved returns error both in the browser and admin page.

@yetty

This comment has been minimized.

Collaborator

yetty commented Jul 12, 2014

Please provide more details about your problem - I need to know exact url to determine the problem. It should be helpful to provide you version of django-embed-video, too. Validation in administration should work fine.

@yetty yetty added this to the v0.11 milestone Jul 12, 2014

@yetty yetty self-assigned this Jul 12, 2014

@sunjoomoon

This comment has been minimized.

sunjoomoon commented Jul 16, 2014

sorry for the late one. here comes my environment- django-embed-video==0.9 and django == 1.6.5

Enterting correct url like below,
http://www.youtube.com/watch?v=gauN0gzxTcU -> works fine

but often clients enter wrong youtube url.. for example,
http://www.youtube.com/edit?video_id=eBea01qmnOE
returns below

Error during template rendering

In template /../../embed_video/templates/embed_video/embed_code.html, error at line 1
(Could not get exception message)
1   <iframe width="{{ width }}" height="{{ height }}" src="{{ backend.url }}" class="video-frame" allowfullscreen></iframe>

So, hope if youtube video url format is not correct, then show warning message while saving. Any advice? Thanks.

@yetty yetty added the bug label Jul 19, 2014

@yetty yetty closed this in 3c46dca Jul 19, 2014

@yetty

This comment has been minimized.

Collaborator

yetty commented Jul 19, 2014

Validation of urls has been improved, so if you use EmbedVideoFormField, invalid urls will raise ValidationError.

yetty added a commit that referenced this issue Jul 19, 2014

@sunjoomoon

This comment has been minimized.

sunjoomoon commented Jul 20, 2014

Thank you Juda. As per your advice, all went fine now. I upgraded to 0.10. I repeated the same and here is the result.

  1. http://www.youtube.com/edit?video_id=eBea01qmnOE #saved ok, video plays in browser. OK
  2. wrong url was tried but warning message came up before saving, like a typical django message.
    Thanks again, this helps me and clients as well a lot.
@mpachas

This comment has been minimized.

Member

mpachas commented Jul 24, 2014

Thank you guys, this is really helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment