Re: Need explanation of the flow of info between my javascript, my View, and my template, trying to diagnose my current roadblock.

2013-04-30 Thread Shawn Milochik
You're welcome. You may be new to it, but you ask better questions than
most I see. When I see "How do I do X?" I usually ignore it. When I see
"Here's what I did. It's not working for some reason" then I try to help if
I can. Keep up the good work.

Shawn

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Need explanation of the flow of info between my javascript, my View, and my template, trying to diagnose my current roadblock.

2013-04-30 Thread Javier Guerra Giraldez
On Tue, Apr 30, 2013 at 2:22 PM,  <7equivale...@gmail.com> wrote:
> "Redirect" Is that what you kids are calling it nowdays..


i found that word in RFC 1945, by Tim Berners-Lee and others, May
1996, where HTTP/1.0 was defined.

hardly a new term in web lingo.

--
Javier

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Need explanation of the flow of info between my javascript, my View, and my template, trying to diagnose my current roadblock.

2013-04-30 Thread 7equivalents
"Redirect" Is that what you kids are calling it nowdays.. Thanks, that was 
the terminology I was lacking. That works I'm learning html, 
javascript, and Django all together on the fly so I'm not well versed in 
basics. Thankyou for your help! It helped clear up the puzzle a bit.


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Need explanation of the flow of info between my javascript, my View, and my template, trying to diagnose my current roadblock.

2013-04-30 Thread Shawn Milochik
If I understand your question and your code properly, the problem is that
you are expecting a redirect, but what's happening is that the raw HTML
from the view is being returned to your JavaScript function, which does
nothing with it.

It seems like what you should do is just do a normal HTML form with an
"action" tag that just redirects to your view. Since you're not accepting
any return values in your JavaScript, you're not doing any "AJAX," so the
JavaScript is an unnecessary complication. If you cut out the JavaScript
entirely and make your button a normal "submit" button it will have the
desired behavior.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Need explanation of the flow of info between my javascript, my View, and my template, trying to diagnose my current roadblock.

2013-04-30 Thread 7equivalents
Hey guys, I need a little help. Here is what I'm trying to do.
I would like to have a html button execute a javascript on click, and the 
javascript should send an GET reguest to the server which should execute 
the View for the page requested. For some reason I can't get it to work...

here is what I've done
(1) I have a working View that executes successfully when the main page is 
requested.
(2) The View loads the template that has the html button and javascript.
(3) I have confirmed the when the button is clicked the javascript executes.

However the page doesn't change to the new page requested, and I get a 404 
error however, the page is there and I link to it from other places in 
the code.

Maybe I misunderstand something in the way the request and load and ajax 
stuff works, I'm still a novice.

Here is my code...

 html & javascript 

 
$(function (){
  $("#blog1").click(function (){
var id =  $( "#blog1" ).val();
var data = { id:id };
$("#blog1").prop('value', 'works');
$.get({ 
  url:"/control/"
});
  });
  return false;
});

//

/// View 
/
def control_page(request):

  sliderB = Slider.objects.get(sliderID=1)
  sliderR = Slider.objects.get(sliderID=2)
  sliderG = Slider.objects.get(sliderID=3)
  sliderP = Slider.objects.get(sliderID=4)
  preprogram1 = Preprogram.objects.get(preprogramID=1)
  preprogram2 = Preprogram.objects.get(preprogramID=2)
  preprogram3 = Preprogram.objects.get(preprogramID=3)
  pin1 = Pin.objects.get(pinID=1)
  variables = RequestContext(request, {'pin1': pin1, 'preprogram1': 
preprogram1, 'preprogram2': preprogram2, 'preprogram3': preprogram3, 
'sliderB':sliderB, 'sliderR':sliderR, 'sliderG':sliderG, 'sliderP':sliderP})
  return render_to_response('control_page.html', variables) 
/

/// urls 
///
urlpatterns = patterns('',
  (r'^$', main_page),
  (r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': 
settings.MEDIA_ROOT}),
  (r'^login/$', 'django.contrib.auth.views.login'),
  (r'^logout/$', logout_page),
  (r'^user/(\w+)/$', user_page),
  (r'^control/$', control_page),
  (r'^gpio_control/$', gpio_control_page),
  (r'^slider/$', slider_page),
  (r'^read_more/$', read_more_page),
  (r'^admin/', include(admin.site.urls)),

)///

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.