Google "ajax tutorial" or even better just google jquery and take it
from there. There are several tutorials on how to integrate jquery and
django as well.

Thomas

On Wed, Feb 8, 2012 at 10:11 AM, coded kid <duffleboi...@gmail.com> wrote:
> How bro? Don't know Ajax. Can you please put me through? I'm a
> Nigerian bro!
>
> On Feb 8, 10:02 am, Babatunde Akinyanmi <tundeba...@gmail.com> wrote:
>> Use AJAX or asynchronous programming
>>
>> On 2/8/12, coded kid <duffleboi...@gmail.com> wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> > Hello, I want to make the below codes let users update their status in
>> > the Django . And their update should display on the same template. But
>> > it’s not working.  E.g when a user type in “To be a hacker is not a
>> > day’s job” in the status textarea and click on update button below the
>> > form. The update should display on the same template for his or her
>> > friends to see. Just like how we post status update on fb.
>>
>> > In models.py
>> > from django.contrib.auth.models import User
>> > from django.forms import ModelForm, Textarea, HiddenInput
>> > from django.db import models
>>
>> >     class mob (models.Model):
>> >     username=models.ForeignKey(User, unique=True)
>> >     state_province=models.CharField(max_length=50)
>> >     body=models.TextField(max_length=10000)
>> >     date=models.DateTimeField()
>>
>> >     def __unicode__(self):
>> >         return u"%s - %s - %s - %s" % (self.username,
>> > self.state_province, self.body,   self.date)
>>
>> >     def get_absolute_url(self):
>> >         return "/post/%s/" % unicode(self.id)
>> >     def get_author_url(self):
>> >         return "/u/%s/p/0" % (self.username)
>>
>> >     class mobForm(ModelForm):
>> >     class Meta:
>> >         model=mob
>> >         fields=('body','username','state_province','date')
>> >         widgets={
>> >             'body':Textarea(attrs={"rows":2, "cols":40}),
>> >             'username': (HiddenInput),
>> >             'state_province': (HiddenInput),
>> >             'date':(HiddenInput),
>> >         }
>>
>> > In views.py
>> > from myweb.meekapp.models import mobForm, mob
>> > from django.shortcuts import render_to_response
>> > from django.contrib.auth.models import User
>> > from django.http import HttpResponse, Http404
>> > from django.template import RequestContext
>> > from django.http import HttpResponseRedirect
>>
>> >     def homey(request):
>> >  #if there’s nothing in the field do nothing.
>> >     if request. method != "":
>> >         return HttpResponseRedirect('/homi/')
>>
>> >     newmob=mob()
>> >     newmob.username=request.user
>> >     newmob.date=datetime.datetime.now()
>> >     newmob.body=request.POST['body']
>> >     if request.POST['body'] <> '':
>> >         newmob.body=body.objects.get(id=request.POST['body'])
>> >         newmob.save()
>> >         return HttpResponseRedirect('/homi/')
>> >     else:
>> >         return render_to_response('meek_home.html', {'mobForm':
>> > mobForm },context_instance=RequestContext(request))
>>
>> > in template
>>
>> >     {% extends "base_meek.html" %}
>> >           {% block body %}
>> >        <div class="form">
>> >    <form action="."  method="post" enctype="multipart/form-data">
>> >      <table>
>> >            {{ mobForm }}
>> >      </table>
>> >      <input type="submit" value="Update" />
>> >    </form>
>> >        {% endblock %}
>>
>> > What am I doing wrong? Would love to hear your opinion.
>>
>> > --
>> > 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+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> >http://groups.google.com/group/django-users?hl=en.
>>
>> --
>> Sent from my mobile device
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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

Reply via email to