Jump to content

Check out our Community Blogs


Member Since 05 Nov 2010
Offline Last Active Feb 16 2011 12:02 PM

#582929 Python Web Framework

Posted by Vladimir on 05 December 2010 - 08:50 AM

Do I need python intepreter in that server?

Yes, but in most cases you will not be bothered of installing Server/DB/Python yourself.

Is it possible to create youtube like site with Django.

Why not? Django is a general purpose framework. For streaming videos you will probably chose Red5, but other tasks can be done with Python/Django.

What kind of a server you use to host Django site?

Whatever server hosting can deliver; that's responsibility of hosting/system administrator. For development there is a built-in development server, which can be started in one command:
manage.py runserver

  • 1

#582870 Check for duplicates and submit

Posted by Vladimir on 05 December 2010 - 12:46 AM

I added comments to the code, but feel free to ask questions if you don't understand anything:



<form method="post" action="" />
    <input type="radio" value="1" name="name1" />1
    <input type="radio" value="2" name="name1" />2
    <input type="radio" value="3" name="name1" />3
    <input type="radio" value="1" name="name2" />1
    <input type="radio" value="2" name="name2" />2
    <input type="radio" value="3" name="name2" />3
    <input type="radio" value="1" name="name3" />1
    <input type="radio" value="2" name="name3" />2
    <input type="radio" value="3" name="name3" />3
    <input type="submit" />

<!-- Load jQuery from Google CDN -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
$(function() { // execute function when DOM is ready
  var validateData = function() {
	$('.error').remove(); // remove all errors

    // get form values
	var name1 = $('form input[name="name1"]:checked').val(),
	    name2 = $('form input[name="name2"]:checked').val(),
	    name3 = $('form input[name="name3"]:checked').val();

	var readyToSubmit = true,
	    isValid = true,
	    error = '',
	    values = {},
	    names = {name1: name1, name2: name2, name3: name3};

    // start validation 
	$.each(names, function(k, v) {
		if (!v) { // user did not cheched radio
			readyToSubmit = false;
		} else if (v in values) { // value is not unique
			error = values[v] + ' and ' + k + ' have the same value';
			isValid = false;
		} else { // add value to the dict
			values[v] = k;

	if (readyToSubmit) { // form is ready is submit (user checked all radios)
		if (isValid) { // all values are unique
			alert('Form can be submit now'); // replace this with ajax submit
		} else { // display error the user
			$('<div class="error">' + error + '</div>').appendTo($('form'));

  // validate data whenever user check radio
  $('form input[name="name1"]').change(validateData);
  $('form input[name="name2"]').change(validateData);
  $('form input[name="name3"]').change(validateData);



  • -1

#582019 Div Class Body

Posted by Vladimir on 28 November 2010 - 08:49 AM

You need something like this (I did not check the code, so consider it as pseudo code).
.error{border: 2px solid #FF0000;padding:15px;margin:10px;background:#f8f8f8;}
.error-img {background-image: url('error.gif')}
<div class="error"><span class="error-image"></span> There is an error</div>

  • 1

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download